-
Notifications
You must be signed in to change notification settings - Fork 22
feat: Add Metric Hook Custom Attributes #512
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add Metric Hook Custom Attributes #512
Conversation
Signed-off-by: Kyle Julian <38759683+kylejuliandev@users.noreply.github.com>
Signed-off-by: Kyle Julian <38759683+kylejuliandev@users.noreply.github.com>
Signed-off-by: Kyle Julian <38759683+kylejuliandev@users.noreply.github.com>
Signed-off-by: Kyle Julian <38759683+kylejuliandev@users.noreply.github.com>
Signed-off-by: Kyle Julian <38759683+kylejuliandev@users.noreply.github.com>
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #512 +/- ##
==========================================
+ Coverage 87.35% 87.73% +0.38%
==========================================
Files 47 48 +1
Lines 1827 1876 +49
Branches 190 196 +6
==========================================
+ Hits 1596 1646 +50
Misses 188 188
+ Partials 43 42 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
askpt
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Just a small note on a future improvements to the unit tests.
beeme1mr
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The feature looks great but I had a question about the docs. I also wonder if we should consider supporting something similar for traces.
@beeme1mr That tracker idea might be something useful. Should we create an issue to track it if makes sense? |
Signed-off-by: Kyle Julian <38759683+kylejuliandev@users.noreply.github.com>
Signed-off-by: Kyle Julian <38759683+kylejuliandev@users.noreply.github.com>
…ce (#513) <!-- Please use this template for your pull request. --> <!-- Please use the sections that you need and delete other sections --> ## This PR <!-- add the description of the PR here --> In #512 I needed to tweak the sample AspNetCore application to pass Hook options to the MetricsHook. I noticed that in order to pass the options I needed to use the delegate based approach, while discarding the `serviceProvider`, like: ```csharp featureBuilder.AddHostedFeatureLifecycle() .AddHook(_ => new MetricsHook(metricsHookOptions)) ``` It would be simpler and easier for devs to interact with a third overload that allows them to pass an instance of the hook that they want to interact with, like so: ```csharp featureBuilder.AddHostedFeatureLifecycle() .AddHook(new MetricsHook()) ``` ### Related Issues <!-- add here the GitHub issue that this PR resolves if applicable --> ### Notes <!-- any additional notes for this PR --> ### Follow-up Tasks <!-- anything that is related to this PR but not done here should be noted under this section --> <!-- if there is a need for a new issue, please link it here --> ### How to test <!-- if applicable, add testing instructions under this section --> --------- Signed-off-by: Kyle Julian <38759683+kylejuliandev@users.noreply.github.com>
weyert
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This PR
Adds new
MetricsHookOptionsandMetricsHookOptionsBuilderto optionally configure custom attributes that can be tagged on thefeature_flag.evaluation_success_totalmetric. Example usage:Screenshot below shows the AspNetCore sample application tagging the
feature_flag.evaluation_success_totalcounter with the specified dimensions.Related Issues
Fixes #509
Fixes #514
Notes
Follow-up Tasks
How to test