feat: prefer jaeger trace context (#2311)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>pull/24376/head
parent
c012e996ab
commit
a20b452cf3
|
@ -154,10 +154,10 @@ enum ContextCodec {
|
|||
|
||||
impl ContextCodec {
|
||||
fn detect(headers: &HeaderMap) -> Option<Self> {
|
||||
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<Self, Self::Err> {
|
||||
use itertools::Itertools;
|
||||
|
||||
// TEMPORARY (#2297)
|
||||
info!("traced request {}", s);
|
||||
let (trace_id, span_id, parent_span_id, flags) = s
|
||||
.split(':')
|
||||
.collect_tuple()
|
||||
|
|
Loading…
Reference in New Issue