MCPcopy
hub / github.com/grafana/tempo / TestManagedRegistry_counter

Function TestManagedRegistry_counter

modules/generator/registry/registry_test.go:123–138  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

121}
122
123func TestManagedRegistry_counter(t *testing.T) {
124 appender := &capturingAppender{}
125
126 registry := New(&Config{}, &mockOverrides{}, "test", appender, log.NewNopLogger(), noopLimiter)
127 defer registry.Close()
128
129 counter := registry.NewCounter("my_counter")
130
131 counter.Inc(buildTestLabels([]string{"label", "label"}, []string{"repeated-value", "value-1"}), 1.0)
132
133 expectedSamples := []sample{
134 newSample(map[string]string{"__name__": "my_counter", "label": "value-1", "__metrics_gen_instance": mustGetHostname()}, 0, 0.0),
135 newSample(map[string]string{"__name__": "my_counter", "label": "value-1", "__metrics_gen_instance": mustGetHostname()}, 0, 1.0),
136 }
137 collectRegistryMetricsAndAssert(t, registry, appender, expectedSamples)
138}
139
140func TestManagedRegistry_histogram(t *testing.T) {
141 appender := &capturingAppender{}

Callers

nothing calls this directly

Calls 8

IncMethod · 0.95
buildTestLabelsFunction · 0.85
newSampleFunction · 0.85
mustGetHostnameFunction · 0.85
NewFunction · 0.70
CloseMethod · 0.65
NewCounterMethod · 0.65

Tested by

no test coverage detected