fix: add missing variant dimension in MetricsHook metrics#742
Merged
Conversation
Signed-off-by: André Silva <2493377+askpt@users.noreply.github.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #742 +/- ##
=======================================
Coverage 93.46% 93.47%
=======================================
Files 68 68
Lines 2952 2956 +4
Branches 350 351 +1
=======================================
+ Hits 2759 2763 +4
Misses 135 135
Partials 58 58 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Code Review
This pull request updates the MetricsHook to include the evaluation variant in telemetry tags when it is available. It also includes corresponding unit tests to verify that the variant tag is correctly added when present and omitted when null. I have no feedback to provide.
kylejuliandev
approved these changes
Apr 15, 2026
chrfwow
approved these changes
Apr 17, 2026
This was referenced Apr 30, 2026
Closed
Closed
Closed
Closed
Closed
This was referenced May 12, 2026
Open
Open
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #741
The
MetricsHook.AfterAsyncmethod was not includingfeature_flag.result.variantas a dimension/tag on thefeature_flag.evaluation_success_totalmetric. This is inconsistent with:Changes
src/OpenFeature/Hooks/MetricsHook.cs: Addeddetails.Variantto the tag list inAfterAsync, guarded by a null check (matching the Java SDK pattern). Uses the existingTelemetryConstants.Variantconstant.test/OpenFeature.Tests/Hooks/MetricsHookTests.cs:After_Testto assert the variant tag is present on success metrics.Without_Variant_After_Test_Does_Not_Include_Varianttest to verify the tag is omitted when variant is null.Notes
Metrics now include the missing

variant. See screenshot: