Skip to content

Commit cc3694e

Browse files
feat: Add ingester_chunks_flush_failures_total (#12925)
Signed-off-by: George Robinson <[email protected]>
1 parent d0a2859 commit cc3694e

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

pkg/ingester/flush.go

+1
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,7 @@ func (i *Ingester) encodeChunk(ctx context.Context, ch *chunk.Chunk, desc *chunk
372372
// chunk to have another opportunity to be flushed.
373373
func (i *Ingester) flushChunk(ctx context.Context, ch *chunk.Chunk) error {
374374
if err := i.store.Put(ctx, []chunk.Chunk{*ch}); err != nil {
375+
i.metrics.chunksFlushFailures.Inc()
375376
return fmt.Errorf("store put chunk: %w", err)
376377
}
377378
i.metrics.flushedChunksStats.Inc(1)

pkg/ingester/metrics.go

+6
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ type ingesterMetrics struct {
4747
chunkSizePerTenant *prometheus.CounterVec
4848
chunkAge prometheus.Histogram
4949
chunkEncodeTime prometheus.Histogram
50+
chunksFlushFailures prometheus.Counter
5051
chunksFlushedPerReason *prometheus.CounterVec
5152
chunkLifespan prometheus.Histogram
5253
flushedChunksStats *analytics.Counter
@@ -232,6 +233,11 @@ func newIngesterMetrics(r prometheus.Registerer, metricsNamespace string) *inges
232233
// 10ms to 10s.
233234
Buckets: prometheus.ExponentialBuckets(0.01, 4, 6),
234235
}),
236+
chunksFlushFailures: promauto.With(r).NewCounter(prometheus.CounterOpts{
237+
Namespace: constants.Loki,
238+
Name: "ingester_chunks_flush_failures_total",
239+
Help: "Total number of flush failures.",
240+
}),
235241
chunksFlushedPerReason: promauto.With(r).NewCounterVec(prometheus.CounterOpts{
236242
Namespace: constants.Loki,
237243
Name: "ingester_chunks_flushed_total",

0 commit comments

Comments
 (0)