From 0f7f200c032314eae328d43d8d1a4689333aa2dc Mon Sep 17 00:00:00 2001 From: Joe Elliott Date: Fri, 11 Oct 2019 11:14:19 -0400 Subject: [PATCH] Improved compression ratio histogram (#1143) * Updated compression ratio histogram to better cover the actual range Signed-off-by: Joe Elliott * Guard against divide by 0 Signed-off-by: Joe Elliott * Removed temp test Signed-off-by: Joe Elliott --- pkg/ingester/flush.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/ingester/flush.go b/pkg/ingester/flush.go index 29f45a9a28..370c86ec4d 100644 --- a/pkg/ingester/flush.go +++ b/pkg/ingester/flush.go @@ -44,7 +44,7 @@ var ( chunkCompressionRatio = promauto.NewHistogram(prometheus.HistogramOpts{ Name: "loki_ingester_chunk_compression_ratio", Help: "Compression ratio of chunks (when stored).", - Buckets: prometheus.LinearBuckets(1, 1.5, 6), + Buckets: prometheus.LinearBuckets(.75, 2, 10), }) chunksPerTenant = promauto.NewCounterVec(prometheus.CounterOpts{ Name: "loki_ingester_chunks_stored_total", @@ -312,7 +312,7 @@ func (i *Ingester) flushChunks(ctx context.Context, fp model.Fingerprint, labelP compressedSize := float64(len(byt)) uncompressedSize, ok := chunkenc.UncompressedSize(wc.Data) - if ok { + if ok && compressedSize > 0 { chunkCompressionRatio.Observe(float64(uncompressedSize) / compressedSize) }