Skip to content

Commit

Permalink
enhancement(source metrics): Adding a histogram for event byte size (#…
Browse files Browse the repository at this point in the history
…19686)

* Adding a histogram for event byte size. Useful when debugging low-level sources like UDP, TCP sockets

* Adding documentation and fixing CI

* fixing things up

* Making sure only low-level sources have event size histograms (especially those based on UDP).

* Add docs fixes

* cargo fmt

* fixup
  • Loading branch information
pabloem authored Apr 11, 2024
1 parent 7d7b1a2 commit f1439bc
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 1 deletion.
7 changes: 7 additions & 0 deletions changelog.d/19686_element_size_histogram.enhancement.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Added a new histogram metric, `component_received_bytes`, that measures the byte-size of individual events received by the following sources:

- `socket`
- `statsd`
- `syslog`

authors: pabloem
4 changes: 3 additions & 1 deletion src/internal_events/socket.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use metrics::counter;
use metrics::{counter, histogram};
use vector_lib::internal_event::{ComponentEventsDropped, InternalEvent, UNINTENTIONAL};
use vector_lib::{
internal_event::{error_stage, error_type},
Expand Down Expand Up @@ -40,6 +40,7 @@ impl InternalEvent for SocketBytesReceived {
"component_received_bytes_total", self.byte_size as u64,
"protocol" => protocol,
);
histogram!("component_received_bytes", self.byte_size as f64);
}
}

Expand All @@ -61,6 +62,7 @@ impl InternalEvent for SocketEventsReceived {
);
counter!("component_received_events_total", self.count as u64, "mode" => mode);
counter!("component_received_event_bytes_total", self.byte_size.get() as u64, "mode" => mode);
histogram!("component_received_bytes", self.byte_size.get() as f64, "mode" => mode);
}
}

Expand Down
6 changes: 6 additions & 0 deletions website/cue/reference/components/sources/internal_metrics.cue
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,12 @@ components: sources: internal_metrics: {
default_namespace: "vector"
tags: component_received_events_total.tags
}
component_received_bytes: {
description: string | *"The size in bytes of each event received by the source."
type: "histogram"
default_namespace: "vector"
tags: component_received_events_total.tags
}
component_received_events_total: {
description: """
The number of events accepted by this component either from tagged
Expand Down
1 change: 1 addition & 0 deletions website/cue/reference/components/sources/socket.cue
Original file line number Diff line number Diff line change
Expand Up @@ -114,5 +114,6 @@ components: sources: socket: {
connection_established_total: components.sources.internal_metrics.output.metrics.connection_established_total
connection_send_errors_total: components.sources.internal_metrics.output.metrics.connection_send_errors_total
connection_shutdown_total: components.sources.internal_metrics.output.metrics.connection_shutdown_total
component_received_bytes: components.sources.internal_metrics.output.metrics.component_received_bytes
}
}
3 changes: 3 additions & 0 deletions website/cue/reference/components/sources/statsd.cue
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,7 @@ components: sources: statsd: {
"""
}
}
telemetry: metrics: {
component_received_bytes: components.sources.internal_metrics.output.metrics.component_received_bytes
}
}
1 change: 1 addition & 0 deletions website/cue/reference/components/sources/syslog.cue
Original file line number Diff line number Diff line change
Expand Up @@ -213,5 +213,6 @@ components: sources: syslog: {
telemetry: metrics: {
connection_read_errors_total: components.sources.internal_metrics.output.metrics.connection_read_errors_total
utf8_convert_errors_total: components.sources.internal_metrics.output.metrics.utf8_convert_errors_total
component_received_bytes: components.sources.internal_metrics.output.metrics.component_received_bytes
}
}

0 comments on commit f1439bc

Please sign in to comment.