From 2c36b75b66b0c939ddb14a2d693da2ea76dc4fbd Mon Sep 17 00:00:00 2001 From: Matvey Arye Date: Tue, 13 Dec 2022 15:41:32 -0500 Subject: [PATCH] bug fix --- pkg/pgmodel/ingestor/metric_batcher.go | 4 ++-- pkg/pgmodel/ingestor/reservation.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) 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 }