feat: Add ingester_chunks_flush_requests_total (#18696)

pull/18818/head^2
Joao Marcal 10 months ago committed by GitHub
parent 3d634066ee
commit ab0c7b2b9d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 1
      pkg/ingester/flush.go
  2. 6
      pkg/ingester/metrics.go

@ -508,6 +508,7 @@ func (i *Ingester) encodeChunk(ctx context.Context, ch *chunk.Chunk, desc *chunk
// If the flush isn't successful, the operation for this userID is requeued allowing this and all other unflushed
// chunk to have another opportunity to be flushed.
func (i *Ingester) flushChunk(ctx context.Context, ch *chunk.Chunk) error {
i.metrics.chunksFlushRequestsTotal.Inc()
if err := i.store.Put(ctx, []chunk.Chunk{*ch}); err != nil {
i.metrics.chunksFlushFailures.Inc()
return fmt.Errorf("store put chunk: %w", err)

@ -48,6 +48,7 @@ type ingesterMetrics struct {
chunkAge prometheus.Histogram
chunkEncodeTime prometheus.Histogram
chunksFlushFailures prometheus.Counter
chunksFlushRequestsTotal prometheus.Counter
chunksFlushedPerReason *prometheus.CounterVec
chunkLifespan prometheus.Histogram
chunksEncoded *prometheus.CounterVec
@ -242,6 +243,11 @@ func newIngesterMetrics(r prometheus.Registerer, metricsNamespace string) *inges
Name: "ingester_chunks_flush_failures_total",
Help: "Total number of flush failures.",
}),
chunksFlushRequestsTotal: promauto.With(r).NewCounter(prometheus.CounterOpts{
Namespace: constants.Loki,
Name: "ingester_chunks_flush_requests_total",
Help: "Total number of flush requests (successful or not).",
}),
chunksFlushedPerReason: promauto.With(r).NewCounterVec(prometheus.CounterOpts{
Namespace: constants.Loki,
Name: "ingester_chunks_flushed_total",

Loading…
Cancel
Save