diff --git a/trace/src/ctx.rs b/trace/src/ctx.rs index 0c8699c82d..69820ad319 100644 --- a/trace/src/ctx.rs +++ b/trace/src/ctx.rs @@ -154,10 +154,10 @@ enum ContextCodec { impl ContextCodec { fn detect(headers: &HeaderMap) -> Option { - if headers.contains_key(B3_TRACE_ID_HEADER) { - Some(B3) - } else if headers.contains_key(JAEGER_TRACE_HEADER) { + if headers.contains_key(JAEGER_TRACE_HEADER) { Some(Jaeger) + } else if headers.contains_key(B3_TRACE_ID_HEADER) { + Some(B3) } else { None } @@ -177,11 +177,7 @@ fn decode_b3( // Debug implies an accept decision true => true, false => decoded_header(headers, B3_SAMPLED_HEADER)? - .map(|value| { - // TEMPORARY (#2297) - info!(sampled=%value, "traced request"); - value == "1" || value == "true" - }) + .map(|value| value == "1" || value == "true") .unwrap_or(false), }; @@ -189,16 +185,6 @@ fn decode_b3( return Ok(None); } - let ctx = SpanContext { - trace_id: required_header(headers, B3_TRACE_ID_HEADER)?, - parent_span_id: parsed_header(headers, B3_PARENT_SPAN_ID_HEADER)?, - span_id: required_header(headers, B3_SPAN_ID_HEADER)?, - collector: Some(Arc::clone(collector)), - }; - - // TEMPORARY (#2297) - info!(?ctx, "tracing request"); - Ok(Some(SpanContext { trace_id: required_header(headers, B3_TRACE_ID_HEADER)?, parent_span_id: parsed_header(headers, B3_PARENT_SPAN_ID_HEADER)?, @@ -219,6 +205,9 @@ impl FromStr for JaegerCtx { fn from_str(s: &str) -> Result { use itertools::Itertools; + + // TEMPORARY (#2297) + info!("traced request {}", s); let (trace_id, span_id, parent_span_id, flags) = s .split(':') .collect_tuple()