@ -16,7 +16,8 @@ type Stats struct {
MetasFetchTime , BlocksFetchTime * atomic . Duration
ProcessingTime , TotalProcessingTime * atomic . Duration
PostProcessingTime * atomic . Duration
ProcessedBlocks * atomic . Int32
ProcessedBlocks * atomic . Int32 // blocks processed for this specific request
ProcessedBlocksTotal * atomic . Int32 // blocks processed for multiplexed request
}
type statsKey int
@ -28,6 +29,7 @@ func ContextWithEmptyStats(ctx context.Context) (*Stats, context.Context) {
stats := & Stats {
Status : "unknown" ,
ProcessedBlocks : atomic . NewInt32 ( 0 ) ,
ProcessedBlocksTotal : atomic . NewInt32 ( 0 ) ,
QueueTime : atomic . NewDuration ( 0 ) ,
MetasFetchTime : atomic . NewDuration ( 0 ) ,
BlocksFetchTime : atomic . NewDuration ( 0 ) ,
@ -72,6 +74,7 @@ func (s *Stats) KVArgs() []any {
"tasks" , s . NumTasks ,
"matchers" , s . NumMatchers ,
"blocks_processed" , s . ProcessedBlocks . Load ( ) ,
"blocks_processed_total" , s . ProcessedBlocksTotal . Load ( ) ,
"series_requested" , s . SeriesRequested ,
"series_filtered" , s . SeriesFiltered ,
"chunks_requested" , s . ChunksRequested ,
@ -135,3 +138,10 @@ func (s *Stats) IncProcessedBlocks() {
}
s . ProcessedBlocks . Inc ( )
}
func ( s * Stats ) AddProcessedBlocksTotal ( delta int ) {
if s == nil {
return
}
s . ProcessedBlocksTotal . Add ( int32 ( delta ) )
}