-
Notifications
You must be signed in to change notification settings - Fork 2k
enhancement(observability): Add metrics to measure total event processing time #24481
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 8 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
25416c6
chore(core): Add `ingest_timestamp` to `EventMetadata`
bruceg 68f79fb
Add new `EwmaGauge` wrapper to handle both in one update step
bruceg d5e5b7e
enhancement(observability): Add metrics to measure total event proces…
bruceg 59e4022
Update wording on the lognamespacing tutorial docs.
bruceg 7a38f9f
Pre-create metrics to avoid extraneous labels
bruceg 3e83ae5
Fix tests
bruceg 1645439
Move setting ingest timestamp back into `insert_standard_vector_sourc…
bruceg be838b3
Merge remote-tracking branch 'origin/master' into bruceg/event-proces…
bruceg f24de28
Merge remote-tracking branch 'origin/master' into bruceg/event-proces…
bruceg 69bae9a
Assert an upper limit on the average latency gauge too
bruceg File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| Added the `event_processing_time_seconds` histogram and `event_processing_time_mean_seconds` gauge internal_metrics, | ||
| exposing the total time events spend between the originating source and final sink in a topology. | ||
|
|
||
| authors: bruceg |
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| use std::sync::Arc; | ||
|
|
||
| use metrics::Gauge; | ||
|
|
||
| use super::AtomicEwma; | ||
|
|
||
| /// The default alpha parameter used when constructing EWMA-backed gauges. | ||
| pub const DEFAULT_EWMA_ALPHA: f64 = 0.9; | ||
|
|
||
| /// Couples a [`Gauge`] with an [`AtomicEwma`] so gauge readings reflect the EWMA. | ||
| #[derive(Clone, Debug)] | ||
| pub struct EwmaGauge { | ||
| gauge: Gauge, | ||
| // Note that the `Gauge` internally is equivalent to an `Arc<AtomicF64>` so we need to use the | ||
| // same semantics for the EWMA calculation as well. | ||
| ewma: Arc<AtomicEwma>, | ||
| } | ||
|
|
||
| impl EwmaGauge { | ||
| #[must_use] | ||
| pub fn new(gauge: Gauge, alpha: Option<f64>) -> Self { | ||
| let alpha = alpha.unwrap_or(DEFAULT_EWMA_ALPHA); | ||
| let ewma = Arc::new(AtomicEwma::new(alpha)); | ||
| Self { gauge, ewma } | ||
| } | ||
|
|
||
| /// Records a new value, updates the EWMA, and sets the gauge accordingly. | ||
| pub fn record(&self, value: f64) { | ||
| let average = self.ewma.update(value); | ||
| self.gauge.set(average); | ||
| } | ||
| } |
4 changes: 4 additions & 0 deletions
4
lib/vector-common/src/stats.rs → lib/vector-common/src/stats/mod.rs
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
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
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.