Skip to content

storage: add AppendExemplar/UpdateMetadata to AppenderV2 - #19248

Closed
krajorama wants to merge 1 commit into
mainfrom
krajo/appenderv2-exemplar-metadata
Closed

krajorama wants to merge 1 commit into
mainfrom
krajo/appenderv2-exemplar-metadata

Conversation

@krajorama

Copy link
Copy Markdown
Member

Part of #17632.

What

AppenderV2 so far only exposed Append, with exemplars and metadata carried through AppendV2Options. Callers structured around the V1 standalone AppendExemplar/UpdateMetadata calls (e.g. the remote-write receiver) cannot be ported mechanically to that model.

This adds two new V2-scoped interfaces, ExemplarAppenderV2 and MetadataUpdaterV2, embedded into AppenderV2, mirroring the V1 ExemplarAppender/MetadataUpdater sub-interfaces. The AppendV2Options.Exemplars and .Metadata fields remain; both entry points feed the same per-series batch.

The methods are implemented on every concrete V2 appender:

  • tsdb head: AppendExemplar/UpdateMetadata moved to the shared headAppenderBase so both V1 and V2 appenders share one implementation; initAppenderV2 gains delegating variants.
  • tsdb agent: the two methods moved to the shared appenderBase.
  • fanoutAppenderV2: delegates to primary and secondaries.
  • remote-write timestampTrackerV2: counts exemplars, metadata is a no-op (matching V1).
  • notReadyAppenderV2: returns ErrNotReady.
  • teststorage and the noOpAppender test mock: record / no-op as appropriate.

This change is additive; no existing behaviour changes.

Why

Preparatory step for migrating the remote-write receiver (starting with RW 1.0) off the V1 storage.Appender. A follow-up PR will use these methods to switch the receiver to AppenderV2.

Tests

  • Extended teststorage's shared testAppendableV2 (also exercises .Then chaining) to cover the new standalone methods.
  • Added TestHeadAppenderV2_AppendExemplarAndUpdateMetadata verifying the exemplar via ExemplarQuerier and the metadata via the series' stored metadata.
NONE

Part of the migration off the V1 storage.Appender interface (#17632).

AppenderV2 so far only exposed Append, with exemplars and metadata carried
through AppendV2Options. Callers structured around the V1 standalone
AppendExemplar/UpdateMetadata calls (e.g. the remote-write receiver) cannot
be ported mechanically to that model.

This adds two new V2-scoped interfaces, ExemplarAppenderV2 and
MetadataUpdaterV2, embedded into AppenderV2, mirroring the V1
ExemplarAppender/MetadataUpdater sub-interfaces. The AppendV2Options.Exemplars
and .Metadata fields remain; both entry points feed the same per-series batch.

The methods are implemented on every concrete V2 appender:
- tsdb head: AppendExemplar/UpdateMetadata moved to the shared
  headAppenderBase so both V1 and V2 appenders share them; initAppenderV2
  gains delegating variants.
- tsdb agent: the two methods moved to the shared appenderBase.
- fanoutAppenderV2 delegates to primary and secondaries.
- remote-write timestampTrackerV2 counts exemplars, metadata is a no-op.
- notReadyAppenderV2 returns ErrNotReady.
- teststorage and the noOpAppender test mock record/no-op as appropriate.

This change is additive; no existing behaviour changes.

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

I like the alternative #19250 better to not enforce changes on downstream.

@krajorama krajorama closed this Jul 21, 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.

1 participant