diff --git a/relay-spans/src/span.rs b/relay-spans/src/span.rs index fa98406e13f..73a90e4d265 100644 --- a/relay-spans/src/span.rs +++ b/relay-spans/src/span.rs @@ -65,11 +65,12 @@ fn otel_value_to_string(value: OtelValue) -> Option { } fn otel_value_to_span_id(value: OtelValue) -> Option { - match value { - OtelValue::StringValue(s) => Some(s), - OtelValue::BytesValue(b) => Some(hex::encode(b)), - _ => None, - } + let decoded = match value { + OtelValue::StringValue(s) => hex::decode(s).ok()?, + OtelValue::BytesValue(b) => b, + _ => None?, + }; + Some(hex::encode(decoded)) } fn otel_value_to_metric_summary(value: AnyValue) -> Option { @@ -191,7 +192,7 @@ pub fn otel_to_sentry_span(otel_span: OtelSpan) -> EventSpan { segment_id = otel_value_to_span_id(value); } "sentry.profile.id" => { - profile_id = otel_value_to_span_id(value); + profile_id = otel_value_to_string(value); } other => { if let Some(metric_name) = other.strip_prefix("sentry.metrics_summary.") { @@ -521,7 +522,7 @@ mod tests { { "key" : "sentry.segment.id", "value": { - "stringValue": "fa90fdead5f74052" + "stringValue": "FA90FDEAD5F74052" } }, { @@ -691,4 +692,13 @@ mod tests { } "###); } + + #[test] + fn uppercase_span_id() { + let input = OtelValue::StringValue("FA90FDEAD5F74052".to_owned()); + assert_eq!( + otel_value_to_span_id(input).as_deref(), + Some("fa90fdead5f74052") + ); + } }