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() diff --git a/pkg/pgmodel/ingestor/reservation.go b/pkg/pgmodel/ingestor/reservation.go index 5d1f769037..7b87e4fbca 100644 --- a/pkg/pgmodel/ingestor/reservation.go +++ b/pkg/pgmodel/ingestor/reservation.go @@ -165,7 +165,7 @@ func (rq *ReservationQueue) Peek() (time.Time, bool) { case <-waitch: case <-time.After(250 * time.Millisecond): } - log.TraceRequest("component", "reservation", "event", "peek", "batched_metrics", rq.q.Len(), "waited", waited, "took", time.Since((*rq.q)[0].GetStartTime())) + log.TraceRequest("component", "reservation", "event", "peek", "batched_metrics", rq.Len(), "waited", waited, "took", time.Since(reservation.GetStartTime())) } return reservation.GetStartTime(), ok }