forked from apestel/vector
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
enhancement(internal_metrics source): instrument "stdin" source (vect…
…ordotdev#3151) Signed-off-by: Brian Menges <brian.menges@anaplan.com>
- Loading branch information
Showing
3 changed files
with
56 additions
and
3 deletions.
There are no files selected for viewing
This file contains 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 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,45 @@ | ||
use super::InternalEvent; | ||
use metrics::counter; | ||
|
||
#[derive(Debug)] | ||
pub struct StdinEventReceived { | ||
pub byte_size: usize, | ||
} | ||
|
||
impl InternalEvent for StdinEventReceived { | ||
fn emit_logs(&self) { | ||
trace!(message = "received one event.", rate_limit_secs = 10); | ||
} | ||
|
||
fn emit_metrics(&self) { | ||
counter!( | ||
"events_processed", 1, | ||
"component_kind" => "source", | ||
"component_type" => "stdin", | ||
); | ||
counter!( | ||
"bytes_processed", self.byte_size as u64, | ||
"component_kind" => "source", | ||
"component_type" => "stdin", | ||
); | ||
} | ||
} | ||
|
||
#[derive(Debug)] | ||
pub struct StdinReadFailed { | ||
pub error: std::io::Error, | ||
} | ||
|
||
impl InternalEvent for StdinReadFailed { | ||
fn emit_logs(&self) { | ||
error!(message = "unable to read from source.", error = %self.error); | ||
} | ||
|
||
fn emit_metrics(&self) { | ||
counter!( | ||
"stdin_reads_failed", 1, | ||
"component_kind" => "source", | ||
"component_type" => "stdin", | ||
); | ||
} | ||
} |
This file contains 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