Repository navigation
tsdb: add histograms-st-encoding feature flag - #18912
Merged
Merged
Conversation
Decouple the ST-capable histogram chunk encodings (EncHistogramST, EncFloatHistogramST) from the xor2-encoding feature flag and gate them behind a new histograms-st-encoding flag instead. Previously --enable-feature=xor2-encoding turned on both the float XOR2 encoding and the histogram ST encodings via a single useXOR2 boolean; that conflated two independent on-disk formats and made it impossible to opt into one without the other. ValueType.ChunkEncoding and NewChunk now take separate useXOR2 and useHistogramST flags. Dispatch only consumes the relevant flag per value type; data-driven callers that gate on actual ST presence in the samples (storage/series.go, tsdb/querier.go, tsdb/chunks/chunks.go) pass hasST for both. tsdb.Options gains EnableHistogramSTEncoding; tsdb.HeadOptions gains a matching atomic.Bool. The new flag is propagated through chunkOpts/headAppenderBase and read at every site that currently reads EnableXOR2Encoding (head append v1/v2, head_wal WAL/WBL replay, ooo_head_read). Signed-off-by: György Krajcsovits <[email protected]>
krajorama
requested review from
a team,
bwplotka,
codesome,
jesusvazquez and
roidelapluie
as code owners
June 12, 2026 10:57
Signed-off-by: György Krajcsovits <[email protected]>
bwplotka
approved these changes
Jun 16, 2026
bwplotka
left a comment
Member
There was a problem hiding this comment.
Thanks, I think this give us consistency with the current flow.
ywwg
approved these changes
Jun 16, 2026
carrieedwards
pushed a commit
that referenced
this pull request
Jun 17, 2026
* tsdb: add histograms-st-encoding feature flag Decouple the ST-capable histogram chunk encodings (EncHistogramST, EncFloatHistogramST) from the xor2-encoding feature flag and gate them behind a new histograms-st-encoding flag instead. Previously --enable-feature=xor2-encoding turned on both the float XOR2 encoding and the histogram ST encodings via a single useXOR2 boolean; that conflated two independent on-disk formats and made it impossible to opt into one without the other. ValueType.ChunkEncoding and NewChunk now take separate useXOR2 and useHistogramST flags. Dispatch only consumes the relevant flag per value type; data-driven callers that gate on actual ST presence in the samples (storage/series.go, tsdb/querier.go, tsdb/chunks/chunks.go) pass hasST for both. tsdb.Options gains EnableHistogramSTEncoding; tsdb.HeadOptions gains a matching atomic.Bool. The new flag is propagated through chunkOpts/headAppenderBase and read at every site that currently reads EnableXOR2Encoding (head append v1/v2, head_wal WAL/WBL replay, ooo_head_read). Signed-off-by: György Krajcsovits <[email protected]> * update features testdata Signed-off-by: György Krajcsovits <[email protected]> --------- Signed-off-by: György Krajcsovits <[email protected]>
krajorama
added a commit
that referenced
this pull request
Jun 25, 2026
* tsdb: add histograms-st-encoding feature flag Decouple the ST-capable histogram chunk encodings (EncHistogramST, EncFloatHistogramST) from the xor2-encoding feature flag and gate them behind a new histograms-st-encoding flag instead. Previously --enable-feature=xor2-encoding turned on both the float XOR2 encoding and the histogram ST encodings via a single useXOR2 boolean; that conflated two independent on-disk formats and made it impossible to opt into one without the other. ValueType.ChunkEncoding and NewChunk now take separate useXOR2 and useHistogramST flags. Dispatch only consumes the relevant flag per value type; data-driven callers that gate on actual ST presence in the samples (storage/series.go, tsdb/querier.go, tsdb/chunks/chunks.go) pass hasST for both. tsdb.Options gains EnableHistogramSTEncoding; tsdb.HeadOptions gains a matching atomic.Bool. The new flag is propagated through chunkOpts/headAppenderBase and read at every site that currently reads EnableXOR2Encoding (head append v1/v2, head_wal WAL/WBL replay, ooo_head_read). Signed-off-by: György Krajcsovits <[email protected]>
carrieedwards
pushed a commit
that referenced
this pull request
Jun 29, 2026
* tsdb: add histograms-st-encoding feature flag Decouple the ST-capable histogram chunk encodings (EncHistogramST, EncFloatHistogramST) from the xor2-encoding feature flag and gate them behind a new histograms-st-encoding flag instead. Previously --enable-feature=xor2-encoding turned on both the float XOR2 encoding and the histogram ST encodings via a single useXOR2 boolean; that conflated two independent on-disk formats and made it impossible to opt into one without the other. ValueType.ChunkEncoding and NewChunk now take separate useXOR2 and useHistogramST flags. Dispatch only consumes the relevant flag per value type; data-driven callers that gate on actual ST presence in the samples (storage/series.go, tsdb/querier.go, tsdb/chunks/chunks.go) pass hasST for both. tsdb.Options gains EnableHistogramSTEncoding; tsdb.HeadOptions gains a matching atomic.Bool. The new flag is propagated through chunkOpts/headAppenderBase and read at every site that currently reads EnableXOR2Encoding (head append v1/v2, head_wal WAL/WBL replay, ooo_head_read). Signed-off-by: György Krajcsovits <[email protected]>
carrieedwards
pushed a commit
that referenced
this pull request
Jun 29, 2026
* tsdb: add histograms-st-encoding feature flag Decouple the ST-capable histogram chunk encodings (EncHistogramST, EncFloatHistogramST) from the xor2-encoding feature flag and gate them behind a new histograms-st-encoding flag instead. Previously --enable-feature=xor2-encoding turned on both the float XOR2 encoding and the histogram ST encodings via a single useXOR2 boolean; that conflated two independent on-disk formats and made it impossible to opt into one without the other. ValueType.ChunkEncoding and NewChunk now take separate useXOR2 and useHistogramST flags. Dispatch only consumes the relevant flag per value type; data-driven callers that gate on actual ST presence in the samples (storage/series.go, tsdb/querier.go, tsdb/chunks/chunks.go) pass hasST for both. tsdb.Options gains EnableHistogramSTEncoding; tsdb.HeadOptions gains a matching atomic.Bool. The new flag is propagated through chunkOpts/headAppenderBase and read at every site that currently reads EnableXOR2Encoding (head append v1/v2, head_wal WAL/WBL replay, ooo_head_read). Signed-off-by: György Krajcsovits <[email protected]> Signed-off-by: George Krajcsovits <[email protected]>
carrieedwards
pushed a commit
that referenced
this pull request
Jun 29, 2026
* tsdb: add histograms-st-encoding feature flag Decouple the ST-capable histogram chunk encodings (EncHistogramST, EncFloatHistogramST) from the xor2-encoding feature flag and gate them behind a new histograms-st-encoding flag instead. Previously --enable-feature=xor2-encoding turned on both the float XOR2 encoding and the histogram ST encodings via a single useXOR2 boolean; that conflated two independent on-disk formats and made it impossible to opt into one without the other. ValueType.ChunkEncoding and NewChunk now take separate useXOR2 and useHistogramST flags. Dispatch only consumes the relevant flag per value type; data-driven callers that gate on actual ST presence in the samples (storage/series.go, tsdb/querier.go, tsdb/chunks/chunks.go) pass hasST for both. tsdb.Options gains EnableHistogramSTEncoding; tsdb.HeadOptions gains a matching atomic.Bool. The new flag is propagated through chunkOpts/headAppenderBase and read at every site that currently reads EnableXOR2Encoding (head append v1/v2, head_wal WAL/WBL replay, ooo_head_read). Signed-off-by: György Krajcsovits <[email protected]> Signed-off-by: George Krajcsovits <[email protected]>
carrieedwards
pushed a commit
that referenced
this pull request
Jun 30, 2026
* tsdb: add histograms-st-encoding feature flag Decouple the ST-capable histogram chunk encodings (EncHistogramST, EncFloatHistogramST) from the xor2-encoding feature flag and gate them behind a new histograms-st-encoding flag instead. Previously --enable-feature=xor2-encoding turned on both the float XOR2 encoding and the histogram ST encodings via a single useXOR2 boolean; that conflated two independent on-disk formats and made it impossible to opt into one without the other. ValueType.ChunkEncoding and NewChunk now take separate useXOR2 and useHistogramST flags. Dispatch only consumes the relevant flag per value type; data-driven callers that gate on actual ST presence in the samples (storage/series.go, tsdb/querier.go, tsdb/chunks/chunks.go) pass hasST for both. tsdb.Options gains EnableHistogramSTEncoding; tsdb.HeadOptions gains a matching atomic.Bool. The new flag is propagated through chunkOpts/headAppenderBase and read at every site that currently reads EnableXOR2Encoding (head append v1/v2, head_wal WAL/WBL replay, ooo_head_read). Signed-off-by: György Krajcsovits <[email protected]> Signed-off-by: George Krajcsovits <[email protected]>
carrieedwards
added a commit
that referenced
this pull request
Jun 30, 2026
* Add histogram chunk encoding with Start Timestamp support Signed-off-by: Carrie Edwards <[email protected]> * Update documentation Signed-off-by: Carrie Edwards <[email protected]> * Add more tests Signed-off-by: Carrie Edwards <[email protected]> * Fix for appendHistogram Signed-off-by: Carrie Edwards <[email protected]> * Linting Signed-off-by: Carrie Edwards <[email protected]> * Fix start timestamp for histogram samples in TestCompactingChunkSeriesMerger Signed-off-by: Carrie Edwards <[email protected]> * Refactor and reduce code duplication Signed-off-by: Carrie Edwards <[email protected]> * Move counter reset hint bits into sample count field Signed-off-by: Carrie Edwards <[email protected]> * Fix bug with counter reset header Signed-off-by: Carrie Edwards <[email protected]> * Clean up docs Signed-off-by: Carrie Edwards <[email protected]> * Address feedback Signed-off-by: Carrie Edwards <[email protected]> * Lint Signed-off-by: Carrie Edwards <[email protected]> * Refactor to use generic appenders Signed-off-by: Carrie Edwards <[email protected]> * Update to include changes to histogram appenders Signed-off-by: Carrie Edwards <[email protected]> * Address feedback Signed-off-by: Carrie Edwards <[email protected]> * tsdb: add histograms-st-encoding feature flag (#18912) * tsdb: add histograms-st-encoding feature flag Decouple the ST-capable histogram chunk encodings (EncHistogramST, EncFloatHistogramST) from the xor2-encoding feature flag and gate them behind a new histograms-st-encoding flag instead. Previously --enable-feature=xor2-encoding turned on both the float XOR2 encoding and the histogram ST encodings via a single useXOR2 boolean; that conflated two independent on-disk formats and made it impossible to opt into one without the other. ValueType.ChunkEncoding and NewChunk now take separate useXOR2 and useHistogramST flags. Dispatch only consumes the relevant flag per value type; data-driven callers that gate on actual ST presence in the samples (storage/series.go, tsdb/querier.go, tsdb/chunks/chunks.go) pass hasST for both. tsdb.Options gains EnableHistogramSTEncoding; tsdb.HeadOptions gains a matching atomic.Bool. The new flag is propagated through chunkOpts/headAppenderBase and read at every site that currently reads EnableXOR2Encoding (head append v1/v2, head_wal WAL/WBL replay, ooo_head_read). Signed-off-by: György Krajcsovits <[email protected]> Signed-off-by: George Krajcsovits <[email protected]> * Address feedback Signed-off-by: Carrie Edwards <[email protected]> * Fix histogram tests Signed-off-by: Carrie Edwards <[email protected]> * Fix histogram ST PromQL tests Signed-off-by: Carrie Edwards <[email protected]> * Fixes for promQL tests Signed-off-by: Carrie Edwards <[email protected]> --------- Signed-off-by: Carrie Edwards <[email protected]> Signed-off-by: György Krajcsovits <[email protected]> Signed-off-by: George Krajcsovits <[email protected]> Co-authored-by: George Krajcsovits <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on top of #18609.
Decouple the ST-capable histogram chunk encodings (
EncHistogramST,EncFloatHistogramST) from thexor2-encodingfeature flag and gate them behind a newhistograms-st-encodingflag instead. Previously--enable-feature=xor2-encodingturned on both the float XOR2 encoding and the histogram ST encodings via a singleuseXOR2boolean; that conflated two independent on-disk formats and made it impossible to opt into one without the other.Changes
chunkenc.ValueType.ChunkEncodingandNewChunknow take separateuseXOR2anduseHistogramSTflags. Dispatch only consumes the relevant flag per value type; data-driven callers that gate on actual ST presence in the samples (storage/series.go,tsdb/querier.go,tsdb/chunks/chunks.go) passhasSTfor both.tsdb.OptionsgainsEnableHistogramSTEncoding;tsdb.HeadOptionsgains a matchingatomic.Bool.chunkOpts/headAppenderBaseand read at every site that currently readsEnableXOR2Encoding(head append v1/v2, head_wal WAL/WBL replay, ooo_head_read).--enable-feature=histograms-st-encodingand matching docs section indocs/feature_flags.md.EnableXOR2Encodingfor histogram ST behaviour also flipEnableHistogramSTEncoding, preserving pre-split semantics.The two flags are fully independent: either can be enabled without the other.
Test plan
go test ./tsdb/... ./storage/... ./scrape/ ./promql/promqltest/ ./cmd/prometheus/make lint(only pre-existing findings in vendoredweb/ui/node_modules/flatted/remain)