fix(evaluation): gate metrics recording behind WithMetrics option#6042
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## v2 #6042 +/- ##
==========================================
+ Coverage 61.65% 61.75% +0.10%
==========================================
Files 142 142
Lines 14430 14442 +12
==========================================
+ Hits 8897 8919 +22
+ Misses 4790 4784 -6
+ Partials 743 739 -4
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Contributor
There was a problem hiding this comment.
Verdict: approve
Clean change — the metrics gating is correctly wired, the shadowed-variable fix is safe, and the new error-path metric tests cover the important cases. No changes requested.
🤖 Automated review by the Flipt PR review agent.
Evaluation metrics (evaluations total, results, errors, latency) were previously recorded unconditionally for every flag evaluation. This adds a `WithMetrics(bool)` option to the evaluation server, gating all metric recording behind `cfg.Metrics.Enabled`. - Add `WithMetrics(bool)` option and `metricsEnabled` field to Server - Gate all metric recording in variant() and boolean() behind the flag - Extract `baseMetricSet` to eliminate duplicate attribute.NewSet calls - Lift `segmentKeys`/`matched`/`reason`/`segmentMatches` out of rule loop scope to fix shadowed := assignments - Order metric attributes by OTel key name (alphabetical) - Wire option in grpc.go with `cfg.Metrics.Enabled` - Add OTel ManualReader test infrastructure and error-path metric tests Signed-off-by: Roman Dmytrenko <[email protected]>
Signed-off-by: Roman Dmytrenko <[email protected]>
erka
marked this pull request as ready for review
June 23, 2026 20:02
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.
Evaluation metrics (evaluations total, results, errors, latency) were
previously recorded unconditionally for every flag evaluation. This adds
a
WithMetrics(bool)option to the evaluation server, gating all metricrecording behind
cfg.Metrics.Enabled.WithMetrics(bool)option andmetricsEnabledfield to ServerbaseMetricSetto eliminate duplicate attribute.NewSet callssegmentKeys/matched/reason/segmentMatchesout of rule loopscope to fix shadowed := assignments
cfg.Metrics.Enabled