You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat(prometheus-write): add stream-aware sampling before conversion - #954
Event processors run after protobuf conversion. High-frequency wide snapshots
therefore consume CPU and allocations even when a later processor discards them.
Some telemetry streams mix a multi-response initial snapshot with narrow
incremental notifications, so sampling must preserve the complete initial sync
and must not consume cadence for narrow deltas.
After initial sync, every matching response at or above minimum-bytes must be
independently discardable. Sampling is not safe for a later logical snapshot
that is split across multiple responses because the output cannot infer that
grouping.
pood1e
changed the title
feat(prometheus-write): sample snapshots before conversion
feat(prometheus-write): add size-aware sampling before conversion
Aug 28, 2026
pood1e
changed the title
feat(prometheus-write): add size-aware sampling before conversion
feat(prometheus-write): add stream-aware sampling before conversion
Aug 29, 2026
While I get the problem you are trying to solve, I have to say I'm not a fan of the solution.
The sampler filters by source and subscription and doesn't consider wildcard keys that might be present in the subscription. If responses get sampled, it can result in entire keys being sampled out.
I think the solution you are looking for is running 2 gNMIc instances where the first one subscribes to the target at a fast sample interval (say 10s) while the second one subscribes the first gNMIc instance at the desired sampling rate (say 60s).
The second instance writes to prometheus and the first instance write to whichever other output is fine with frequent writes.
If you don't need a frequent subscription, you might as well just subscribe with a 60s sample interval from the target.
This branch has not been deployed
No deployments
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
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.
What changed
message-sampling.by-subscriptionrules to the Prometheus writeoutput
intervaland optionalminimum-bytesthresholdprotobuf-to-event conversion
messages bypass sampling without consuming the interval
spreadisenabled
enqueueing is canceled
gnmic_prometheus_write_output_messages_skipped_totalWhy
Event processors run after protobuf conversion. High-frequency wide snapshots
therefore consume CPU and allocations even when a later processor discards them.
Some telemetry streams mix a multi-response initial snapshot with narrow
incremental notifications, so sampling must preserve the complete initial sync
and must not consume cadence for narrow deltas.
After initial sync, every matching response at or above
minimum-bytesmust beindependently discardable. Sampling is not safe for a later logical snapshot
that is split across multiple responses because the output cannot infer that
grouping.
Configuration
Validation
go test -race ./...cd pkg/api && go test -race ./targetgit diff --checkFixes #953.