-
Notifications
You must be signed in to change notification settings - Fork 117
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
do not allocate gauge if cardinality metrics are turned off #246
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #246 +/- ##
=======================================
Coverage 48.04% 48.04%
=======================================
Files 65 65
Lines 6061 6061
=======================================
Hits 2912 2912
Misses 2709 2709
Partials 440 440 ☔ View full report in Codecov by Sentry. |
Thanks for the fast fix 👍. This was causing a panic in our go-chi telemetry middleware and I could not turn off the cardinality metrics easily.
Do you know why the separator of the metrics name was changed from underscore to dot in the latest version v1.41.0 ? |
@@ -103,7 +103,7 @@ func newScopeRegistryWithShardCount( | |||
} | |||
r.subscopes[i].s[scopeRegistryKey(root.prefix, root.tags)] = root | |||
} | |||
if r.root.cachedReporter != nil { | |||
if r.root.cachedReporter != nil && !omitCardinalityMetrics { |
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.
pls add unit test for this
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.
done
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
scope_registry_test.go
Outdated
|
||
func TestCachedReporterNoAllocOnOmitInternalMetrics(t *testing.T) { | ||
r := newTestStatsReporter() | ||
root, closer := NewRootScope(ScopeOptions{CachedReporter: r, OmitCardinalityMetrics: true}, 0) |
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.
do you want to check that it gets allocated when OmitCardinalityMetrics
is false?
Changes: