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

Function Test_gauge_externalLabels

modules/generator/registry/gauge_test.go:200–212  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

198}
199
200func Test_gauge_externalLabels(t *testing.T) {
201 c := newGauge("my_gauge", noopLimiter, map[string]string{"external_label": "external_value"}, 15*time.Minute)
202
203 c.Inc(buildTestLabels([]string{"label"}, []string{"value-1"}), 1.0)
204 c.Inc(buildTestLabels([]string{"label"}, []string{"value-2"}), 2.0)
205
206 collectionTimeMs := time.Now().UnixMilli()
207 expectedSamples := []sample{
208 newSample(map[string]string{"__name__": "my_gauge", "label": "value-1", "external_label": "external_value"}, collectionTimeMs, 1),
209 newSample(map[string]string{"__name__": "my_gauge", "label": "value-2", "external_label": "external_value"}, collectionTimeMs, 2),
210 }
211 collectMetricAndAssert(t, c, collectionTimeMs, 2, expectedSamples, nil)
212}
213
214func Test_gauge_concurrencyDataRace(t *testing.T) {
215 c := newGauge("my_gauge", noopLimiter, map[string]string{}, 15*time.Minute)

Callers

nothing calls this directly

Calls 6

newGaugeFunction · 0.85
buildTestLabelsFunction · 0.85
newSampleFunction · 0.85
collectMetricAndAssertFunction · 0.85
IncMethod · 0.65
NowMethod · 0.65

Tested by

no test coverage detected