Skip to content

feat(tsdb): new Append parameter and AtST interface for chunks - #17840

Merged
krajorama merged 12 commits into
mainfrom
krajo/st-in-chunks
Jan 16, 2026
Merged

krajorama merged 12 commits into
mainfrom
krajo/st-in-chunks

Conversation

@krajorama

@krajorama krajorama commented Jan 12, 2026 •

Copy link
Copy Markdown
Member

No implementation yet. Just to test the shape of the interface. AtST is implemented for trivial cases, anything else is hard coded to return 0.

I've added unit tests where possible, TODO otherwise.

Ref: #17791
Based on: #17475

Which issue(s) does the PR fix:

Does this PR introduce a user-facing change?

NONE

Comment thread storage/interface.go
// and labelSet.
// Start timestamps is optional, pass nil or empty slice to indicate no start
// timestamps.
func MockSeries(startTimestamps, timestamps []int64, values []float64, labelSet []string) Series {

@bwplotka bwplotka Jan 12, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fyi: There's potential to replace all of this with

type Sample struct {
(just FYI, likely not now, a lot of work)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe we can schedule some LLM agent to at least start the move...

Comment thread tsdb/chunkenc/chunk.go Resolved
Comment thread tsdb/chunkenc/histogram.go Resolved
Comment thread tsdb/chunkenc/float_histogram.go Resolved

@bwplotka bwplotka left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good except the chunk AppenderV2, I vote we make a breaking change here, perhaps with a quick adapter for downstream.

No implementation yet. Just to test the shape of the interface.
AtST is implemented for trivial cases, anything else is hard coded
to return 0.

Ref: #17791

Signed-off-by: György Krajcsovits <[email protected]>
Also fix the single multi line fSample definition to be one liner.

Signed-off-by: György Krajcsovits <[email protected]>
find . -name "*.go" -type f \
-exec sed -E -i 's/((f|h|fh)Sample\{)([^,{:]+,[^,]+\})/\10, \3/g' {} +

Signed-off-by: György Krajcsovits <[email protected]>
find . -name "*.go" -type f -exec sed -E -i \
's/([^[:alpha:]]sample\{)([^,{:]+,[^,]+,[^,]+,[^,]+\})/\10, \2/g' {} +

I've omitted tsdb/ooo_head.go from the commit because I'm also adding todo
there.

Signed-off-by: György Krajcsovits <[email protected]>
Signed-off-by: György Krajcsovits <[email protected]>
Signed-off-by: György Krajcsovits <[email protected]>
Signed-off-by: György Krajcsovits <[email protected]>
I've checked that commenting out any one of the new lines produces an error.

Signed-off-by: György Krajcsovits <[email protected]>
Signed-off-by: György Krajcsovits <[email protected]>

@bwplotka bwplotka left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Thanks!

I noticed two likely heap places of a tiny bit larger allocs (int64), just to pay attention on those. Should be totally acceptable.

OOMChunk

samples []sample

@krajorama

Copy link
Copy Markdown
Member Author

/prombench main

@prombot

prombot commented Jan 14, 2026

Copy link
Copy Markdown
Contributor

⏱️ Welcome to Prometheus Benchmarking Tool. ⏱️

Compared versions: PR-17840 and main

After the successful deployment (check status here), the benchmarking results can be viewed at:

Available Commands:

  • To restart benchmark: /prombench restart main
  • To stop benchmark: /prombench cancel
  • To print help: /prombench help

Comment thread tsdb/chunkenc/chunk.go Resolved

@aknuds1 aknuds1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM modulo minimal nit :)

Comment thread tsdb/chunkenc/chunk.go Resolved
Co-authored-by: Arve Knudsen <[email protected]>
Signed-off-by: George Krajcsovits <[email protected]>
@bwplotka

Copy link
Copy Markdown
Member

I don't see any overhead on prombench, LGTM

CPU is fine

image

Memory is more or less same

image

Also allocs

image

@krajorama krajorama changed the title feat(tsdb): new AppenderV2 and AtST interface for chunks feat(tsdb): new Append parameter and AtST interface for chunks Jan 15, 2026
@bwplotka

Copy link
Copy Markdown
Member

Mergable?

@krajorama

Copy link
Copy Markdown
Member Author

/prombench cancel

@prombot

prombot commented Jan 16, 2026

Copy link
Copy Markdown
Contributor

Benchmark cancel is in progress.

@krajorama
krajorama merged commit ef350b2 into main Jan 16, 2026
50 checks passed
@krajorama
krajorama deleted the krajo/st-in-chunks branch January 16, 2026 09:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants