From a1e39adc15ba9dbd6e2c640ba24cbe7cfa5ffdf8 Mon Sep 17 00:00:00 2001 From: Doug Smith Date: Fri, 10 Nov 2023 18:43:55 -0500 Subject: [PATCH] fix(sinks): use uncompressed body size for bytes sent (#19060) * fix(sinks): use uncompressed body size for bytes sent * also http service * add upgrade guide entry --- src/sinks/appsignal/service.rs | 2 +- src/sinks/datadog/metrics/service.rs | 2 +- src/sinks/greptimedb/service.rs | 2 +- src/sinks/statsd/service.rs | 2 +- src/sinks/util/http.rs | 3 +-- .../en/highlights/2023-12-19-0-35-0-upgrade-guide.md | 6 ++++++ 6 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/sinks/appsignal/service.rs b/src/sinks/appsignal/service.rs index ce6aad1e688f3..0944eae962dc6 100644 --- a/src/sinks/appsignal/service.rs +++ b/src/sinks/appsignal/service.rs @@ -73,7 +73,7 @@ impl Service for AppsignalService { Box::pin(async move { let metadata = std::mem::take(request.metadata_mut()); http_service.ready().await?; - let bytes_sent = metadata.request_wire_size(); + let bytes_sent = metadata.request_encoded_size(); let event_byte_size = metadata.into_events_estimated_json_encoded_byte_size(); let http_response = http_service.call(request).await?; let event_status = if http_response.is_successful() { diff --git a/src/sinks/datadog/metrics/service.rs b/src/sinks/datadog/metrics/service.rs index 85f5fdc47fb2e..27d98d90369ba 100644 --- a/src/sinks/datadog/metrics/service.rs +++ b/src/sinks/datadog/metrics/service.rs @@ -142,7 +142,7 @@ impl DriverResponse for DatadogMetricsResponse { } fn bytes_sent(&self) -> Option { - Some(self.request_metadata.request_wire_size()) + Some(self.request_metadata.request_encoded_size()) } } diff --git a/src/sinks/greptimedb/service.rs b/src/sinks/greptimedb/service.rs index 6045ed2ff2271..c12d25d227a05 100644 --- a/src/sinks/greptimedb/service.rs +++ b/src/sinks/greptimedb/service.rs @@ -93,7 +93,7 @@ impl DriverResponse for GreptimeDBBatchOutput { } fn bytes_sent(&self) -> Option { - Some(self.metadata.request_wire_size()) + Some(self.metadata.request_encoded_size()) } } diff --git a/src/sinks/statsd/service.rs b/src/sinks/statsd/service.rs index 8acd729685360..f3e322b731195 100644 --- a/src/sinks/statsd/service.rs +++ b/src/sinks/statsd/service.rs @@ -54,7 +54,7 @@ impl DriverResponse for StatsdResponse { } fn bytes_sent(&self) -> Option { - Some(self.metadata.request_wire_size()) + Some(self.metadata.request_encoded_size()) } } diff --git a/src/sinks/util/http.rs b/src/sinks/util/http.rs index 8508f18acdbb3..168cc95d8151c 100644 --- a/src/sinks/util/http.rs +++ b/src/sinks/util/http.rs @@ -745,11 +745,10 @@ where fn call(&mut self, mut request: HttpRequest) -> Self::Future { let mut http_service = self.batch_service.clone(); - let raw_byte_size = request.payload.len(); - // NOTE: By taking the metadata here, when passing the request to `call()` below, // that function does not have access to the metadata anymore. let metadata = std::mem::take(request.metadata_mut()); + let raw_byte_size = metadata.request_encoded_size(); let events_byte_size = metadata.into_events_estimated_json_encoded_byte_size(); Box::pin(async move { diff --git a/website/content/en/highlights/2023-12-19-0-35-0-upgrade-guide.md b/website/content/en/highlights/2023-12-19-0-35-0-upgrade-guide.md index 22592e25a92ab..2b3ecd24d66f8 100644 --- a/website/content/en/highlights/2023-12-19-0-35-0-upgrade-guide.md +++ b/website/content/en/highlights/2023-12-19-0-35-0-upgrade-guide.md @@ -15,6 +15,7 @@ Vector's 0.35.0 release includes **deprecations**: and **potentially impactful changes**: +1. [Update `component_sent_bytes_total` to correctly report uncompressed bytes for all sinks](#component-sent-bytes-total) 1. [Update `component_received_bytes_total` to correctly report decompressed bytes for all sources](#component-received-bytes-total) We cover them below to help you upgrade quickly: @@ -33,6 +34,11 @@ existing behavior. In the next release, the config option will be updated to def ### Potentially impactful changes +#### Update `component_sent_bytes_total` to correctly report uncompressed bytes for all sinks {#component-sent-bytes-total} + +The AppSignal, Datadog Metrics, GreptimeDB, GCP Cloud Monitoring, Honeycomb, and HTTP sinks now correctly +report uncompressed bytes, rather than compressed bytes, for the `component_sent_bytes_total` internal metric. + #### Update `component_received_bytes_total` to correctly report decompressed bytes for all sources {#component-received-bytes-total} The Heroku Logs, HTTP Server, Prometheus Remote Write, and Splunk HEC sources now correctly report decompressed bytes,