From f8da60d20357a5c60b5eb314759a7b61417ce018 Mon Sep 17 00:00:00 2001 From: Rahul Tejwani Date: Mon, 8 Jul 2024 11:01:06 -0400 Subject: [PATCH] Removing dots from the internal cardinality metric names. '.' is used as a default delimitter for the scope. --- scope_registry.go | 8 ++++---- scope_registry_test.go | 14 ++++++++++++++ 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/scope_registry.go b/scope_registry.go index 1692829..20b6594 100644 --- a/scope_registry.go +++ b/scope_registry.go @@ -31,10 +31,10 @@ var ( scopeRegistryKey = keyForPrefixedStringMaps // Metrics related. - counterCardinalityName = "tally.internal.counter_cardinality" - gaugeCardinalityName = "tally.internal.gauge_cardinality" - histogramCardinalityName = "tally.internal.histogram_cardinality" - scopeCardinalityName = "tally.internal.num_active_scopes" + counterCardinalityName = "tally_internal_counter_cardinality" + gaugeCardinalityName = "tally_internal_gauge_cardinality" + histogramCardinalityName = "tally_internal_histogram_cardinality" + scopeCardinalityName = "tally_internal_num_active_scopes" ) const ( diff --git a/scope_registry_test.go b/scope_registry_test.go index 6647fa3..6ec81f4 100644 --- a/scope_registry_test.go +++ b/scope_registry_test.go @@ -76,11 +76,25 @@ func TestVerifyOmitCardinalityMetricsTags(t *testing.T) { closer.Close() r.WaitAll() + assert.NotNil(t, r.gauges[gaugeCardinalityName], "gauge cardinality should not be nil") + assert.NotNil(t, r.gauges[histogramCardinalityName], "histogram cardinality should not be nil") assert.NotNil(t, r.gauges[counterCardinalityName], "counter cardinality should not be nil") + assert.NotNil(t, r.gauges[scopeCardinalityName], "scope cardinality should not be nil") + assert.Equal( t, wantOmitCardinalityMetricsTags, r.gauges[counterCardinalityName].tags, "expected tags %v, got tags %v", wantOmitCardinalityMetricsTags, r.gauges[counterCardinalityName].tags, ) + assert.Equal(t, wantOmitCardinalityMetricsTags, r.gauges[gaugeCardinalityName].tags, "expected tags %v, got tags %v", + wantOmitCardinalityMetricsTags, r.gauges[gaugeCardinalityName].tags, + ) + assert.Equal(t, wantOmitCardinalityMetricsTags, r.gauges[histogramCardinalityName].tags, "expected tags %v, got tags %v", + wantOmitCardinalityMetricsTags, r.gauges[histogramCardinalityName].tags, + ) + assert.Equal(t, wantOmitCardinalityMetricsTags, r.gauges[scopeCardinalityName].tags, "expected tags %v, got tags %v", + wantOmitCardinalityMetricsTags, r.gauges[scopeCardinalityName].tags, + ) + } func TestNewTestStatsReporterOneScope(t *testing.T) {