From b0f07f5b161f5fdb2d8cba21eb2e5871dc4e2a85 Mon Sep 17 00:00:00 2001 From: Julio Gonzalez Date: Fri, 7 Jun 2024 11:56:59 +0200 Subject: [PATCH] Disable normalization when flushing traces to the agent. --- data-pipeline/src/trace_exporter.rs | 6 ++++++ sidecar/src/service/sidecar_server.rs | 2 +- trace-mini-agent/src/trace_processor.rs | 1 + trace-utils/src/trace_utils.rs | 7 +++++-- 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/data-pipeline/src/trace_exporter.rs b/data-pipeline/src/trace_exporter.rs index cc53333b7..1e735d7ff 100644 --- a/data-pipeline/src/trace_exporter.rs +++ b/data-pipeline/src/trace_exporter.rs @@ -222,10 +222,16 @@ impl TraceExporter { }, ), TraceExporterOutputFormat::V07 => { + let mut normalize = false; + if self.endpoint.api_key.is_some() { + normalize = true; + } + let tracer_payload = trace_utils::collect_trace_chunks( traces, &header_tags, |_chunk, _root_span_index| {}, + normalize, ); let endpoint = Endpoint { diff --git a/sidecar/src/service/sidecar_server.rs b/sidecar/src/service/sidecar_server.rs index d41250f21..848b5f105 100644 --- a/sidecar/src/service/sidecar_server.rs +++ b/sidecar/src/service/sidecar_server.rs @@ -310,7 +310,7 @@ impl SidecarServer { } let payload = - trace_utils::collect_trace_chunks(traces, &headers, |_chunk, _root_span_index| {}); + trace_utils::collect_trace_chunks(traces, &headers, |_chunk, _root_span_index| {}, false); // send trace payload to our trace flusher let data = SendData::new(size, payload, headers, target); diff --git a/trace-mini-agent/src/trace_processor.rs b/trace-mini-agent/src/trace_processor.rs index 5b2fd5158..bd1be2371 100644 --- a/trace-mini-agent/src/trace_processor.rs +++ b/trace-mini-agent/src/trace_processor.rs @@ -85,6 +85,7 @@ impl TraceProcessor for ServerlessTraceProcessor { obfuscate_span(span, &config.obfuscation_config); } }, + true ); let send_data = SendData::new(body_size, payload, tracer_header_tags, &config.trace_intake); diff --git a/trace-utils/src/trace_utils.rs b/trace-utils/src/trace_utils.rs index c29ad2525..8edcf4064 100644 --- a/trace-utils/src/trace_utils.rs +++ b/trace-utils/src/trace_utils.rs @@ -288,6 +288,7 @@ pub fn collect_trace_chunks( mut traces: Vec>, tracer_header_tags: &TracerHeaderTags, process_chunk: impl Fn(&mut TraceChunk, usize), + do_normalize: bool, ) -> pb::TracerPayload { let mut trace_chunks: Vec = Vec::new(); @@ -309,8 +310,10 @@ pub fn collect_trace_chunks( } }; - if let Err(e) = normalizer::normalize_chunk(&mut chunk, root_span_index) { - error!("Error normalizing trace chunk: {e}"); + if do_normalize { + if let Err(e) = normalizer::normalize_chunk(&mut chunk, root_span_index) { + error!("Error normalizing trace chunk: {e}"); + } } for span in chunk.spans.iter_mut() {