Conversation
Summary of ChangesHello @danjuv, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces a new OpenTelemetry Metrics Hook to capture detailed metrics related to feature flag evaluations, aligning with the OpenFeature Enhancement Proposal (OFEP). Alongside this new functionality, the existing OpenTelemetry integration has been refactored into a more modular structure, separating tracing and metrics concerns into distinct files and centralizing common constants. This enhances the clarity, maintainability, and extensibility of the OpenTelemetry integration within the OpenFeature hooks. Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
|
Warning Gemini encountered an error creating the review. You can try again by commenting |
a350b3c to
aea7eb3
Compare
Signed-off-by: Danju Visvanathan <danju.visvanathan@gmail.com>
aea7eb3 to
e3229fa
Compare
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces a new MetricsHook for OpenTelemetry and refactors the existing TracingHook into a more organized file structure. The refactoring is well-executed and improves maintainability. The new MetricsHook is a great addition. I've identified a potential high-cardinality issue with an error attribute that could impact monitoring systems, and a minor issue where a string literal is used instead of a defined constant. My review includes suggestions to address these points.
| ) -> None: | ||
| attributes = { | ||
| Attributes.OTEL_FLAG_KEY: hook_context.flag_key, | ||
| "exception": str(exception).lower(), |
There was a problem hiding this comment.
Using str(exception) as a metric attribute value can lead to high cardinality, which is an anti-pattern for metrics and can cause issues with your monitoring backend (e.g., performance, cost). The OpenFeature Enhancement Proposal (OFEP) for metric hooks suggests using error.type with a low-cardinality value.
To align with best practices and the OFEP, I suggest using the exception's type name instead of its string representation. This will keep the cardinality of the error.type attribute low, addressing the concern you raised in the PR description.
| "exception": str(exception).lower(), | |
| Attributes.OTEL_ERROR_TYPE: type(exception).__name__, |
There was a problem hiding this comment.
I agree with this in principle, but the OFEP specifically states to use the message
@toddbaert @beeme1mr can you confirm?
hooks/openfeature-hooks-opentelemetry/src/openfeature/contrib/hook/opentelemetry/trace.py
Outdated
Show resolved
Hide resolved
| { | ||
| "feature_flag.key": "flag_key", | ||
| "feature_flag.provider.name": "test-provider", | ||
| "exception": "test error", |
There was a problem hiding this comment.
Signed-off-by: Danju Visvanathan <danju.visvanathan@gmail.com>
|
Something seems wrong with CI, doesn't seem related to this PR |
Signed-off-by: Danju Visvanathan <danju.visvanathan@gmail.com>
Signed-off-by: Danju Visvanathan <danju.visvanathan@gmail.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #344 +/- ##
===========================================
+ Coverage 96.55% 100.00% +3.44%
===========================================
Files 5 6 +1
Lines 174 220 +46
===========================================
+ Hits 168 220 +52
+ Misses 6 0 -6 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This PR
Related Issues
Fixes #80
Notes
feature_flag.variantbut the TracingHook and SemConv usesfeature_flag.result.variant. I've deferred to pre-existing naming in this PR instead of the proposal._incubatingmodule.