diff --git a/pkg/pgmodel/ingestor/metric_batcher.go b/pkg/pgmodel/ingestor/metric_batcher.go index 29c98e9adc..ef203fa8c5 100644 --- a/pkg/pgmodel/ingestor/metric_batcher.go +++ b/pkg/pgmodel/ingestor/metric_batcher.go @@ -256,7 +256,7 @@ func sendBatches(firstReq *insertDataRequest, input chan *insertDataRequest, con numSeries := pending.batch.CountSeries() numSamples, numExemplars := pending.batch.Count() - + wasFull := pending.IsFull() select { //try to batch as much as possible before sending case req, ok := <-recvCh: @@ -277,7 +277,7 @@ func sendBatches(firstReq *insertDataRequest, input chan *insertDataRequest, con metrics.IngestorFlushSeries.With(prometheus.Labels{"type": "metric", "subsystem": "metric_batcher"}).Observe(float64(numSeries)) metrics.IngestorFlushInsertables.With(prometheus.Labels{"type": "metric", "subsystem": "metric_batcher"}).Observe(float64(numSamples + numExemplars)) metrics.IngestorBatchDuration.With(prometheus.Labels{"type": "metric", "subsystem": "metric_batcher"}).Observe(time.Since(pending.Start).Seconds()) - if pending.IsFull() { + if wasFull { metrics.IngestorBatchFlushTotal.With(prometheus.Labels{"type": "metric", "subsystem": "metric_batcher", "reason": "size"}).Inc() } else { metrics.IngestorBatchFlushTotal.With(prometheus.Labels{"type": "metric", "subsystem": "metric_batcher", "reason": "requested"}).Inc()