From a52c2b9b6666e567b56b4cc5342e0abd7b57efaf Mon Sep 17 00:00:00 2001 From: Joe Elliott Date: Fri, 11 Oct 2019 10:17:01 -0400 Subject: [PATCH 1/3] Updated compression ratio histogram to better cover the actual range Signed-off-by: Joe Elliott --- pkg/ingester/flush.go | 2 +- pkg/ingester/flush_test.go | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/pkg/ingester/flush.go b/pkg/ingester/flush.go index 29f45a9a2813..4abf1dc0c53a 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", diff --git a/pkg/ingester/flush_test.go b/pkg/ingester/flush_test.go index b379f24729f4..b483c5326df6 100644 --- a/pkg/ingester/flush_test.go +++ b/pkg/ingester/flush_test.go @@ -35,6 +35,12 @@ func init() { //util.Logger = log.NewLogfmtLogger(os.Stdout) } +func Test(t *testing.T) { + blerg := 132 / 0 + + fmt.Println(blerg) +} + func TestChunkFlushingIdle(t *testing.T) { cfg := defaultIngesterTestConfig(t) cfg.FlushCheckPeriod = 20 * time.Millisecond From c9f01284dfcbf6fcd57f0f33150a6d03b3f1357b Mon Sep 17 00:00:00 2001 From: Joe Elliott Date: Fri, 11 Oct 2019 10:18:31 -0400 Subject: [PATCH 2/3] Guard against divide by 0 Signed-off-by: Joe Elliott --- pkg/ingester/flush.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/ingester/flush.go b/pkg/ingester/flush.go index 4abf1dc0c53a..370c86ec4dcf 100644 --- a/pkg/ingester/flush.go +++ b/pkg/ingester/flush.go @@ -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) } From ff7aa1eb55f00c9793dcc298ca86a4d08562392e Mon Sep 17 00:00:00 2001 From: Joe Elliott Date: Fri, 11 Oct 2019 10:21:56 -0400 Subject: [PATCH 3/3] Removed temp test Signed-off-by: Joe Elliott --- pkg/ingester/flush_test.go | 6 ------ 1 file changed, 6 deletions(-) diff --git a/pkg/ingester/flush_test.go b/pkg/ingester/flush_test.go index b483c5326df6..b379f24729f4 100644 --- a/pkg/ingester/flush_test.go +++ b/pkg/ingester/flush_test.go @@ -35,12 +35,6 @@ func init() { //util.Logger = log.NewLogfmtLogger(os.Stdout) } -func Test(t *testing.T) { - blerg := 132 / 0 - - fmt.Println(blerg) -} - func TestChunkFlushingIdle(t *testing.T) { cfg := defaultIngesterTestConfig(t) cfg.FlushCheckPeriod = 20 * time.Millisecond