From 23f1d3ba259af70333fc24e3e4b085e2c96ee448 Mon Sep 17 00:00:00 2001 From: beorn7 Date: Wed, 27 Aug 2025 17:01:23 +0200 Subject: [PATCH] tsdb: Remove unused `Layout()` methods Both `HistogramChunk` and `FloatHistogramChunk` have a `Layout()` method for historical reasons. As it has turned out, these methods are unused and also buggy. This commit simply removes them. Signed-off-by: beorn7 --- tsdb/chunkenc/float_histogram.go | 15 --------------- tsdb/chunkenc/histogram.go | 15 --------------- 2 files changed, 30 deletions(-) diff --git a/tsdb/chunkenc/float_histogram.go b/tsdb/chunkenc/float_histogram.go index 564b312db5..05f5d5e252 100644 --- a/tsdb/chunkenc/float_histogram.go +++ b/tsdb/chunkenc/float_histogram.go @@ -72,21 +72,6 @@ func (c *FloatHistogramChunk) NumSamples() int { return int(binary.BigEndian.Uint16(c.Bytes())) } -// Layout returns the histogram layout. Only call this on chunks that have at -// least one sample. -func (c *FloatHistogramChunk) Layout() ( - schema int32, zeroThreshold float64, - negativeSpans, positiveSpans []histogram.Span, - customValues []float64, - err error, -) { - if c.NumSamples() == 0 { - panic("FloatHistogramChunk.Layout() called on an empty chunk") - } - b := newBReader(c.Bytes()[2:]) - return readHistogramChunkLayout(&b) -} - // GetCounterResetHeader returns the info about the first 2 bits of the chunk // header. func (c *FloatHistogramChunk) GetCounterResetHeader() CounterResetHeader { diff --git a/tsdb/chunkenc/histogram.go b/tsdb/chunkenc/histogram.go index 6039fef0e0..1b511c1f7b 100644 --- a/tsdb/chunkenc/histogram.go +++ b/tsdb/chunkenc/histogram.go @@ -65,21 +65,6 @@ func (c *HistogramChunk) NumSamples() int { return int(binary.BigEndian.Uint16(c.Bytes())) } -// Layout returns the histogram layout. Only call this on chunks that have at -// least one sample. -func (c *HistogramChunk) Layout() ( - schema int32, zeroThreshold float64, - negativeSpans, positiveSpans []histogram.Span, - customValues []float64, - err error, -) { - if c.NumSamples() == 0 { - panic("HistogramChunk.Layout() called on an empty chunk") - } - b := newBReader(c.Bytes()[2:]) - return readHistogramChunkLayout(&b) -} - // CounterResetHeader defines the first 2 bits of the chunk header. type CounterResetHeader byte