From 19ca4c123abe87f267ad9806dde65253931990fc Mon Sep 17 00:00:00 2001 From: Julio Gonzalez Date: Mon, 27 May 2024 11:37:02 +0200 Subject: [PATCH] Solve comments. * Avoid sending tags for submitted_payloads, active_sessions and memory_usage. * Comment code managing trace_api_bytes as there is no suppor it. * Add status code to HTTP error logs. * Define constants for for literals. * Replace 'trace-chunk-*' for 'trace-chunks-*. --- sidecar/src/self_telemetry.rs | 49 +++++++++++++++++++---------------- 1 file changed, 26 insertions(+), 23 deletions(-) diff --git a/sidecar/src/self_telemetry.rs b/sidecar/src/self_telemetry.rs index 74498be9a..1901a660b 100644 --- a/sidecar/src/self_telemetry.rs +++ b/sidecar/src/self_telemetry.rs @@ -27,9 +27,10 @@ struct MetricData<'a> { trace_api_requests: ContextKey, trace_api_responses: ContextKey, trace_api_errors: ContextKey, - trace_api_bytes: ContextKey, - trace_chunk_sent: ContextKey, - trace_chunk_dropped: ContextKey, + // TODO: APMSP-1157 - Enable this metric when support is enabled. + // trace_api_bytes: ContextKey, + trace_chunks_sent: ContextKey, + trace_chunks_dropped: ContextKey, } impl<'a> MetricData<'a> { async fn send(&self, key: ContextKey, value: f64, tags: Vec) { @@ -111,23 +112,24 @@ impl<'a> MetricData<'a> { ], )); } - if trace_metrics.bytes_sent > 0 { - futures.push(self.send( - self.trace_api_bytes, - trace_metrics.bytes_sent as f64, - vec![Tag::new("src_library", "libdatadog").unwrap()], - )); - } + // TODO: APMSP-1157 - Enable this metric when support is enabled. + // if trace_metrics.bytes_sent > 0 { + // futures.push(self.send( + // self.trace_api_bytes, + // trace_metrics.bytes_sent as f64, + // vec![Tag::new("src_library", "libdatadog").unwrap()], + // )); + // } if trace_metrics.chunks_sent > 0 { futures.push(self.send( - self.trace_chunk_sent, + self.trace_chunks_sent, trace_metrics.chunks_sent as f64, vec![Tag::new("src_library", "libdatadog").unwrap()], )); } if trace_metrics.chunks_dropped > 0 { futures.push(self.send( - self.trace_chunk_dropped, + self.trace_chunks_dropped, trace_metrics.chunks_dropped as f64, vec![Tag::new("src_library", "libdatadog").unwrap()], )); @@ -256,22 +258,23 @@ impl SelfTelemetry { true, MetricNamespace::Tracers, ), - trace_api_bytes: worker.register_metric_context( - "trace_api_bytes".to_string(), - vec![], - MetricType::Count, - true, - MetricNamespace::Tracers, - ), - trace_chunk_sent: worker.register_metric_context( - "trace_chunk_sent".to_string(), + // TODO: APMSP-1157 - Enable this metric when support is enabled. + // trace_api_bytes: worker.register_metric_context( + // "trace_api_bytes".to_string(), + // vec![], + // MetricType::Distribution, + // true, + // MetricNamespace::Tracers, + // ), + trace_chunks_sent: worker.register_metric_context( + "trace_chunks_sent".to_string(), vec![], MetricType::Count, true, MetricNamespace::Tracers, ), - trace_chunk_dropped: worker.register_metric_context( - "trace_chunk_dropped".to_string(), + trace_chunks_dropped: worker.register_metric_context( + "trace_chunks_dropped".to_string(), vec![], MetricType::Count, true,