(t *testing.T)
| 294 | } |
| 295 | |
| 296 | func Test_gauge_demandTracking(t *testing.T) { |
| 297 | g := newGauge("my_gauge", noopLimiter, map[string]string{}, 15*time.Minute) |
| 298 | |
| 299 | // Initially, demand should be 0 |
| 300 | assert.Equal(t, 0, g.countSeriesDemand()) |
| 301 | |
| 302 | // Add some series |
| 303 | for i := 0; i < 50; i++ { |
| 304 | lbls := buildTestLabels([]string{"label"}, []string{fmt.Sprintf("value-%d", i)}) |
| 305 | g.Inc(lbls, 1.0) |
| 306 | } |
| 307 | |
| 308 | // Demand should now be approximately 50 (within HLL error) |
| 309 | demand := g.countSeriesDemand() |
| 310 | assert.Greater(t, demand, 40, "demand should be close to 50") |
| 311 | assert.Less(t, demand, 60, "demand should be close to 50") |
| 312 | |
| 313 | // Active series should exactly match |
| 314 | assert.Equal(t, 50, g.countActiveSeries()) |
| 315 | } |
| 316 | |
| 317 | func Test_gauge_demandVsActiveSeries(t *testing.T) { |
| 318 | limitReached := false |
nothing calls this directly
no test coverage detected