Skip to content

Commit

Permalink
do not allocate gauge if cardinality metrics are turned off
Browse files Browse the repository at this point in the history
  • Loading branch information
brawndou committed Feb 9, 2024
1 parent 83f9861 commit 57ca96d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion scope_registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
r.cachedCounterCardinalityGauge = r.root.cachedReporter.AllocateGauge(r.sanitizedCounterCardinalityName, r.cardinalityMetricsTags)
r.cachedGaugeCardinalityGauge = r.root.cachedReporter.AllocateGauge(r.sanitizedGaugeCardinalityName, r.cardinalityMetricsTags)
r.cachedHistogramCardinalityGauge = r.root.cachedReporter.AllocateGauge(r.sanitizedHistogramCardinalityName, r.cardinalityMetricsTags)
Expand Down

0 comments on commit 57ca96d

Please sign in to comment.