Skip to content

storage/remote: migrate Remote Write 2.x receiver to AppenderV2 - #19251

Closed
krajorama wants to merge 1 commit into
krajo/rw1-receiver-appenderv2from
krajo/rw2-receiver-appenderv2
Closed

krajorama wants to merge 1 commit into
krajo/rw1-receiver-appenderv2from
krajo/rw2-receiver-appenderv2

Conversation

@krajorama

Copy link
Copy Markdown
Member

Part of #17632. Stacked on top of #19250 (Remote Write 1.0 migration) — base branch is krajo/rw1-receiver-appenderv2, so review only the top commit here. Merge/rebase after #19250.

What

The Remote Write 2.x receiver path (writeHandler.writeV2 / appendV2) is ported from V1 storage.Appender to storage.AppenderV2, matching the RW 1.0 path from #19250.

  • Start timestamps are now passed directly as the AppenderV2.Append st parameter; the appender owns ST zero-sample injection, so the explicit AppendSTZeroSample / AppendHistogramSTZeroSample calls (and the handleHistogramZeroSample helper) are removed. The receiver still gates on ingestSTZeroSample, which the same feature flag enables together with the TSDB/agent EnableSTAsZeroSample option (cmd/prometheus/main.go), so behaviour is preserved.
  • Exemplars and metadata keep using the standalone AppendExemplar / UpdateMetadata calls, now provided by remoteWriteAppenderV2 via the optional storage.ExemplarAppenderV2 / storage.MetadataUpdaterV2 capabilities introduced in storage/remote: migrate Remote Write 1.0 receiver to AppenderV2 #19250.

With both RW 1.0 and 2.x on AppenderV2, the V1 appendable is no longer used: NewWriteHandler drops its storage.Appendable parameter and the now-dead remoteWriteAppender wrapper is removed (net −52 lines).

Tests

The write_handler mock gained a V2 appender that injects ST zero samples, so the existing V2-message assertions (including the ST zero-sample expectations) continue to hold unchanged.

NONE

Comment thread storage/remote/write_handler.go Resolved
Comment thread storage/remote/write_handler.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 actually solid! We can switch exemplars (if we have them connected to series as per #17857), but do we need metadata?

// Only update metadata in WAL if the metadata-wal-records feature is enabled.
// Without this feature, metadata is not persisted to WAL.
if h.appendMetadata {
if _, err = app.UpdateMetadata(ref, ls, m); err != nil {

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.

Can we switch to inline Append for this and avoid #19250 (comment) 🤔

Part of the migration off the V1 storage.Appender interface (#17632).
Depends on the Remote Write 1.0 migration.

The Remote Write 2.x receiver path (writeHandler.writeV2 / appendV2) is ported
from V1 storage.Appender to storage.AppenderV2, matching the RW 1.0 path.

- Start timestamps are now passed directly as the AppenderV2.Append `st`
  parameter; the appender owns ST zero-sample injection, so the explicit
  AppendSTZeroSample / AppendHistogramSTZeroSample calls (and the
  handleHistogramZeroSample helper) are removed. The receiver still gates on the
  ingestSTZeroSample flag, which is enabled together with the TSDB/agent
  EnableSTAsZeroSample option.
- Exemplars and metadata continue to use the standalone AppendExemplar /
  UpdateMetadata calls, now provided by remoteWriteAppenderV2 via the optional
  storage.ExemplarAppenderV2 / storage.MetadataUpdaterV2 capabilities.

With both RW 1.0 and 2.x on AppenderV2, the V1 appendable is no longer used:
NewWriteHandler drops its storage.Appendable parameter and the now-dead
remoteWriteAppender wrapper is removed.

The write_handler mock gained a V2 appender that injects ST zero samples so the
existing assertions continue to hold.

Signed-off-by: György Krajcsovits <[email protected]>
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Signed-off-by: György Krajcsovits <[email protected]>
@krajorama

Copy link
Copy Markdown
Member Author

favor #19457 over this

@krajorama krajorama closed this Aug 28, 2026
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