@@ -38,6 +38,9 @@ import (
38
38
"github.com/cortexproject/cortex/pkg/util/chunkcompat"
39
39
"github.com/cortexproject/cortex/pkg/util/flagext"
40
40
"github.com/cortexproject/cortex/pkg/util/validation"
41
+
42
+ "github.com/prometheus/client_golang/prometheus"
43
+ promutil "github.com/prometheus/client_golang/prometheus/testutil"
41
44
)
42
45
43
46
const (
@@ -363,6 +366,28 @@ func TestQuerier(t *testing.T) {
363
366
}
364
367
}
365
368
369
+ func TestQuerierMetric (t * testing.T ) {
370
+ var cfg Config
371
+ flagext .DefaultValues (& cfg )
372
+ cfg .MaxConcurrent = 120
373
+
374
+ overrides , err := validation .NewOverrides (DefaultLimitsConfig (), nil )
375
+ require .NoError (t , err )
376
+
377
+ chunkStore , through := makeMockChunkStore (t , 24 , promchunk .PrometheusXorChunk )
378
+ distributor := mockDistibutorFor (t , chunkStore , through )
379
+
380
+ queryables := []QueryableWithFilter {}
381
+ r := prometheus .NewRegistry ()
382
+ reg := prometheus .WrapRegistererWith (prometheus.Labels {"engine" : "querier" }, r )
383
+ New (cfg , overrides , distributor , queryables , purger .NewNoopTombstonesLoader (), reg , log .NewNopLogger ())
384
+ assert .NoError (t , promutil .GatherAndCompare (r , strings .NewReader (`
385
+ # HELP cortex_max_concurrent_queries The maximum number of concurrent queries.
386
+ # TYPE cortex_max_concurrent_queries gauge
387
+ cortex_max_concurrent_queries{engine="querier"} 120
388
+ ` ), "cortex_max_concurrent_queries" ))
389
+ }
390
+
366
391
func mockTSDB (t * testing.T , labels []labels.Labels , mint model.Time , samples int , step , chunkOffset time.Duration , samplesPerChunk int ) (storage.Queryable , []cortexpb.Sample ) {
367
392
//parallel testing causes data race
368
393
opts := tsdb .DefaultHeadOptions ()
0 commit comments