-
Notifications
You must be signed in to change notification settings - Fork 23
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 custom dimensions for metrics #122
Conversation
Signed-off-by: André Silva <[email protected]>
Signed-off-by: André Silva <[email protected]>
… of TagList Signed-off-by: André Silva <[email protected]>
Signed-off-by: André Silva <[email protected]>
Signed-off-by: André Silva <[email protected]>
Signed-off-by: André Silva <[email protected]>
Signed-off-by: André Silva <[email protected]>
/// <param name="customDimensions">The optional custom dimensions.</param> | ||
public MetricsHook(MetricHookCustomDimensions customDimensions = null) | ||
{ | ||
_customDimensionsTagList = customDimensions?.GetTagList() ?? Array.Empty<KeyValuePair<string, object>>(); | ||
|
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 flexibility of this approach is a bit limited. I think a functional approach might be better. Instead of allowing users to define k/v pairs, I would recommend you allow users to define a function that takes an FlagEvaluationDetails object as a param, and returns a tuple or k/v set that will be added. Then users can build whatever data they want and add it as metrics. This will be even more valuable when we add flag metadata to this SDK.
We do something similar in JS: https://github.com/open-feature/js-sdk-contrib/blob/main/libs/hooks/open-telemetry/README.md#custom-attributes
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.
@toddbaert I was looking into the Java implementation and they offer a Flag Metadata (that is not implemented on dotnet SDK yet) and uses a custom dimensions that have a predefined list. Might be interesting to keep the extra dictionary and when we have the flag metadata implemented at SDK level, we use the FlagEvaluationDetails metadata?
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.
Signed-off-by: André Silva <[email protected]>
@askpt I'm guessing based on your commits and the build status, you're still working on this, so I'll mark it draft for now. Feel free to mark it ready whenever. |
This PR
Related Issues
Fixes #118
Notes
otel
library from the unit tests so it will use the same one that is provided in the main project.How to test
On the yellow boxes you can see the custom metrics.