Repository navigation
tsdb: plumb st for histograms through wal/wbl - #18804
Merged
Merged
Conversation
Histogram and float-histogram samples now carry their start timestamp from the AppenderV2.Append entry point all the way into the in-memory series, matching what counters already do. Previously the v2 head built RefHistogramSample / RefFloatHistogramSample records with ST hardcoded to 0, and the commit path passed 0 as the first argument to memSeries.insert / appendHistogram / appendFloatHistogram. PR #18221 added the ST field to the records and the st parameter to memSeries; this commit fills in the head side. Histogram chunk encoding still drops ST until PR #18609 lands. Part of #17790. Signed-off-by: Owen Williams <[email protected]>
Add an st field to histogramRecord and populate it from the decoded RefHistogramSample.ST / RefFloatHistogramSample.ST at every load site (WAL loader, WBL loader, both for integer and float histograms). The replay path then forwards s.st into memSeries.appendHistogram / appendFloatHistogram / insert, matching the float path. Part of #17790. Signed-off-by: Owen Williams <[email protected]>
The agent's v2 appender already received an st parameter on Append but dropped it when building RefHistogramSample / RefFloatHistogramSample. Set ST on both record literals so histograms reach the agent WAL with their start timestamp, matching the float counter behaviour. Part of #17790. Signed-off-by: Owen Williams <[email protected]>
Add four tests that verify start timestamps survive the v2 head and
agent WAL paths for histogram and float-histogram samples:
TestHeadAppenderV2_Histogram_STInWAL
head v2 append → commit → read raw WAL → assert ST per sample.
Subtests cover integer/float histograms × EnableSTStorage on/off
to lock in the V2-vs-V1 record-type gating.
TestHeadAppender_STStorage_HistogramWALReplay
head v2 append → close → reopen → assert series rehydrate and a
post-replay append carries its new ST under the same series ref.
TestHeadAppender_STStorage_HistogramWBLReplay
OOO histogram append → assert WBL records carry V2 type with ST.
TestDB_AppendV2_HistogramSTInWAL
agent v2 append → close → read WAL → assert ST per sample, with
varying ST values to exercise the V2 wire format's delta encoding.
Chunk-level ST assertions are deliberately omitted because the
histogram chunk encoder still drops ST pre-#18609; tests assert at the
WAL record boundary instead, which is the contract these commits
actually establish.
walSample (private agent test type) gains an st field; readWALSamples
now also decodes V2 and float-histogram record variants so existing
fixtures keep working while new tests can assert ST.
Part of #17790.
Signed-off-by: Owen Williams <[email protected]>
Signed-off-by: Owen Williams <[email protected]>
Signed-off-by: Owen Williams <[email protected]>
Signed-off-by: Owen Williams <[email protected]>
Signed-off-by: Owen Williams <[email protected]>
Signed-off-by: Owen Williams <[email protected]>
Signed-off-by: Owen Williams <[email protected]>
ywwg
marked this pull request as ready for review
June 16, 2026 17:58
ywwg
requested review from
a team,
bwplotka,
codesome,
jesusvazquez and
krajorama
as code owners
June 16, 2026 17:58
Signed-off-by: Owen Williams <[email protected]>
3 tasks done
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.
Histogram and float-histogram samples now carry their start timestamp
from the AppenderV2.Append entry point all the way into the in-memory
series, matching what counters already do.
Histogram chunk encoding still drops ST until PR #18609 lands, so new AI-genned (and human-checked) tests are overly complex. Once chunk encoding goes in, they can be simplified.
Part of #17790.
Signed-off-by: Owen Williams [email protected]
Release notes for end users (ALL commits must be considered).