Repository navigation
Conversation
A sink showed no `component_sent_*` series until its first successful
request, and `component_sent_bytes_total` was deleted again after
`expire_metrics_secs` of idle time, because `emit!(EndpointBytesSent)`
creates the counter and drops the handle on every call. Sources do not
have this problem: their `EventsSent` handle is registered at build and
held. The manager's sink "no data" alert reads
`vector_component_sent_bytes_total`, so it could not fire for a sink that
had never sent anything.
- `BytesSent` gets an optional `endpoint` label (like `EventsSent`'s
optional `output`). Existing `BytesSent::from(Protocol::X)` users get
`endpoint: None` and produce the same series as before.
- `Driver` gets `.endpoint(..)` next to `.protocol(..)`; it already
registers and holds `BytesSent` at start when a protocol is given.
- The Splunk HEC logs and metrics sinks compute `(protocol, endpoint)`
once at build (`bytes_sent_labels`, built the same way a request builds
them) and pass them to the driver, so the driver holds the exact series
that `emit!(EndpointBytesSent)` counts into.
- `Driver` also registers and holds the untagged `component_sent_events_total`
and `component_sent_event_bytes_total` series at start.
Result: the HEC sink exposes `component_sent_bytes_total{protocol,endpoint}`
and the events counters at 0 from startup, and they are not expired while
the sink runs. `emit!(EndpointBytesSent)` still does the counting.
Known limits: a config reload while the sink was idle past
`expire_metrics_secs` still resets the counters (the old component is shut
down before the new one is built); other sinks are unchanged.
Tested: `cargo test --lib sinks::splunk_hec` (105 passed), and manual runs
with a fake HEC endpoint (nothing sent, 5 events then idle past expiry).
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.
A sink showed no
component_sent_*series until its first successful request, andcomponent_sent_bytes_totalwas deleted again afterexpire_metrics_secsof idle time, becauseemit!(EndpointBytesSent)creates the counter and drops the handle on every call. Sources do not have this problem: theirEventsSenthandle is registered at build and held. The manager's sink "no data" alert readsvector_component_sent_bytes_total, so it could not fire for a sink that had never sent anything.BytesSentgets an optionalendpointlabel (likeEventsSent's optionaloutput). ExistingBytesSent::from(Protocol::X)users getendpoint: Noneand produce the same series as before.Drivergets.endpoint(..)next to.protocol(..); it already registers and holdsBytesSentat start when a protocol is given.(protocol, endpoint)once at build (bytes_sent_labels, built the same way a request builds them) and pass them to the driver, so the driver holds the exact series thatemit!(EndpointBytesSent)counts into.Driveralso registers and holds the untaggedcomponent_sent_events_totalandcomponent_sent_event_bytes_totalseries at start.Result: the HEC sink exposes
component_sent_bytes_total{protocol,endpoint}and the events counters at 0 from startup, and they are not expired while the sink runs.emit!(EndpointBytesSent)still does the counting.Known limits: a config reload while the sink was idle past
expire_metrics_secsstill resets the counters (the old component is shut down before the new one is built); other sinks are unchanged.Tested:
cargo test --lib sinks::splunk_hec(105 passed), and manual runs with a fake HEC endpoint (nothing sent, 5 events then idle past expiry).