fix(internal_logs source): prevent silent drops and improve throughput#25218
Open
thomasqueirozb wants to merge 5 commits intomasterfrom
Open
fix(internal_logs source): prevent silent drops and improve throughput#25218thomasqueirozb wants to merge 5 commits intomasterfrom
thomasqueirozb wants to merge 5 commits intomasterfrom
Conversation
…prevent silent drops
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d93dad90d5
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
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.
Summary
Fixes issue #24220: the
internal_logssource silently dropped events under high load.send_batch. This keeps the broadcast receiver drained while the sink is backpressured, and amortizes per-event overhead downstream.ComponentEventsDropped/component_discarded_events_total{intentional="false"}metric, replacing the previous silentBroadcastStreamRecvError::Laggedswallow.Benchmark
Both
internal_logsandinternal_metricssources feed into their own sinks. The prometheus_exporter is scraped at the end of each 20s run to readcomponent_received_events_totalandcomponent_discarded_events_total{intentional="false"}for theinternal_logssource.On master the drops are silently filtered. For the "master" rows below, master's
into_stream()was temporarily patched to increment the same drop metric (without any tracing call, to avoid a feedback loop) so the numbers are comparable. That patch is not part of this PR.Minimal config (from the issue: console sink)
Blackhole sink (isolates the source path from stdout/JSON costs)
Design comparison, console sink,
VECTOR_LOG=trace, 20sIsolates the source-path change. Buffer size is the broadcast capacity in
src/trace.rs.Buffer size made almost no difference (~6%) once the drain + batching path was in place, so the original 99 is retained.
Sink comparison,
VECTOR_LOG=trace, 20sCompares master (pathed) vs this branch across the console sink (from the issue) and a blackhole sink (isolates the source).
Keep in mind that the dropped events in master without a patch show up as 0, and logs are silently dropped.
Interpretation:
send_eventand broadcast consumption being coupled cap throughput at ~5k events/sec delivered and drop ~86% of events even when the sink is free (blackhole). TheBroadcastStreamRecvError::Laggedpath is silently filtered on stock master, so those drops aren't visible anywhere.tracebecause stdout + JSON encoding caps at ~20k events/sec, but those drops are now surfaced in metrics.Under
VECTOR_LOG=debug(normal load), both configs show zero drops.How did you test this PR?
cargo nextest run --no-default-features --features sources-internal_logs --lib sources::internal_logs::(all existing tests pass)cargo vdev check eventsmake check-clippymake check-fmtVECTOR_LOG=debugandVECTOR_LOG=trace, comparingcomponent_received_events_totalandcomponent_discarded_events_totalbetween master and this branch.Change Type
Is this a breaking change?
Does this PR include user facing changes?
no-changeloglabel to this PR.References
internal_logssource silently drops logs under high load #24220