Skip to content

storage, tsdb: add ExemplarAppenderV2 interface - #19811

Merged
bwplotka merged 4 commits into
mainfrom
bwplotka/add_exemplar_appender_interface
Sep 29, 2026
Merged

bwplotka merged 4 commits into
mainfrom
bwplotka/add_exemplar_appender_interface

Conversation

@bwplotka

@bwplotka bwplotka commented Sep 23, 2026 •

Copy link
Copy Markdown
Member

Stacked PR: #19812

Alternative design to #19455 (per #19455 (comment)) that prepares AppenderV2 implementations for exemplar appends decoupled from the sample Append call (such as Remote Write 1.0 & 2.x receivers, implemented in #19812) without:

  • removing Exemplars []exemplar.Exemplar from storage.AppendV2Options (AppenderV2.Append), or
  • adding AppendExemplars directly to storage.AppenderV2.

Summary of Changes

  • storage: Introduce storage.ExemplarAppenderV2 (mirroring the V1 storage.ExemplarAppender) embedding storage.AppenderV2 and adding AppendExemplars(ref SeriesRef, l labels.Labels, exemplars []exemplar.Exemplar) (SeriesRef, error). Exemplars appended this way stay part of the appender transaction (committed on Commit, discarded on Rollback); only the call is decoupled from the sample append.
  • tsdb:
    • Implement ExemplarAppenderV2 on headAppenderV2 / initAppenderV2, and delegate it from dbAppenderV2 ((*DB).AppenderV2) with a checked type assertion.
    • AppendExemplars reuses the existing headAppenderV2.appendExemplars validation path, so the inline AppendV2Options.Exemplars fast path stays unchanged (no extra per-append work).
  • tsdb/agent, storage/fanout, storage/remote, cmd/prometheus, util/teststorage:
    • Implement ExemplarAppenderV2 across agent.appenderV2, fanoutAppenderV2, remote.timestampTrackerV2, notReadyAppenderV2, and teststorage.appenderV2.
NONE

@bwplotka
bwplotka added this pull request to stack #19813 September 23, 2026 11:33
@bwplotka
bwplotka force-pushed the bwplotka/add_exemplar_appender_interface branch from 8e96f4b to f39bfc7 Compare September 23, 2026 13:34
@bwplotka bwplotka changed the title storage, tsdb: add NonTransactionalExemplarAppenderV2 interface storage, tsdb: add ExemplarAppenderV2 interface Sep 23, 2026

@krajorama krajorama 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.

LGTM

The PR description says ref!=0 does nothing in agent mode, but the code seems to suggest otherwise.

Comment thread storage/fanout.go Resolved
@bwplotka
bwplotka marked this pull request as ready for review September 29, 2026 08:41
bwplotka and others added 4 commits September 29, 2026 08:47
Fixes modernize (slicesbackward) lint errors reported by golangci-lint v2.13.1.

Signed-off-by: Bartek Plotka <[email protected]>
Co-authored-by: George Krajcsovits <[email protected]>
Signed-off-by: Bartlomiej Plotka <[email protected]>
Signed-off-by: Bartek Plotka <[email protected]>
@bwplotka
bwplotka force-pushed the bwplotka/add_exemplar_appender_interface branch from bc7cfef to 143bdea Compare September 29, 2026 08:49
@bwplotka
bwplotka merged commit 5d8fa88 into main Sep 29, 2026
38 checks passed
@bwplotka
bwplotka deleted the bwplotka/add_exemplar_appender_interface branch September 29, 2026 10:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants