From c6bcb4b063f8d0d2cda04b054e62ed4c99c637f5 Mon Sep 17 00:00:00 2001 From: MOZGIII Date: Tue, 29 Sep 2020 00:56:22 +0300 Subject: [PATCH 1/3] Populate metrics from spans to match the keys at emit!s Signed-off-by: MOZGIII --- src/metrics.rs | 18 +++++++----------- src/topology/mod.rs | 15 +++++++++------ 2 files changed, 16 insertions(+), 17 deletions(-) diff --git a/src/metrics.rs b/src/metrics.rs index 32b3c52b5107e..29625da768e0c 100644 --- a/src/metrics.rs +++ b/src/metrics.rs @@ -84,7 +84,7 @@ struct VectorLabelFilter; impl LabelFilter for VectorLabelFilter { fn should_include_label(&self, label: &Label) -> bool { let key = label.key(); - key == "topology_component_name" || key == "topology_component_type" + key == "component_name" || key == "component_type" || key == "component_kind" } } @@ -132,8 +132,9 @@ mod tests { let span = span!( Level::ERROR, "my span", - topology_component_name = "my_component_name", - topology_component_type = "my_component_type", + component_name = "my_component_name", + component_type = "my_component_type", + component_kind = "my_component_kind", some_other_label = "qwerty" ); // See https://github.com/tokio-rs/tracing/issues/978 @@ -151,14 +152,9 @@ mod tests { let expected_tags = Some( vec![ - ( - "topology_component_name".to_owned(), - "my_component_name".to_owned(), - ), - ( - "topology_component_type".to_owned(), - "my_component_type".to_owned(), - ), + ("component_name".to_owned(), "my_component_name".to_owned()), + ("component_type".to_owned(), "my_component_type".to_owned()), + ("component_kind".to_owned(), "my_component_kind".to_owned()), ] .into_iter() .collect(), diff --git a/src/topology/mod.rs b/src/topology/mod.rs index 89f13e105015c..eb57e582b5f93 100644 --- a/src/topology/mod.rs +++ b/src/topology/mod.rs @@ -438,8 +438,9 @@ impl RunningTopology { let task = new_pieces.tasks.remove(name).unwrap(); let span = error_span!( "sink", - topology_component_name = %task.name(), - topology_component_type = %task.typetag(), + component_kind = "sink", + component_name = %task.name(), + component_type = %task.typetag(), ); let task = handle_errors(task.compat(), self.abort_tx.clone()).instrument(span); let spawned = tokio::spawn(task.compat()); @@ -452,8 +453,9 @@ impl RunningTopology { let task = new_pieces.tasks.remove(name).unwrap(); let span = error_span!( "transform", - topology_component_name = %task.name(), - topology_component_type = %task.typetag(), + component_kind = "transform", + component_name = %task.name(), + component_type = %task.typetag(), ); let task = handle_errors(task.compat(), self.abort_tx.clone()).instrument(span); let spawned = tokio::spawn(task.compat()); @@ -466,8 +468,9 @@ impl RunningTopology { let task = new_pieces.tasks.remove(name).unwrap(); let span = error_span!( "source", - topology_component_name = %task.name(), - topology_component_type = %task.typetag(), + component_kind = "source", + component_name = %task.name(), + component_type = %task.typetag(), ); let task = handle_errors(task.compat(), self.abort_tx.clone()).instrument(span.clone()); let spawned = tokio::spawn(task.compat()); From 581fcaa77e65ec9c9f1fe304fa028ff42086053d Mon Sep 17 00:00:00 2001 From: MOZGIII Date: Tue, 29 Sep 2020 01:15:19 +0300 Subject: [PATCH 2/3] Remove component info literals from emit!s Signed-off-by: MOZGIII --- src/internal_events/add_fields.rs | 15 ++---- src/internal_events/add_tags.rs | 5 +- src/internal_events/ansi_stripper.rs | 22 ++------- src/internal_events/apache_metrics.rs | 37 +++------------ src/internal_events/aws_kinesis_streams.rs | 12 +---- src/internal_events/blackhole.rs | 12 +---- src/internal_events/coercer.rs | 11 +---- src/internal_events/concat.rs | 10 +--- src/internal_events/dedupe.rs | 10 +--- src/internal_events/docker.rs | 45 ++++-------------- src/internal_events/elasticsearch.rs | 18 ++------ src/internal_events/file.rs | 32 +------------ src/internal_events/generator.rs | 5 +- src/internal_events/grok_parser.rs | 11 +---- src/internal_events/http.rs | 16 ++----- src/internal_events/journald.rs | 20 ++------ src/internal_events/json_parser.rs | 9 +--- src/internal_events/kafka.rs | 24 ++-------- src/internal_events/kubernetes_logs.rs | 24 ++-------- src/internal_events/log_to_metric.rs | 13 +----- src/internal_events/logplex.rs | 11 +---- src/internal_events/lua.rs | 20 ++------ src/internal_events/prometheus.rs | 37 +++------------ src/internal_events/reduce.rs | 10 +--- src/internal_events/regex_parser.rs | 29 ++---------- src/internal_events/remap.rs | 11 +---- src/internal_events/remove_fields.rs | 5 +- src/internal_events/remove_tags.rs | 5 +- src/internal_events/rename_fields.rs | 5 +- src/internal_events/sampler.rs | 10 +--- src/internal_events/socket.rs | 18 ++------ src/internal_events/split.rs | 17 ++----- src/internal_events/splunk_hec.rs | 48 ++++---------------- src/internal_events/statsd.rs | 30 ++---------- src/internal_events/stdin.rs | 18 ++------ src/internal_events/swimlanes.rs | 10 +--- src/internal_events/syslog.rs | 22 ++------- src/internal_events/tag_cardinality_limit.rs | 20 ++------ src/internal_events/tcp.rs | 34 ++++---------- src/internal_events/tokenizer.rs | 17 ++----- src/internal_events/unix.rs | 20 ++------ src/internal_events/vector.rs | 32 +++---------- 42 files changed, 138 insertions(+), 642 deletions(-) diff --git a/src/internal_events/add_fields.rs b/src/internal_events/add_fields.rs index 6145ef052a06c..55a510a0a1cf0 100644 --- a/src/internal_events/add_fields.rs +++ b/src/internal_events/add_fields.rs @@ -6,10 +6,7 @@ pub struct AddFieldsEventProcessed; impl InternalEvent for AddFieldsEventProcessed { fn emit_metrics(&self) { - counter!("events_processed", 1, - "component_kind" => "transform", - "component_type" => "add_fields", - ); + counter!("events_processed", 1); } } @@ -24,10 +21,7 @@ impl<'a> InternalEvent for AddFieldsTemplateRenderingError<'a> { } fn emit_metrics(&self) { - counter!("processing_errors", 1, - "component_kind" => "transform", - "component_type" => "add_fields", - ); + counter!("processing_errors", 1); } } @@ -43,10 +37,7 @@ impl<'a> InternalEvent for AddFieldsTemplateInvalid<'a> { } fn emit_metrics(&self) { - counter!("processing_errors", 1, - "component_kind" => "transform", - "component_type" => "add_fields", - ); + counter!("processing_errors", 1); } } diff --git a/src/internal_events/add_tags.rs b/src/internal_events/add_tags.rs index ebeed873f76e6..1d1ade6ac4067 100644 --- a/src/internal_events/add_tags.rs +++ b/src/internal_events/add_tags.rs @@ -6,10 +6,7 @@ pub struct AddTagsEventProcessed; impl InternalEvent for AddTagsEventProcessed { fn emit_metrics(&self) { - counter!("events_processed", 1, - "component_kind" => "transform", - "component_type" => "add_tags", - ); + counter!("events_processed", 1); } } diff --git a/src/internal_events/ansi_stripper.rs b/src/internal_events/ansi_stripper.rs index f002e2ab39dc7..8386f44990a5b 100644 --- a/src/internal_events/ansi_stripper.rs +++ b/src/internal_events/ansi_stripper.rs @@ -7,10 +7,7 @@ pub struct ANSIStripperEventProcessed; impl InternalEvent for ANSIStripperEventProcessed { fn emit_metrics(&self) { - counter!("events_processed", 1, - "component_kind" => "transform", - "component_type" => "ansi_stripper", - ); + counter!("events_processed", 1); } } @@ -29,11 +26,7 @@ impl InternalEvent for ANSIStripperFieldMissing<'_> { } fn emit_metrics(&self) { - counter!("processing_errors", 1, - "component_kind" => "transform", - "component_type" => "ansi_stripper", - "error_type" => "field_missing", - ); + counter!("processing_errors", 1, "error_type" => "field_missing"); } } @@ -52,11 +45,7 @@ impl InternalEvent for ANSIStripperFieldInvalid<'_> { } fn emit_metrics(&self) { - counter!("processing_errors", 1, - "component_kind" => "transform", - "component_type" => "ansi_stripper", - "error_type" => "value_invalid", - ); + counter!("processing_errors", 1, "error_type" => "value_invalid"); } } @@ -77,9 +66,6 @@ impl InternalEvent for ANSIStripperFailed<'_> { } fn emit_metrics(&self) { - counter!("processing_errors", 1, - "component_kind" => "transform", - "component_type" => "ansi_stripper", - ); + counter!("processing_errors", 1); } } diff --git a/src/internal_events/apache_metrics.rs b/src/internal_events/apache_metrics.rs index b033fe2b8660d..a024e303379d4 100644 --- a/src/internal_events/apache_metrics.rs +++ b/src/internal_events/apache_metrics.rs @@ -16,16 +16,8 @@ impl InternalEvent for ApacheMetricsEventReceived { } fn emit_metrics(&self) { - counter!( - "events_processed", self.count as u64, - "component_kind" => "source", - "component_type" => "apache_metrics", - ); - counter!( - "bytes_processed", self.byte_size as u64, - "component_kind" => "source", - "component_type" => "apache_metrics", - ); + counter!("events_processed", self.count as u64); + counter!("bytes_processed", self.byte_size as u64); } } @@ -41,14 +33,8 @@ impl InternalEvent for ApacheMetricsRequestCompleted { } fn emit_metrics(&self) { - counter!("requests_completed", 1, - "component_kind" => "source", - "component_type" => "apache_metrics", - ); - histogram!("request_duration_nanoseconds", self.end - self.start, - "component_kind" => "source", - "component_type" => "apache_metrics", - ); + counter!("requests_completed", 1); + histogram!("request_duration_nanoseconds", self.end - self.start); } } @@ -69,10 +55,7 @@ impl InternalEvent for ApacheMetricsParseError { } fn emit_metrics(&self) { - counter!("parse_errors", 1, - "component_kind" => "source", - "component_type" => "apache_metrics", - ); + counter!("parse_errors", 1); } } @@ -88,10 +71,7 @@ impl InternalEvent for ApacheMetricsErrorResponse { } fn emit_metrics(&self) { - counter!("http_error_response", 1, - "component_kind" => "source", - "component_type" => "apache_metrics", - ); + counter!("http_error_response", 1); } } @@ -107,9 +87,6 @@ impl InternalEvent for ApacheMetricsHttpError { } fn emit_metrics(&self) { - counter!("http_request_errors", 1, - "component_kind" => "source", - "component_type" => "apache_metrics", - ); + counter!("http_request_errors", 1); } } diff --git a/src/internal_events/aws_kinesis_streams.rs b/src/internal_events/aws_kinesis_streams.rs index 0f74655ac91fa..7622bbf99c907 100644 --- a/src/internal_events/aws_kinesis_streams.rs +++ b/src/internal_events/aws_kinesis_streams.rs @@ -8,15 +8,7 @@ pub struct AwsKinesisStreamsEventSent { impl InternalEvent for AwsKinesisStreamsEventSent { fn emit_metrics(&self) { - counter!( - "events_processed", 1, - "component_kind" => "sink", - "component_type" => "aws_kinesis_streams", - ); - counter!( - "bytes_processed", self.byte_size as u64, - "component_kind" => "sink", - "component_type" => "aws_kinesis_streams", - ); + counter!("events_processed", 1); + counter!("bytes_processed", self.byte_size as u64); } } diff --git a/src/internal_events/blackhole.rs b/src/internal_events/blackhole.rs index e743dd2dcf716..6714ccde912b3 100644 --- a/src/internal_events/blackhole.rs +++ b/src/internal_events/blackhole.rs @@ -8,15 +8,7 @@ pub struct BlackholeEventReceived { impl InternalEvent for BlackholeEventReceived { fn emit_metrics(&self) { - counter!( - "events_processed", 1, - "component_kind" => "sink", - "component_type" => "blackhole", - ); - counter!( - "bytes_processed", self.byte_size as u64, - "component_kind" => "sink", - "component_type" => "blackhole", - ); + counter!("events_processed", 1); + counter!("bytes_processed", self.byte_size as u64); } } diff --git a/src/internal_events/coercer.rs b/src/internal_events/coercer.rs index ab0fdbeddf538..478d50a0d6f87 100644 --- a/src/internal_events/coercer.rs +++ b/src/internal_events/coercer.rs @@ -6,10 +6,7 @@ pub struct CoercerEventProcessed; impl InternalEvent for CoercerEventProcessed { fn emit_metrics(&self) { - counter!("events_processed", 1, - "component_kind" => "transform", - "component_type" => "coercer", - ); + counter!("events_processed", 1); } } @@ -30,10 +27,6 @@ impl<'a> InternalEvent for CoercerConversionFailed<'a> { } fn emit_metrics(&self) { - counter!("processing_errors", 1, - "component_kind" => "transform", - "component_type" => "coercer", - "error_type" => "type_conversion_failed", - ); + counter!("processing_errors", 1, "error_type" => "type_conversion_failed"); } } diff --git a/src/internal_events/concat.rs b/src/internal_events/concat.rs index db6fb14c8d6c8..66a7fdd93fb26 100644 --- a/src/internal_events/concat.rs +++ b/src/internal_events/concat.rs @@ -6,10 +6,7 @@ pub struct ConcatEventProcessed; impl InternalEvent for ConcatEventProcessed { fn emit_metrics(&self) { - counter!("events_processed", 1, - "component_kind" => "transform", - "component_type" => "add_fields", - ); + counter!("events_processed", 1); } } @@ -36,10 +33,7 @@ impl<'a> InternalEvent for ConcatSubstringError<'a> { } fn emit_metrics(&self) { - counter!("processing_errors", 1, - "component_kind" => "transform", - "component_type" => "concat", - ); + counter!("processing_errors", 1); } } diff --git a/src/internal_events/dedupe.rs b/src/internal_events/dedupe.rs index 39df178d7c76b..3c797958c9f9f 100644 --- a/src/internal_events/dedupe.rs +++ b/src/internal_events/dedupe.rs @@ -6,10 +6,7 @@ pub(crate) struct DedupeEventProcessed; impl InternalEvent for DedupeEventProcessed { fn emit_metrics(&self) { - counter!("events_processed", 1, - "component_kind" => "transform", - "component_type" => "dedupe", - ); + counter!("events_processed", 1); } } @@ -28,9 +25,6 @@ impl InternalEvent for DedupeEventDiscarded { } fn emit_metrics(&self) { - counter!("duplicate_events_discarded", 1, - "component_kind" => "transform", - "component_type" => "dedupe", - ); + counter!("duplicate_events_discarded", 1); } } diff --git a/src/internal_events/docker.rs b/src/internal_events/docker.rs index f9d4204080628..ca45c0796a7c1 100644 --- a/src/internal_events/docker.rs +++ b/src/internal_events/docker.rs @@ -19,14 +19,8 @@ impl<'a> InternalEvent for DockerEventReceived<'a> { } fn emit_metrics(&self) { - counter!("events_processed", 1, - "component_kind" => "source", - "component_name" => "docker", - ); - counter!("bytes_processed", self.byte_size as u64, - "component_kind" => "source", - "component_name" => "docker", - ); + counter!("events_processed", 1); + counter!("bytes_processed", self.byte_size as u64); } } @@ -46,10 +40,7 @@ impl<'a> InternalEvent for DockerContainerEventReceived<'a> { } fn emit_metrics(&self) { - counter!("container_events_processed", 1, - "component_kind" => "source", - "component_name" => "docker", - ); + counter!("container_events_processed", 1); } } @@ -67,10 +58,7 @@ impl<'a> InternalEvent for DockerContainerWatch<'a> { } fn emit_metrics(&self) { - counter!("containers_watched", 1, - "component_kind" => "source", - "component_name" => "docker", - ); + counter!("containers_watched", 1); } } @@ -88,10 +76,7 @@ impl<'a> InternalEvent for DockerContainerUnwatch<'a> { } fn emit_metrics(&self) { - counter!("containers_unwatched", 1, - "component_kind" => "source", - "component_name" => "docker", - ); + counter!("containers_unwatched", 1); } } @@ -112,10 +97,7 @@ impl<'a> InternalEvent for DockerCommunicationError<'a> { } fn emit_metrics(&self) { - counter!("communication_errors", 1, - "component_kind" => "source", - "component_name" => "docker", - ); + counter!("communication_errors", 1); } } @@ -136,10 +118,7 @@ impl<'a> InternalEvent for DockerContainerMetadataFetchFailed<'a> { } fn emit_metrics(&self) { - counter!("container_metadata_fetch_errors", 1, - "component_kind" => "source", - "component_name" => "docker", - ); + counter!("container_metadata_fetch_errors", 1); } } @@ -160,10 +139,7 @@ impl<'a> InternalEvent for DockerTimestampParseFailed<'a> { } fn emit_metrics(&self) { - counter!("timestamp_parse_errors", 1, - "component_kind" => "source", - "component_name" => "docker", - ); + counter!("timestamp_parse_errors", 1); } } @@ -186,9 +162,6 @@ impl<'a> InternalEvent for DockerLoggingDriverUnsupported<'a> { } fn emit_metrics(&self) { - counter!("logging_driver_errors", 1, - "component_kind" => "source", - "component_name" => "docker", - ); + counter!("logging_driver_errors", 1); } } diff --git a/src/internal_events/elasticsearch.rs b/src/internal_events/elasticsearch.rs index d80dc5928ff91..20c9d406a0ba6 100644 --- a/src/internal_events/elasticsearch.rs +++ b/src/internal_events/elasticsearch.rs @@ -14,16 +14,8 @@ impl InternalEvent for ElasticSearchEventReceived { } fn emit_metrics(&self) { - counter!( - "events_processed", 1, - "component_kind" => "sink", - "component_type" => "elasticsearch", - ); - counter!( - "bytes_processed", self.byte_size as u64, - "component_kind" => "sink", - "component_type" => "elasticsearch", - ); + counter!("events_processed", 1); + counter!("bytes_processed", self.byte_size as u64); } } @@ -42,10 +34,6 @@ impl InternalEvent for ElasticSearchMissingKeys { } fn emit_metrics(&self) { - counter!( - "missing_keys", 1, - "component_kind" => "sink", - "component_type" => "elasticsearch", - ); + counter!("missing_keys", 1); } } diff --git a/src/internal_events/file.rs b/src/internal_events/file.rs index 11ca9647b0c50..ff32beaa262f0 100644 --- a/src/internal_events/file.rs +++ b/src/internal_events/file.rs @@ -22,14 +22,10 @@ impl InternalEvent for FileEventReceived<'_> { fn emit_metrics(&self) { counter!( "events_processed", 1, - "component_kind" => "source", - "component_type" => "file", "file" => self.file.to_owned(), ); counter!( "bytes_processed", self.byte_size as u64, - "component_kind" => "source", - "component_type" => "file", "file" => self.file.to_owned(), ); } @@ -51,8 +47,6 @@ impl<'a> InternalEvent for FileChecksumFailed<'a> { fn emit_metrics(&self) { counter!( "checksum_errors", 1, - "component_kind" => "source", - "component_type" => "file", "file" => self.path.to_string_lossy().into_owned(), ); } @@ -76,8 +70,6 @@ impl<'a> InternalEvent for FileFingerprintReadFailed<'a> { fn emit_metrics(&self) { counter!( "fingerprint_read_errors", 1, - "component_kind" => "source", - "component_type" => "file", "file" => self.path.to_string_lossy().into_owned(), ); } @@ -102,8 +94,6 @@ impl<'a> InternalEvent for FileDeleteFailed<'a> { fn emit_metrics(&self) { counter!( "file_delete_errors", 1, - "component_kind" => "source", - "component_type" => "file", "file" => self.path.to_string_lossy().into_owned(), ); } @@ -125,8 +115,6 @@ impl<'a> InternalEvent for FileDeleted<'a> { fn emit_metrics(&self) { counter!( "files_deleted", 1, - "component_kind" => "source", - "component_type" => "file", "file" => self.path.to_string_lossy().into_owned(), ); } @@ -148,8 +136,6 @@ impl<'a> InternalEvent for FileUnwatched<'a> { fn emit_metrics(&self) { counter!( "files_unwatched", 1, - "component_kind" => "source", - "component_type" => "file", "file" => self.path.to_string_lossy().into_owned(), ); } @@ -173,8 +159,6 @@ impl<'a> InternalEvent for FileWatchFailed<'a> { fn emit_metrics(&self) { counter!( "file_watch_errors", 1, - "component_kind" => "source", - "component_type" => "file", "file" => self.path.to_string_lossy().into_owned(), ); } @@ -198,8 +182,6 @@ impl<'a> InternalEvent for FileResumed<'a> { fn emit_metrics(&self) { counter!( "files_resumed", 1, - "component_kind" => "source", - "component_type" => "file", "file" => self.path.to_string_lossy().into_owned(), ); } @@ -221,8 +203,6 @@ impl<'a> InternalEvent for FileAdded<'a> { fn emit_metrics(&self) { counter!( "files_added", 1, - "component_kind" => "source", - "component_type" => "file", "file" => self.path.to_string_lossy().into_owned(), ); } @@ -239,11 +219,7 @@ impl InternalEvent for FileCheckpointed { } fn emit_metrics(&self) { - counter!( - "checkpoints", self.count as u64, - "component_kind" => "source", - "component_type" => "file", - ); + counter!("checkpoints", self.count as u64); } } @@ -258,11 +234,7 @@ impl InternalEvent for FileCheckpointWriteFailed { } fn emit_metrics(&self) { - counter!( - "checkpoint_write_errors", 1, - "component_kind" => "source", - "component_type" => "file", - ); + counter!("checkpoint_write_errors", 1); } } diff --git a/src/internal_events/generator.rs b/src/internal_events/generator.rs index 62ecd511c29fb..498b60e63f30e 100644 --- a/src/internal_events/generator.rs +++ b/src/internal_events/generator.rs @@ -10,9 +10,6 @@ impl InternalEvent for GeneratorEventProcessed { } fn emit_metrics(&self) { - counter!("events_processed", 1, - "component_kind" => "source", - "component_type" => "generator", - ); + counter!("events_processed", 1); } } diff --git a/src/internal_events/grok_parser.rs b/src/internal_events/grok_parser.rs index f4ebc38da902b..d10dc45407afa 100644 --- a/src/internal_events/grok_parser.rs +++ b/src/internal_events/grok_parser.rs @@ -10,10 +10,7 @@ impl InternalEvent for GrokParserEventProcessed { } fn emit_metrics(&self) { - counter!("events_processed", 1, - "component_kind" => "transform", - "component_type" => "grok_parser", - ); + counter!("events_processed", 1); } } @@ -33,8 +30,6 @@ impl InternalEvent for GrokParserFailedMatch<'_> { fn emit_metrics(&self) { counter!("processing_errors", 1, - "component_kind" => "transform", - "component_type" => "grok_parser", "error_type" => "failed_match", ); } @@ -52,8 +47,6 @@ impl InternalEvent for GrokParserMissingField<'_> { fn emit_metrics(&self) { counter!("processing_errors", 1, - "component_kind" => "transform", - "component_type" => "grok_parser", "error_type" => "missing_field", ); } @@ -77,8 +70,6 @@ impl<'a> InternalEvent for GrokParserConversionFailed<'a> { fn emit_metrics(&self) { counter!("processing_errors", 1, - "component_kind" => "transform", - "component_type" => "grok_parser", "error_type" => "type_conversion_failed", ); } diff --git a/src/internal_events/http.rs b/src/internal_events/http.rs index b8f3fcfbc1130..8f85876ac29b1 100644 --- a/src/internal_events/http.rs +++ b/src/internal_events/http.rs @@ -17,14 +17,8 @@ impl InternalEvent for HTTPEventsReceived { } fn emit_metrics(&self) { - counter!("events_processed", self.events_count as u64, - "component_kind" => "source", - "component_type" => "http", - ); - counter!("bytes_processed", self.byte_size as u64, - "component_kind" => "source", - "component_type" => "http", - ); + counter!("events_processed", self.events_count as u64); + counter!("bytes_processed", self.byte_size as u64); } } @@ -45,10 +39,6 @@ impl<'a> InternalEvent for HTTPBadRequest<'a> { } fn emit_metrics(&self) { - counter!( - "http_bad_requests", 1, - "component_kind" => "source", - "component_type" => "http", - ); + counter!("http_bad_requests", 1); } } diff --git a/src/internal_events/journald.rs b/src/internal_events/journald.rs index 5d61d075c725d..dabdb95aecce4 100644 --- a/src/internal_events/journald.rs +++ b/src/internal_events/journald.rs @@ -12,14 +12,8 @@ impl InternalEvent for JournaldEventReceived { } fn emit_metrics(&self) { - counter!("events_processed", 1, - "component_kind" => "source", - "component_name" => "journald", - ); - counter!("bytes_processed", self.byte_size as u64, - "component_kind" => "source", - "component_name" => "journald", - ); + counter!("events_processed", 1); + counter!("bytes_processed", self.byte_size as u64); } } @@ -35,13 +29,7 @@ impl InternalEvent for JournaldInvalidRecord { } fn emit_metrics(&self) { - counter!("invalid_record", 1, - "component_kind" => "source", - "component_name" => "journald", - ); - counter!("invalid_record_bytes", self.text.len() as u64, - "component_kind" => "source", - "component_name" => "journald", - ); + counter!("invalid_record", 1); + counter!("invalid_record_bytes", self.text.len() as u64); } } diff --git a/src/internal_events/json_parser.rs b/src/internal_events/json_parser.rs index 675226fceaa70..0e29102dd27a9 100644 --- a/src/internal_events/json_parser.rs +++ b/src/internal_events/json_parser.rs @@ -12,10 +12,7 @@ impl InternalEvent for JsonParserEventProcessed { } fn emit_metrics(&self) { - counter!("events_processed", 1, - "component_kind" => "transform", - "component_type" => "json_parser", - ); + counter!("events_processed", 1); } } @@ -37,8 +34,6 @@ impl<'a> InternalEvent for JsonParserFailedParse<'a> { fn emit_metrics(&self) { counter!("processing_errors", 1, - "component_kind" => "transform", - "component_type" => "json_parser", "error_type" => "failed_parse", ); } @@ -60,8 +55,6 @@ impl<'a> InternalEvent for JsonParserTargetExists<'a> { fn emit_metrics(&self) { counter!("processing_errors", 1, - "component_kind" => "transform", - "component_type" => "json_parser", "error_type" => "target_field_exists", ); } diff --git a/src/internal_events/kafka.rs b/src/internal_events/kafka.rs index 527017ed794a8..a7f5e744ad1a4 100644 --- a/src/internal_events/kafka.rs +++ b/src/internal_events/kafka.rs @@ -12,16 +12,8 @@ impl InternalEvent for KafkaEventReceived { } fn emit_metrics(&self) { - counter!( - "events_processed", 1, - "component_kind" => "source", - "component_type" => "kafka", - ); - counter!( - "bytes_processed", self.byte_size as u64, - "component_kind" => "source", - "component_type" => "kafka", - ); + counter!("events_processed", 1); + counter!("bytes_processed", self.byte_size as u64); } } @@ -36,11 +28,7 @@ impl InternalEvent for KafkaOffsetUpdateFailed { } fn emit_metrics(&self) { - counter!( - "consumer_offset_updates_failed", 1, - "component_kind" => "source", - "component_type" => "kafka", - ); + counter!("consumer_offset_updates_failed", 1); } } @@ -55,11 +43,7 @@ impl InternalEvent for KafkaEventFailed { } fn emit_metrics(&self) { - counter!( - "events_failed", 1, - "component_kind" => "source", - "component_type" => "kafka", - ); + counter!("events_failed", 1); } } diff --git a/src/internal_events/kubernetes_logs.rs b/src/internal_events/kubernetes_logs.rs index 104356431753f..4c33473ce9976 100644 --- a/src/internal_events/kubernetes_logs.rs +++ b/src/internal_events/kubernetes_logs.rs @@ -18,16 +18,8 @@ impl InternalEvent for KubernetesLogsEventReceived<'_> { } fn emit_metrics(&self) { - counter!( - "events_processed", 1, - "component_kind" => "source", - "component_type" => "kubernetes_logs", - ); - counter!( - "bytes_processed", self.byte_size as u64, - "component_kind" => "source", - "component_type" => "kubernetes_logs", - ); + counter!("events_processed", 1); + counter!("bytes_processed", self.byte_size as u64); } } @@ -45,11 +37,7 @@ impl InternalEvent for KubernetesLogsEventAnnotationFailed<'_> { } fn emit_metrics(&self) { - counter!( - "k8s_event_annotation_failures", 1, - "component_kind" => "source", - "component_type" => "kubernetes_logs", - ); + counter!("k8s_event_annotation_failures", 1); } } @@ -67,10 +55,6 @@ impl InternalEvent for KubernetesLogsDockerFormatParseFailed<'_> { } fn emit_metrics(&self) { - counter!( - "k8s_docker_format_parse_failures", 1, - "component_kind" => "source", - "component_type" => "kubernetes_logs", - ); + counter!("k8s_docker_format_parse_failures", 1); } } diff --git a/src/internal_events/log_to_metric.rs b/src/internal_events/log_to_metric.rs index 370501ed8a1fe..b41cacbf23b19 100644 --- a/src/internal_events/log_to_metric.rs +++ b/src/internal_events/log_to_metric.rs @@ -9,10 +9,7 @@ impl InternalEvent for LogToMetricEventProcessed { } fn emit_metrics(&self) { - counter!("events_processed", 1, - "component_kind" => "transform", - "component_type" => "log_to_metric", - ); + counter!("events_processed", 1); } } @@ -25,8 +22,6 @@ impl InternalEvent for LogToMetricFieldNotFound { fn emit_metrics(&self) { counter!("processing_errors", 1, - "component_kind" => "transform", - "component_type" => "log_to_metric", "error_type" => "field_not_found", ); } @@ -43,8 +38,6 @@ impl<'a> InternalEvent for LogToMetricParseError<'a> { fn emit_metrics(&self) { counter!("processing_errors", 1, - "component_kind" => "transform", - "component_type" => "log_to_metric", "error_type" => "parse_error", ); } @@ -61,8 +54,6 @@ impl InternalEvent for LogToMetricRenderError { fn emit_metrics(&self) { counter!("processing_errors", 1, - "component_kind" => "transform", - "component_type" => "log_to_metric", "error_type" => "render_error", ); } @@ -79,8 +70,6 @@ impl InternalEvent for LogToMetricTemplateError { fn emit_metrics(&self) { counter!("processing_errors", 1, - "component_kind" => "transform", - "component_type" => "log_to_metric", "error_type" => "template_error", ); } diff --git a/src/internal_events/logplex.rs b/src/internal_events/logplex.rs index ef2a1d768e674..5ebe3a5024631 100644 --- a/src/internal_events/logplex.rs +++ b/src/internal_events/logplex.rs @@ -20,10 +20,7 @@ impl<'a> InternalEvent for HerokuLogplexRequestReceived<'a> { } fn emit_metrics(&self) { - counter!("requests_received", 1, - "component_kind" => "source", - "component_type" => "logplex", - ); + counter!("requests_received", 1); } } @@ -42,10 +39,6 @@ impl InternalEvent for HerokuLogplexRequestReadError { } fn emit_metrics(&self) { - counter!( - "request_read_errors", 1, - "component_kind" => "source", - "component_type" => "logplex", - ); + counter!("request_read_errors", 1); } } diff --git a/src/internal_events/lua.rs b/src/internal_events/lua.rs index 7488386b9ce7a..53511db4b84a7 100644 --- a/src/internal_events/lua.rs +++ b/src/internal_events/lua.rs @@ -6,10 +6,7 @@ pub struct LuaEventProcessed; impl InternalEvent for LuaEventProcessed { fn emit_metrics(&self) { - counter!("events_processed", 1, - "component_kind" => "transform", - "component_type" => "lua", - ); + counter!("events_processed", 1); } } @@ -20,10 +17,7 @@ pub struct LuaGcTriggered { impl InternalEvent for LuaGcTriggered { fn emit_metrics(&self) { - gauge!("memory_used", self.used_memory as f64, - "component_kind" => "transform", - "component_type" => "lua", - ); + gauge!("memory_used", self.used_memory as f64); } } @@ -38,10 +32,7 @@ impl InternalEvent for LuaScriptError { } fn emit_metrics(&self) { - counter!("processing_errors", 1, - "component_kind" => "transform", - "component_type" => "lua", - ); + counter!("processing_errors", 1); } } @@ -56,9 +47,6 @@ impl InternalEvent for LuaBuildError { } fn emit_metrics(&self) { - counter!("processing_errors", 1, - "component_kind" => "transform", - "component_type" => "lua", - ); + counter!("processing_errors", 1); } } diff --git a/src/internal_events/prometheus.rs b/src/internal_events/prometheus.rs index 5b55ae5610ed2..f495aa0adcf09 100644 --- a/src/internal_events/prometheus.rs +++ b/src/internal_events/prometheus.rs @@ -16,16 +16,8 @@ impl InternalEvent for PrometheusEventReceived { } fn emit_metrics(&self) { - counter!( - "events_processed", self.count as u64, - "component_kind" => "source", - "component_type" => "prometheus", - ); - counter!( - "bytes_processed", self.byte_size as u64, - "component_kind" => "source", - "component_type" => "prometheus", - ); + counter!("events_processed", self.count as u64); + counter!("bytes_processed", self.byte_size as u64); } } @@ -41,14 +33,8 @@ impl InternalEvent for PrometheusRequestCompleted { } fn emit_metrics(&self) { - counter!("requests_completed", 1, - "component_kind" => "source", - "component_type" => "prometheus", - ); - histogram!("request_duration_nanoseconds", self.end - self.start, - "component_kind" => "source", - "component_type" => "prometheus", - ); + counter!("requests_completed", 1); + histogram!("request_duration_nanoseconds", self.end - self.start); } } @@ -70,10 +56,7 @@ impl<'a> InternalEvent for PrometheusParseError<'a> { } fn emit_metrics(&self) { - counter!("parse_errors", 1, - "component_kind" => "source", - "component_type" => "prometheus", - ); + counter!("parse_errors", 1); } } @@ -89,10 +72,7 @@ impl InternalEvent for PrometheusErrorResponse { } fn emit_metrics(&self) { - counter!("http_error_response", 1, - "component_kind" => "source", - "component_type" => "prometheus", - ); + counter!("http_error_response", 1); } } @@ -108,9 +88,6 @@ impl InternalEvent for PrometheusHttpError { } fn emit_metrics(&self) { - counter!("http_request_errors", 1, - "component_kind" => "source", - "component_type" => "prometheus", - ); + counter!("http_request_errors", 1); } } diff --git a/src/internal_events/reduce.rs b/src/internal_events/reduce.rs index 22b25c0077e8a..72e4f2c8d92ee 100644 --- a/src/internal_events/reduce.rs +++ b/src/internal_events/reduce.rs @@ -6,10 +6,7 @@ pub(crate) struct ReduceEventProcessed; impl InternalEvent for ReduceEventProcessed { fn emit_metrics(&self) { - counter!("events_processed", 1, - "component_kind" => "transform", - "component_type" => "reduce", - ); + counter!("events_processed", 1); } } @@ -18,9 +15,6 @@ pub(crate) struct ReduceStaleEventFlushed; impl InternalEvent for ReduceStaleEventFlushed { fn emit_metrics(&self) { - counter!("stale_events_flushed", 1, - "component_kind" => "transform", - "component_type" => "reduce", - ); + counter!("stale_events_flushed", 1); } } diff --git a/src/internal_events/regex_parser.rs b/src/internal_events/regex_parser.rs index 1aa34323b3cd2..e1606ff15e18b 100644 --- a/src/internal_events/regex_parser.rs +++ b/src/internal_events/regex_parser.rs @@ -11,10 +11,7 @@ impl InternalEvent for RegexParserEventProcessed { } fn emit_metrics(&self) { - counter!("events_processed", 1, - "component_kind" => "transform", - "component_type" => "regex_parser", - ); + counter!("events_processed", 1); } } @@ -33,11 +30,7 @@ impl InternalEvent for RegexParserFailedMatch<'_> { } fn emit_metrics(&self) { - counter!("processing_errors", 1, - "component_kind" => "transform", - "component_type" => "regex_parser", - "error_type" => "failed_match", - ); + counter!("processing_errors", 1, "error_type" => "failed_match"); } } @@ -52,11 +45,7 @@ impl InternalEvent for RegexParserMissingField<'_> { } fn emit_metrics(&self) { - counter!("processing_errors", 1, - "component_kind" => "transform", - "component_type" => "regex_parser", - "error_type" => "missing_field", - ); + counter!("processing_errors", 1, "error_type" => "missing_field"); } } @@ -75,11 +64,7 @@ impl<'a> InternalEvent for RegexParserTargetExists<'a> { } fn emit_metrics(&self) { - counter!("processing_errors", 1, - "component_kind" => "transform", - "component_type" => "regex_parser", - "error_type" => "target_field_exists", - ); + counter!("processing_errors", 1, "error_type" => "target_field_exists"); } } @@ -100,10 +85,6 @@ impl<'a> InternalEvent for RegexParserConversionFailed<'a> { } fn emit_metrics(&self) { - counter!("processing_errors", 1, - "component_kind" => "transform", - "component_type" => "regex_parser", - "error_type" => "type_conversion_failed", - ); + counter!("processing_errors", 1, "error_type" => "type_conversion_failed"); } } diff --git a/src/internal_events/remap.rs b/src/internal_events/remap.rs index 8341bf57c9a75..42f1fe9954d0b 100644 --- a/src/internal_events/remap.rs +++ b/src/internal_events/remap.rs @@ -6,10 +6,7 @@ pub struct RemapEventProcessed; impl InternalEvent for RemapEventProcessed { fn emit_metrics(&self) { - counter!("events_processed", 1, - "component_kind" => "transform", - "component_type" => "remap", - ); + counter!("events_processed", 1); } } @@ -37,10 +34,6 @@ impl InternalEvent for RemapFailedMapping { } fn emit_metrics(&self) { - counter!("processing_error", 1, - "component_kind" => "transform", - "component_type" => "remap", - "error_type" => "failed_mapping", - ); + counter!("processing_error", 1, "error_type" => "failed_mapping"); } } diff --git a/src/internal_events/remove_fields.rs b/src/internal_events/remove_fields.rs index c2087be5dacf3..d542457ecbc8f 100644 --- a/src/internal_events/remove_fields.rs +++ b/src/internal_events/remove_fields.rs @@ -6,10 +6,7 @@ pub struct RemoveFieldsEventProcessed; impl InternalEvent for RemoveFieldsEventProcessed { fn emit_metrics(&self) { - counter!("events_processed", 1, - "component_kind" => "transform", - "component_type" => "remove_fields", - ); + counter!("events_processed", 1); } } diff --git a/src/internal_events/remove_tags.rs b/src/internal_events/remove_tags.rs index 3ce133ab2319d..00e6be0469068 100644 --- a/src/internal_events/remove_tags.rs +++ b/src/internal_events/remove_tags.rs @@ -6,9 +6,6 @@ pub struct RemoveTagsEventProcessed; impl InternalEvent for RemoveTagsEventProcessed { fn emit_metrics(&self) { - counter!("events_processed", 1, - "component_kind" => "transform", - "component_type" => "remove_tags", - ); + counter!("events_processed", 1); } } diff --git a/src/internal_events/rename_fields.rs b/src/internal_events/rename_fields.rs index b1db0146ccb79..936d59578e536 100644 --- a/src/internal_events/rename_fields.rs +++ b/src/internal_events/rename_fields.rs @@ -6,10 +6,7 @@ pub struct RenameFieldsEventProcessed; impl InternalEvent for RenameFieldsEventProcessed { fn emit_metrics(&self) { - counter!("events_processed", 1, - "component_kind" => "transform", - "component_type" => "rename_fields", - ); + counter!("events_processed", 1); } } diff --git a/src/internal_events/sampler.rs b/src/internal_events/sampler.rs index 9e1db7ceb2b5d..4809cf463f83f 100644 --- a/src/internal_events/sampler.rs +++ b/src/internal_events/sampler.rs @@ -6,10 +6,7 @@ pub struct SamplerEventProcessed; impl InternalEvent for SamplerEventProcessed { fn emit_metrics(&self) { - counter!("events_processed", 1, - "component_kind" => "transform", - "component_type" => "sampler", - ); + counter!("events_processed", 1); } } @@ -18,9 +15,6 @@ pub struct SamplerEventDiscarded; impl InternalEvent for SamplerEventDiscarded { fn emit_metrics(&self) { - counter!("events_discarded", 1, - "component_kind" => "transform", - "component_type" => "sampler", - ); + counter!("events_discarded", 1); } } diff --git a/src/internal_events/socket.rs b/src/internal_events/socket.rs index feec7cccfbc50..35b597af1f785 100644 --- a/src/internal_events/socket.rs +++ b/src/internal_events/socket.rs @@ -30,16 +30,8 @@ impl InternalEvent for SocketEventReceived { } fn emit_metrics(&self) { - counter!("events_processed", 1, - "component_kind" => "source", - "component_type" => "socket", - "mode" => self.mode.as_str(), - ); - counter!("bytes_processed", self.byte_size as u64, - "component_kind" => "source", - "component_type" => "socket", - "mode" => self.mode.as_str(), - ); + counter!("events_processed", 1, "mode" => self.mode.as_str()); + counter!("bytes_processed", self.byte_size as u64, "mode" => self.mode.as_str()); } } @@ -55,10 +47,6 @@ impl InternalEvent for SocketReceiveError { } fn emit_metrics(&self) { - counter!("socket_errors", 1, - "component_kind" => "source", - "component_type" => "socket", - "mode" => self.mode.as_str(), - ); + counter!("socket_errors", 1, "mode" => self.mode.as_str()); } } diff --git a/src/internal_events/split.rs b/src/internal_events/split.rs index 636887f72162f..f969b4c4546a7 100644 --- a/src/internal_events/split.rs +++ b/src/internal_events/split.rs @@ -7,10 +7,7 @@ pub struct SplitEventProcessed; impl InternalEvent for SplitEventProcessed { fn emit_metrics(&self) { - counter!("events_processed", 1, - "component_kind" => "transform", - "component_type" => "split", - ); + counter!("events_processed", 1); } } @@ -29,11 +26,7 @@ impl<'a> InternalEvent for SplitFieldMissing<'a> { } fn emit_metrics(&self) { - counter!("processing_errors", 1, - "component_kind" => "transform", - "component_type" => "split", - "error_type" => "field_missing", - ); + counter!("processing_errors", 1, "error_type" => "field_missing"); } } @@ -54,10 +47,6 @@ impl<'a> InternalEvent for SplitConvertFailed<'a> { } fn emit_metrics(&self) { - counter!("processing_errors", 1, - "component_kind" => "transform", - "component_type" => "split", - "error_type" => "convert_failed", - ); + counter!("processing_errors", 1, "error_type" => "convert_failed"); } } diff --git a/src/internal_events/splunk_hec.rs b/src/internal_events/splunk_hec.rs index 4b36041038dd2..061f4485eb46a 100644 --- a/src/internal_events/splunk_hec.rs +++ b/src/internal_events/splunk_hec.rs @@ -13,16 +13,8 @@ pub(crate) struct SplunkEventSent { impl InternalEvent for SplunkEventSent { fn emit_metrics(&self) { - counter!( - "events_processed", 1, - "component_kind" => "sink", - "component_type" => "splunk_hec", - ); - counter!( - "bytes_processed", self.byte_size as u64, - "component_kind" => "sink", - "component_type" => "splunk_hec", - ); + counter!("events_processed", 1); + counter!("bytes_processed", self.byte_size as u64); } } @@ -41,11 +33,7 @@ impl InternalEvent for SplunkEventEncodeError { } fn emit_metrics(&self) { - counter!( - "encode_errors", 1, - "component_kind" => "sink", - "component_type" => "splunk_hec", - ); + counter!("encode_errors", 1); } } @@ -64,11 +52,7 @@ impl InternalEvent for SplunkSourceTypeMissingKeys { } fn emit_metrics(&self) { - counter!( - "sourcetype_missing_keys", 1, - "component_kind" => "sink", - "component_type" => "splunk_hec", - ); + counter!("sourcetype_missing_keys", 1); } } @@ -87,11 +71,7 @@ impl InternalEvent for SplunkSourceMissingKeys { } fn emit_metrics(&self) { - counter!( - "source_missing_keys", 1, - "component_kind" => "sink", - "component_type" => "splunk_hec", - ); + counter!("source_missing_keys", 1); } } @@ -110,11 +90,7 @@ mod source { } fn emit_metrics(&self) { - counter!( - "events_processed", 1, - "component_kind" => "source", - "component_type" => "splunk_hec", - ); + counter!("events_processed", 1); } } @@ -133,11 +109,7 @@ mod source { } fn emit_metrics(&self) { - counter!( - "request_received", 1, - "component_kind" => "source", - "component_type" => "splunk_hec", - ); + counter!("request_received", 1); } } @@ -173,11 +145,7 @@ mod source { } fn emit_metrics(&self) { - counter!( - "request_errors", 1, - "component_kind" => "source", - "component_type" => "splunk_hec", - ); + counter!("request_errors", 1); } } } diff --git a/src/internal_events/statsd.rs b/src/internal_events/statsd.rs index 998d1e688e01d..d1e56eaa5cdd1 100644 --- a/src/internal_events/statsd.rs +++ b/src/internal_events/statsd.rs @@ -12,16 +12,8 @@ impl InternalEvent for StatsdEventReceived { } fn emit_metrics(&self) { - counter!( - "events_processed", 1, - "component_kind" => "source", - "component_name" => "statsd", - ); - counter!( - "bytes_processed", self.byte_size as u64, - "component_kind" => "source", - "component_name" => "statsd", - ); + counter!("events_processed", 1,); + counter!("bytes_processed", self.byte_size as u64,); } } @@ -37,16 +29,8 @@ impl InternalEvent for StatsdInvalidRecord<'_> { } fn emit_metrics(&self) { - counter!( - "invalid_record", 1, - "component_kind" => "source", - "component_name" => "statsd", - ); - counter!( - "invalid_record_bytes", self.text.len() as u64, - "component_kind" => "source", - "component_name" => "statsd", - ); + counter!("invalid_record", 1,); + counter!("invalid_record_bytes", self.text.len() as u64,); } } @@ -86,10 +70,6 @@ impl InternalEvent for StatsdSocketError } fn emit_metrics(&self) { - counter!( - "socket_errors", 1, - "component_kind" => "source", - "component_type" => "statsd", - ); + counter!("socket_errors", 1); } } diff --git a/src/internal_events/stdin.rs b/src/internal_events/stdin.rs index 8f31ce35213a6..d6c8f6c44d110 100644 --- a/src/internal_events/stdin.rs +++ b/src/internal_events/stdin.rs @@ -12,16 +12,8 @@ impl InternalEvent for StdinEventReceived { } 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", - ); + counter!("events_processed", 1); + counter!("bytes_processed", self.byte_size as u64); } } @@ -36,10 +28,6 @@ impl InternalEvent for StdinReadFailed { } fn emit_metrics(&self) { - counter!( - "stdin_reads_failed", 1, - "component_kind" => "source", - "component_type" => "stdin", - ); + counter!("stdin_reads_failed", 1); } } diff --git a/src/internal_events/swimlanes.rs b/src/internal_events/swimlanes.rs index 073c06a70d1ed..f30b2929b5089 100644 --- a/src/internal_events/swimlanes.rs +++ b/src/internal_events/swimlanes.rs @@ -6,10 +6,7 @@ pub struct SwimlanesEventProcessed; impl InternalEvent for SwimlanesEventProcessed { fn emit_metrics(&self) { - counter!("events_processed", 1, - "component_kind" => "transform", - "component_type" => "swimlanes", - ); + counter!("events_processed", 1); } } @@ -18,9 +15,6 @@ pub struct SwimlanesEventDiscarded; impl InternalEvent for SwimlanesEventDiscarded { fn emit_metrics(&self) { - counter!("events_discarded", 1, - "component_kind" => "transform", - "component_type" => "swimlanes", - ); + counter!("events_discarded", 1); } } diff --git a/src/internal_events/syslog.rs b/src/internal_events/syslog.rs index ba3d293ffb2b2..896752271073c 100644 --- a/src/internal_events/syslog.rs +++ b/src/internal_events/syslog.rs @@ -12,14 +12,8 @@ impl InternalEvent for SyslogEventReceived { } fn emit_metrics(&self) { - counter!("events_processed", 1, - "component_kind" => "source", - "component_type" => "syslog", - ); - counter!("bytes_processed", self.byte_size as u64, - "component_kind" => "source", - "component_type" => "syslog", - ); + counter!("events_processed", 1); + counter!("bytes_processed", self.byte_size as u64); } } @@ -34,11 +28,7 @@ impl InternalEvent for SyslogUdpReadError { } fn emit_metrics(&self) { - counter!("udp_read_errors", 1, - "component_kind" => "source", - "component_type" => "syslog", - "mode" => "udp", - ); + counter!("udp_read_errors", 1, "mode" => "udp"); } } @@ -53,10 +43,6 @@ impl InternalEvent for SyslogUdpUtf8Error { } fn emit_metrics(&self) { - counter!("udp_utf8_convert_errors", 1, - "component_kind" => "source", - "component_type" => "syslog", - "mode" => "udp", - ); + counter!("udp_utf8_convert_errors", 1, "mode" => "udp"); } } diff --git a/src/internal_events/tag_cardinality_limit.rs b/src/internal_events/tag_cardinality_limit.rs index 62ba517b7dbf8..c47ed3507ba54 100644 --- a/src/internal_events/tag_cardinality_limit.rs +++ b/src/internal_events/tag_cardinality_limit.rs @@ -9,10 +9,7 @@ impl InternalEvent for TagCardinalityLimitEventProcessed { } fn emit_metrics(&self) { - counter!("events_processed", 1, - "component_kind" => "transform", - "component_type" => "tag_cardinality_limit", - ); + counter!("events_processed", 1); } } @@ -32,10 +29,7 @@ impl<'a> InternalEvent for TagCardinalityLimitRejectingEvent<'a> { } fn emit_metrics(&self) { - counter!("tag_value_limit_exceeded", 1, - "component_kind" => "transform", - "component_type" => "tag_cardinality_limit", - ); + counter!("tag_value_limit_exceeded", 1); } } @@ -55,10 +49,7 @@ impl<'a> InternalEvent for TagCardinalityLimitRejectingTag<'a> { } fn emit_metrics(&self) { - counter!("tag_value_limit_exceeded", 1, - "component_kind" => "transform", - "component_type" => "tag_cardinality_limit", - ); + counter!("tag_value_limit_exceeded", 1); } } @@ -75,9 +66,6 @@ impl<'a> InternalEvent for TagCardinalityValueLimitReached<'a> { } fn emit_metrics(&self) { - counter!("value_limit_reached", 1, - "component_kind" => "transform", - "component_type" => "tag_cardinality_limit", - ); + counter!("value_limit_reached", 1); } } diff --git a/src/internal_events/tcp.rs b/src/internal_events/tcp.rs index 7e54a513d84ad..81bfcbe3e0013 100644 --- a/src/internal_events/tcp.rs +++ b/src/internal_events/tcp.rs @@ -16,9 +16,7 @@ impl InternalEvent for TcpConnectionEstablished { } fn emit_metrics(&self) { - counter!("tcp_connections_established", 1, - "component_kind" => "sink", - ); + counter!("tcp_connections_established", 1); } } @@ -33,9 +31,7 @@ impl InternalEvent for TcpConnectionFailed { } fn emit_metrics(&self) { - counter!("tcp_connections_failed", 1, - "component_kind" => "sink", - ); + counter!("tcp_connections_failed", 1); } } @@ -50,9 +46,7 @@ impl InternalEvent for TcpConnectionDisconnected { } fn emit_metrics(&self) { - counter!("tcp_connections_disconnected", 1, - "component_kind" => "sink", - ); + counter!("tcp_connections_disconnected", 1); } } @@ -65,11 +59,7 @@ impl InternalEvent for TcpConnectionShutdown { } fn emit_metrics(&self) { - counter!("tcp_connection_shutdown", 1, - "component_kind" => "sink", - "component_type" => "socket", - "mode" => "tcp", - ); + counter!("tcp_connection_shutdown", 1, "mode" => "tcp"); } } @@ -84,9 +74,7 @@ impl InternalEvent for TcpConnectionErro } fn emit_metrics(&self) { - counter!("tcp_connection_errors", 1, - "component_kind" => "source", - ); + counter!("tcp_connection_errors", 1); } } @@ -101,9 +89,7 @@ impl InternalEvent for TcpFlushError { } fn emit_metrics(&self) { - counter!("tcp_flush_errors", 1, - "component_kind" => "sink", - ); + counter!("tcp_flush_errors", 1); } } @@ -118,11 +104,7 @@ impl InternalEvent for TcpEventSent { } fn emit_metrics(&self) { - counter!("events_processed", 1, - "component_kind" => "sink", - ); - counter!("bytes_processed", self.byte_size as u64, - "component_kind" => "sink", - ); + counter!("events_processed", 1); + counter!("bytes_processed", self.byte_size as u64); } } diff --git a/src/internal_events/tokenizer.rs b/src/internal_events/tokenizer.rs index e72944ff9b18b..6117e7d109bc2 100644 --- a/src/internal_events/tokenizer.rs +++ b/src/internal_events/tokenizer.rs @@ -7,10 +7,7 @@ pub(crate) struct TokenizerEventProcessed; impl InternalEvent for TokenizerEventProcessed { fn emit_metrics(&self) { - counter!("events_processed", 1, - "component_kind" => "transform", - "component_type" => "tokenizer", - ); + counter!("events_processed", 1); } } @@ -29,11 +26,7 @@ impl<'a> InternalEvent for TokenizerFieldMissing<'a> { } fn emit_metrics(&self) { - counter!("processing_errors", 1, - "component_kind" => "transform", - "component_type" => "tokenizer", - "error_type" => "field_missing", - ); + counter!("processing_errors", 1, "error_type" => "field_missing"); } } @@ -54,10 +47,6 @@ impl<'a> InternalEvent for TokenizerConvertFailed<'a> { } fn emit_metrics(&self) { - counter!("processing_errors", 1, - "component_kind" => "transform", - "component_type" => "tokenizer", - "error_type" => "convert_failed", - ); + counter!("processing_errors", 1, "error_type" => "convert_failed"); } } diff --git a/src/internal_events/unix.rs b/src/internal_events/unix.rs index 2336106facbcb..f80a9cd9457e2 100644 --- a/src/internal_events/unix.rs +++ b/src/internal_events/unix.rs @@ -12,9 +12,7 @@ impl InternalEvent for UnixSocketConnectionEstablished<'_> { } fn emit_metrics(&self) { - counter!("unix_socket_connections_established", 1, - "component_kind" => "sink", - ); + counter!("unix_socket_connections_established", 1); } } @@ -34,9 +32,7 @@ impl InternalEvent for UnixSocketConnectionFailure<'_> { } fn emit_metrics(&self) { - counter!("unix_socket_connection_failures", 1, - "component_kind" => "sink", - ); + counter!("unix_socket_connection_failures", 1); } } @@ -69,15 +65,7 @@ pub struct UnixSocketEventSent { impl InternalEvent for UnixSocketEventSent { fn emit_metrics(&self) { - counter!("events_processed", 1, - "component_kind" => "sink", - "component_type" => "socket", - "mode" => "unix", - ); - counter!("bytes_processed", self.byte_size as u64, - "component_kind" => "sink", - "component_type" => "socket", - "mode" => "unix", - ); + counter!("events_processed", 1, "mode" => "unix"); + counter!("bytes_processed", self.byte_size as u64, "mode" => "unix"); } } diff --git a/src/internal_events/vector.rs b/src/internal_events/vector.rs index 67f3ad67ca32d..70b9cf0386706 100644 --- a/src/internal_events/vector.rs +++ b/src/internal_events/vector.rs @@ -9,16 +9,8 @@ pub struct VectorEventSent { impl InternalEvent for VectorEventSent { fn emit_metrics(&self) { - counter!( - "events_processed", 1, - "component_kind" => "sink", - "component_type" => "vector", - ); - counter!( - "bytes_processed", self.byte_size as u64, - "component_kind" => "sink", - "component_type" => "vector", - ); + counter!("events_processed", 1); + counter!("bytes_processed", self.byte_size as u64); } } @@ -29,20 +21,12 @@ pub struct VectorEventReceived { impl InternalEvent for VectorEventReceived { fn emit_logs(&self) { - trace!(message = "Received one event.",); + trace!(message = "Received one event."); } fn emit_metrics(&self) { - counter!( - "events_processed", 1, - "component_kind" => "source", - "component_type" => "vector", - ); - counter!( - "bytes_processed", self.byte_size as u64, - "component_kind" => "source", - "component_type" => "vector", - ); + counter!("events_processed", 1); + counter!("bytes_processed", self.byte_size as u64); } } @@ -57,10 +41,6 @@ impl InternalEvent for VectorProtoDecodeError { } fn emit_metrics(&self) { - counter!( - "protobuf_decode_errors", 1, - "component_kind" => "source", - "component_type" => "vector", - ); + counter!("protobuf_decode_errors", 1); } } From 5b751cfefff24f924cb85cf4c74c053e9ccbcd24 Mon Sep 17 00:00:00 2001 From: MOZGIII Date: Fri, 9 Oct 2020 08:45:45 +0300 Subject: [PATCH 3/3] Update the internal metrics invocations after the merge Signed-off-by: MOZGIII --- src/internal_events/console.rs | 7 +------ src/internal_events/host_metrics.rs | 6 +----- src/internal_events/metric_to_log.rs | 11 ++--------- src/internal_events/statsd_sink.rs | 7 +------ src/internal_events/udp.rs | 3 +-- src/internal_events/wasm/compilation.rs | 3 +-- src/internal_events/wasm/event_processing.rs | 9 +++------ src/internal_events/wasm/hostcall.rs | 3 +-- 8 files changed, 11 insertions(+), 38 deletions(-) diff --git a/src/internal_events/console.rs b/src/internal_events/console.rs index 6684b75f1659f..b8c002f920b29 100644 --- a/src/internal_events/console.rs +++ b/src/internal_events/console.rs @@ -16,11 +16,6 @@ impl<'a> InternalEvent for ConsoleFieldNotFound<'a> { } fn emit_metrics(&self) { - counter!( - "processing_errors", 1, - "component_kind" => "sink", - "component_type" => "console", - "error_type" => "field_not_found", - ); + counter!("processing_errors", 1, "error_type" => "field_not_found"); } } diff --git a/src/internal_events/host_metrics.rs b/src/internal_events/host_metrics.rs index 6a0dbaf00f467..cb3ff7b99d78a 100644 --- a/src/internal_events/host_metrics.rs +++ b/src/internal_events/host_metrics.rs @@ -12,10 +12,6 @@ impl InternalEvent for HostMetricsEventReceived { } fn emit_metrics(&self) { - counter!( - "events_processed", self.count as u64, - "component_kind" => "source", - "component_type" => "host_metrics", - ); + counter!("events_processed", self.count as u64); } } diff --git a/src/internal_events/metric_to_log.rs b/src/internal_events/metric_to_log.rs index 0374acf585d95..85e107f35ae30 100644 --- a/src/internal_events/metric_to_log.rs +++ b/src/internal_events/metric_to_log.rs @@ -11,10 +11,7 @@ impl InternalEvent for MetricToLogEventProcessed { } fn emit_metrics(&self) { - counter!("events_processed", 1, - "component_kind" => "transform", - "component_type" => "metric_to_log", - ); + counter!("events_processed", 1); } } @@ -33,10 +30,6 @@ impl<'a> InternalEvent for MetricToLogFailedSerialize { } fn emit_metrics(&self) { - counter!("processing_errors", 1, - "component_kind" => "transform", - "component_type" => "metric_to_log", - "error_type" => "failed_serialize", - ); + counter!("processing_errors", 1, "error_type" => "failed_serialize"); } } diff --git a/src/internal_events/statsd_sink.rs b/src/internal_events/statsd_sink.rs index 44b36e0d25c71..150092329fddd 100644 --- a/src/internal_events/statsd_sink.rs +++ b/src/internal_events/statsd_sink.rs @@ -19,11 +19,6 @@ impl<'a> InternalEvent for StatsdInvalidMetricReceived<'a> { } fn emit_metrics(&self) { - counter!( - "processing_errors", 1, - "component_kind" => "sink", - "component_type" => "statsd", - "error_type" => "invalid_metric", - ); + counter!("processing_errors", 1, "error_type" => "invalid_metric"); } } diff --git a/src/internal_events/udp.rs b/src/internal_events/udp.rs index 5fcad3c446774..12573a3d76d1d 100644 --- a/src/internal_events/udp.rs +++ b/src/internal_events/udp.rs @@ -19,7 +19,6 @@ impl InternalEvent for UdpSendIncomplete { } fn emit_metrics(&self) { - counter!("udp_send_errors", 1, - "component_kind" => "sink"); + counter!("udp_send_errors", 1); } } diff --git a/src/internal_events/wasm/compilation.rs b/src/internal_events/wasm/compilation.rs index 46fbfba9e0f2e..b2a72eeda08b9 100644 --- a/src/internal_events/wasm/compilation.rs +++ b/src/internal_events/wasm/compilation.rs @@ -75,8 +75,7 @@ impl InternalEvent for WasmCompilationProgress { fn emit_metrics(&self) { counter!("wasm_compilation", 1, - "component_kind" => self.role.as_const_str(), - "component_type" => "wasm", + "component_role" => self.role.as_const_str(), "state" => self.state.as_const_str(), ); } diff --git a/src/internal_events/wasm/event_processing.rs b/src/internal_events/wasm/event_processing.rs index 04074a6477ccf..a5148b3b007db 100644 --- a/src/internal_events/wasm/event_processing.rs +++ b/src/internal_events/wasm/event_processing.rs @@ -67,18 +67,15 @@ impl InternalEvent for EventProcessingProgress { fn emit_metrics(&self) { counter!("wasm_event_processing", 1, - "component_kind" => self.role.as_const_str(), - "component_type" => "wasm", + "component_role" => self.role.as_const_str(), "state" => self.state.as_const_str(), ); match self.state { State::Completed => counter!("events_processed", 1, - "component_kind" => self.role.as_const_str(), - "component_type" => "wasm", + "component_role" => self.role.as_const_str(), ), State::Errored => counter!("processing_errors", 1, - "component_kind" => self.role.as_const_str(), - "component_type" => "wasm", + "component_role" => self.role.as_const_str(), ), _ => (), } diff --git a/src/internal_events/wasm/hostcall.rs b/src/internal_events/wasm/hostcall.rs index fd239b17a1bc3..64d223fd68885 100644 --- a/src/internal_events/wasm/hostcall.rs +++ b/src/internal_events/wasm/hostcall.rs @@ -72,8 +72,7 @@ impl InternalEvent for WasmHostcallProgress { fn emit_metrics(&self) { counter!("wasm_hostcall", 1, - "component_kind" => self.role.as_const_str(), - "component_type" => "wasm", + "component_role" => self.role.as_const_str(), "state" => self.state.as_const_str(), "call" => self.call, );