Repository navigation
Conversation
bwplotka
marked this pull request as draft
October 12, 2026 12:41
bwplotka
force-pushed
the
bwplotka/rw2-rc6-structured-mode
branch
2 times, most recently
from
October 12, 2026 13:02
0414050 to
da591c7
Compare
bwplotka
marked this pull request as ready for review
October 12, 2026 13:04
Define the stateless mode for io.prometheus.write.v2.Request (Content-Type: application/x-protobuf;proto=io.prometheus.write.v2.Request;mode=stateless) requiring explicit Metadata.type, Histogram messages for histogram types (NHCB instead of classic histogram float series), Exemplars attached only to TimeSeries with samples or histograms, and start_timestamp on cumulative or delta metric types. Signed-off-by: Bartek Plotka <bwplotka@gmail.com>
bwplotka
force-pushed
the
bwplotka/rw2-rc6-structured-mode
branch
from
October 12, 2026 13:09
da591c7 to
a7131ac
Compare
Signed-off-by: bwplotka <bwplotka@gmail.com>
2 tasks
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.
Specify
statelessmode forio.prometheus.write.v2.Requestin Remote-Write2.0-rc.6, following the Prometheus Dev Summit consensus and RFC 9413.2.0-rc.6defines an optionalstatelessmode (Content-Type: application/x-protobuf;proto=io.prometheus.write.v2.Request;mode=stateless), a strict subset of the default specification where sendersMUSTguarantee (and receiversCANexpect):Metadata.typeis set (notMETRIC_TYPE_UNSPECIFIED).Exemplars are attached to aTimeSeriesthat contains at least one sample or histogram (no exemplar-onlyTimeSeries).start_timestampis set on every sample and histogram for cumulative (and delta temporality ofc) metric types (METRIC_TYPE_COUNTERandMETRIC_TYPE_HISTOGRAM)._bucket,_sum,_countfloat series) are not sent; essentially all histogram type metrics needs "histogram" sample. Classic histograms should use NHCBsBy default (when no mode is specified via
Content-Type: application/x-protobuf;proto=io.prometheus.write.v2.Request), all valid field permutations permitted by the base specification may be sent.statelessmode is OPTIONAL for sender and receivers.statelessmode does NOT break receivers in any way -- it is a "sub-protocol", fully embedded in the current RW2 features.Motivation
In the ecosystem we see two core types of adopters of RW/RW2:
__name__), infer or ignore metadata, and don't require start timestamps or complex types to store a point.default).TimeSeriesinto a self-contained, typed metric point on arrival.To enable easier adoption of (2) while allowing efficiency and compatibility for (1) we propose to group our four features into one mode. This allows:
A) Easier discovery of client vs receive compatibility (e.g. will Thanos Ruler RW work with Otel? Does it support
statelessmode?) in the ecosystem. This is much easier than caring about each permutation of features.B) Avoid too many permutations for different ways of sending the same data.
C) User UX in terms of configuring senders
In Prometheus today, producing stateless-ready output requires coordinating multiple separate scrape/TSDB/remote-write settings:
send_exemplars: true(plus co-locating exemplars with samples)metadata_config.send: true(ortype-and-unit-labels/metadata-wal-records)created-timestamp-zero-ingestion/ start timestamp trackingconvert-classic-histograms-to-nhcbIf the protocol exposes 4 capabilities, users have to diagnose 415/400 errors capability-by-capability and hunt down 4 different flags. With
mode: statelessinremote_writeconfig, Prometheus (and other senders like Alloy or OTel Collector) can either enable/validate the required pipeline settings as a single unit or fail fast at startup with a clear error message.C) Clear separation of typical protocol uses, allowing both to co-exists and evolve. In future (e.g. 3.x) we might get to the state where
statelessis a default and only mode (likely ST will remain optional though).Precedence in other protocols
Content-Typeparameters (RFC 9110 §8.3): Prometheus already uses media type parameters onContent-Type/Acceptto select wire representation modes without minting a new media type, such asescaping=allow-utf-8vsescaping=underscoresincommon/expfmt.application/ld+json; profile="...") such that any conformant payload in the constrained mode remains 100% valid in the base media type, preserving interoperability with unprofiled receivers.Sec-WebSocket-Protocol(RFC 6455 §1.9) & gRPC Content-Type sub-modes (application/grpc+proto): Negotiate a single named sub-mode on top of the framing layer so the server can reject unsupported modes upfront (415) rather than discovering missing capabilities mid-stream.Alternatives
1. Introduce separate capabilities for each or group of those features
This was discussed a bit on DevSummit. For example
typed-metrics,exemplar-per-sample,known-start-timestamp,nhcbCons:
prometheus/compliance, testing senders and receivers againstdefaultandmode=statelessis 2 test profiles. With 4 capabilities, a receiver might demand any of 15 non-empty subsets, and senders have to map arbitrary combinations of internal flags to header strings.However, probably the more reasonable choice would be to group it as follows:
structured- implying exemplar and NHCB (and summary one day)typed- implying metric types)st-aware- implying ST set on cumulativesThis technically limits the spread. There's also a separation as well given:
structured) vs instrumentation features (typed/st-aware)Similar cons apply though.
2. Instead of
modecall itprofileWhile it would be similar to e.g. HTTP media type profiles etc, it can be confusing given "profiling" means pprof profile in observability. Mode is clearer (thanks @metalmatze for pointing out!)
3. Instead of
statelesscall itstructuredGenerally it allows stateless receiving, so
statelessis a clearer name.structuredmakes sense for type/NHCB/exemplars, except the ST feature.4. Have
statelessmode as a RW 3.0 versionEspecially with NHCB we are sure that's a future so why not having 3.x version for
statelessmode?Not ideal because:
statelessmode fully. Metric are still untyped, start timestamp on cumulatives is not a common need for the native TSDB backends, the same with exemplars per sample. It's better to experiment first to see if the dual category will converge and how in practice.