@@ -68,7 +68,7 @@ func getBlockStoreType(ctx context.Context, defaultBlockStoreType blockStoreType
68
68
69
69
type parquetQueryableFallbackMetrics struct {
70
70
blocksQueriedTotal * prometheus.CounterVec
71
- selectCount * prometheus.CounterVec
71
+ operationsTotal * prometheus.CounterVec
72
72
}
73
73
74
74
func newParquetQueryableFallbackMetrics (reg prometheus.Registerer ) * parquetQueryableFallbackMetrics {
@@ -77,10 +77,10 @@ func newParquetQueryableFallbackMetrics(reg prometheus.Registerer) *parquetQuery
77
77
Name : "cortex_parquet_queryable_blocks_queried_total" ,
78
78
Help : "Total number of blocks found to query." ,
79
79
}, []string {"type" }),
80
- selectCount : promauto .With (reg ).NewCounterVec (prometheus.CounterOpts {
81
- Name : "cortex_parquet_queryable_selects_queried_total " ,
82
- Help : "Total number of selects ." ,
83
- }, []string {"type" }),
80
+ operationsTotal : promauto .With (reg ).NewCounterVec (prometheus.CounterOpts {
81
+ Name : "cortex_parquet_queryable_operation_total " ,
82
+ Help : "Total number of Operations ." ,
83
+ }, []string {"type" , "method" }),
84
84
}
85
85
}
86
86
@@ -267,6 +267,7 @@ type parquetQuerierWithFallback struct {
267
267
268
268
func (q * parquetQuerierWithFallback ) LabelValues (ctx context.Context , name string , hints * storage.LabelHints , matchers ... * labels.Matcher ) ([]string , annotations.Annotations , error ) {
269
269
remaining , parquet , err := q .getBlocks (ctx , q .minT , q .maxT )
270
+ defer q .incrementOpsMetric ("LabelValues" , remaining , parquet )
270
271
if err != nil {
271
272
return nil , nil , err
272
273
}
@@ -312,6 +313,7 @@ func (q *parquetQuerierWithFallback) LabelValues(ctx context.Context, name strin
312
313
313
314
func (q * parquetQuerierWithFallback ) LabelNames (ctx context.Context , hints * storage.LabelHints , matchers ... * labels.Matcher ) ([]string , annotations.Annotations , error ) {
314
315
remaining , parquet , err := q .getBlocks (ctx , q .minT , q .maxT )
316
+ defer q .incrementOpsMetric ("LabelNames" , remaining , parquet )
315
317
if err != nil {
316
318
return nil , nil , err
317
319
}
@@ -389,6 +391,8 @@ func (q *parquetQuerierWithFallback) Select(ctx context.Context, sortSeries bool
389
391
}
390
392
391
393
remaining , parquet , err := q .getBlocks (ctx , mint , maxt )
394
+ defer q .incrementOpsMetric ("Select" , remaining , parquet )
395
+
392
396
if err != nil {
393
397
return storage .ErrSeriesSet (err )
394
398
}
@@ -477,17 +481,18 @@ func (q *parquetQuerierWithFallback) getBlocks(ctx context.Context, minT, maxT i
477
481
478
482
q .metrics .blocksQueriedTotal .WithLabelValues ("parquet" ).Add (float64 (len (parquetBlocks )))
479
483
q .metrics .blocksQueriedTotal .WithLabelValues ("tsdb" ).Add (float64 (len (remaining )))
484
+ return remaining , parquetBlocks , nil
485
+ }
480
486
487
+ func (q * parquetQuerierWithFallback ) incrementOpsMetric (method string , remaining []* bucketindex.Block , parquetBlocks []* bucketindex.Block ) {
481
488
switch {
482
489
case len (remaining ) > 0 && len (parquetBlocks ) > 0 :
483
- q .metrics .selectCount .WithLabelValues ("mixed" ).Inc ()
490
+ q .metrics .operationsTotal .WithLabelValues ("mixed" , method ).Inc ()
484
491
case len (remaining ) > 0 && len (parquetBlocks ) == 0 :
485
- q .metrics .selectCount .WithLabelValues ("tsdb" ).Inc ()
492
+ q .metrics .operationsTotal .WithLabelValues ("tsdb" , method ).Inc ()
486
493
case len (remaining ) == 0 && len (parquetBlocks ) > 0 :
487
- q .metrics .selectCount .WithLabelValues ("parquet" ).Inc ()
494
+ q .metrics .operationsTotal .WithLabelValues ("parquet" , method ).Inc ()
488
495
}
489
-
490
- return remaining , parquetBlocks , nil
491
496
}
492
497
493
498
type cacheInterface [T any ] interface {
0 commit comments