feat(prometheus-write): add stream-aware sampling before conversion - #954
feat(prometheus-write): add stream-aware sampling before conversion#954pood1e wants to merge 3 commits into
Conversation
c27367d to
93022df
Compare
93022df to
2f8927c
Compare
2f8927c to
77a3fd0
Compare
|
Follow-up hardening is in
Validation completed on this head:
The rejected-message benchmark reports |
|
While I get the problem you are trying to solve, I have to say I'm not a fan of the solution. 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). |
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.