Repository navigation
Conversation
This was referenced Jul 21, 2026
bwplotka
reviewed
Jul 21, 2026
bwplotka
left a comment
Member
There was a problem hiding this comment.
Thanks, looks solid, but why we need MetadataUpdater?
| // | ||
| // As with the V1 MetadataUpdater, UpdateMetadata must be called after the | ||
| // corresponding sample Append for the same series. | ||
| type MetadataUpdaterV2 interface { |
Member
There was a problem hiding this comment.
I don't see v1 using this method. Do we need to expose it? 🤔
Member
Author
There was a problem hiding this comment.
Mimir won't use it either, but I don't know about other downstream projects, so the safest is to add it.
Part of the migration off the V1 storage.Appender interface (#17632). The Remote Write 1.0 receiver path (writeHandler.write) is ported from the V1 storage.Appender to storage.AppenderV2. Exemplars in RW 1.0 arrive as a per-series list and are appended through a standalone AppendExemplar call, which AppenderV2 (exemplars via AppendV2Options) does not offer. Rather than adding AppendExemplar/UpdateMetadata to storage.AppenderV2 - which would force every downstream AppenderV2 implementation to implement them - this introduces two optional capability interfaces, storage.ExemplarAppenderV2 and storage.MetadataUpdaterV2, discovered via a type assertion like storage.GetRef. The remote-write package composes them into the appender capability its receiver requires (receiverAppenderV2). Only Prometheus' own appenders on the RW path implement them: - tsdb head: AppendExemplar/UpdateMetadata moved to the shared headAppenderBase so both V1 and V2 appenders share one implementation; initAppenderV2 delegates. - tsdb agent: the two methods moved to the shared appenderBase. - fanoutAppenderV2: delegates only to appenders that also implement the optional capability. - remote-write timestampTrackerV2: counts exemplars, metadata no-op. - notReadyAppenderV2: returns ErrNotReady. - teststorage: records via the optional capabilities. The Remote Write 2.x path (writeV2) still uses the V1 appendable and will be migrated separately. NewWriteHandler now takes both appendable and appendableV2. 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]>
It was unused. Signed-off-by: György Krajcsovits <[email protected]>
krajorama
force-pushed
the
krajo/rw1-receiver-appenderv2
branch
from
August 18, 2026 09:04
48932ce to
e5afe15
Compare
appenderV2.AppendExemplar and appenderV2.UpdateMetadata called a bare computeOrCheckRef instead of the Appendable method, breaking the build. Signed-off-by: György Krajcsovits <[email protected]>
This was referenced Aug 19, 2026
Member
Author
|
favor #19457 over this |
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.
Part of #17632.
Alternative to #19248. Same goal (migrate the Remote Write 1.0 receiver to
AppenderV2) but without modifying the exportedstorage.AppenderV2interface, so downstreamAppenderV2implementations are not forced to change.What
The RW 1.0 receiver path (
writeHandler.write) is ported from V1storage.Appendertostorage.AppenderV2. RW 1.0 carries exemplars as a per-series list appended through a standaloneAppendExemplarcall, whichAppenderV2(exemplars viaAppendV2Options) does not offer.Instead of adding methods to
storage.AppenderV2, this introduces two optional capability interfaces,storage.ExemplarAppenderV2andstorage.MetadataUpdaterV2, discovered via a type assertion — the same idiom asstorage.GetRef. The remote-write package composes them into the capability its receiver requires (receiverAppenderV2). Only Prometheus' own appenders on the RW path implement them:AppendExemplar/UpdateMetadatamoved to the sharedheadAppenderBaseso both V1 and V2 appenders share one implementation;initAppenderV2delegates.appenderBase.timestampTrackerV2: counts exemplars, metadata no-op.ErrNotReady.The Remote Write 2.x path (
writeV2) still uses the V1 appendable and will be migrated separately.NewWriteHandlernow takes bothappendableandappendableV2;web/api/v1passes both.Why this shape
storage.AppenderV2is implemented by downstream projects (e.g. Cortex/Mimir). Adding methods to it is a breaking change for them. Keeping exemplar/metadata as optional, assertion-discovered capabilities avoids that while still letting the receiver reuse the standalone-append shape.Tests
AppenderV2path (the mock appendable gained a V2 appender recording into the same slices, so existing assertions hold).TestHeadAppenderV2_AppendExemplarAndUpdateMetadataverifies the head implements the optional capabilities and stores the exemplar (viaExemplarQuerier) and metadata..Thenchaining).