@@ -170,9 +170,8 @@ impl TransactionContext {
170
170
171
171
/// Creates a new Transaction Context based on the distributed tracing `headers`.
172
172
///
173
- /// The `headers` in particular need to include either the `sentry-trace` or W3C
174
- /// `traceparent` header, which is used to associate the transaction with a distributed
175
- /// trace. If both are present, `sentry-trace` takes precedence.
173
+ /// The `headers` in particular need to include the `sentry-trace` header,
174
+ /// which is used to associate the transaction with a distributed trace.
176
175
#[ must_use = "this must be used with `start_transaction`" ]
177
176
pub fn continue_from_headers < ' a , I : IntoIterator < Item = ( & ' a str , & ' a str ) > > (
178
177
name : & str ,
@@ -1142,8 +1141,8 @@ impl Iterator for TraceHeadersIter {
1142
1141
}
1143
1142
}
1144
1143
1145
- /// A container for distributed tracing metadata that can be extracted from e.g. HTTP headers such as
1146
- /// `sentry-trace` and `traceparent` .
1144
+ /// A container for distributed tracing metadata that can be extracted from e.g. the `sentry-trace`
1145
+ /// HTTP header .
1147
1146
#[ derive( Debug , PartialEq ) ]
1148
1147
pub struct SentryTrace ( protocol:: TraceId , protocol:: SpanId , Option < bool > ) ;
1149
1148
@@ -1173,25 +1172,8 @@ fn parse_sentry_trace(header: &str) -> Option<SentryTrace> {
1173
1172
Some ( SentryTrace ( trace_id, parent_span_id, parent_sampled) )
1174
1173
}
1175
1174
1176
- /// Parses a W3C traceparent header.
1177
- /// Reference: <https://w3c.github.io/trace-context/#traceparent-header-field-values>
1178
- fn parse_w3c_traceparent ( header : & str ) -> Option < SentryTrace > {
1179
- let header = header. trim ( ) ;
1180
- let mut parts = header. splitn ( 4 , '-' ) ;
1181
-
1182
- let _version = parts. next ( ) ?;
1183
- let trace_id = parts. next ( ) ?. parse ( ) . ok ( ) ?;
1184
- let parent_span_id = parts. next ( ) ?. parse ( ) . ok ( ) ?;
1185
- let parent_sampled = parts
1186
- . next ( )
1187
- . and_then ( |sampled| u8:: from_str_radix ( sampled, 16 ) . ok ( ) )
1188
- . map ( |flag| flag & 1 != 0 ) ;
1189
-
1190
- Some ( SentryTrace ( trace_id, parent_span_id, parent_sampled) )
1191
- }
1192
-
1193
1175
/// Extracts distributed tracing metadata from headers (or, generally, key-value pairs),
1194
- /// considering the values for both `sentry-trace` (prioritized) and `traceparent `.
1176
+ /// considering the values for `sentry-trace`.
1195
1177
pub fn parse_headers < ' a , I : IntoIterator < Item = ( & ' a str , & ' a str ) > > (
1196
1178
headers : I ,
1197
1179
) -> Option < SentryTrace > {
@@ -1201,10 +1183,6 @@ pub fn parse_headers<'a, I: IntoIterator<Item = (&'a str, &'a str)>>(
1201
1183
trace = parse_sentry_trace ( v) ;
1202
1184
break ;
1203
1185
}
1204
-
1205
- if k. eq_ignore_ascii_case ( "traceparent" ) {
1206
- trace = parse_w3c_traceparent ( v) ;
1207
- }
1208
1186
}
1209
1187
trace
1210
1188
}
@@ -1241,26 +1219,6 @@ mod tests {
1241
1219
assert_eq ! ( parsed, Some ( trace) ) ;
1242
1220
}
1243
1221
1244
- #[ test]
1245
- fn parses_traceparent ( ) {
1246
- let trace_id = protocol:: TraceId :: from_str ( "4bf92f3577b34da6a3ce929d0e0e4736" ) . unwrap ( ) ;
1247
- let parent_trace_id = protocol:: SpanId :: from_str ( "00f067aa0ba902b7" ) . unwrap ( ) ;
1248
-
1249
- let trace =
1250
- parse_w3c_traceparent ( "00-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-01" ) ;
1251
- assert_eq ! (
1252
- trace,
1253
- Some ( SentryTrace ( trace_id, parent_trace_id, Some ( true ) ) )
1254
- ) ;
1255
-
1256
- let trace =
1257
- parse_w3c_traceparent ( "00-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-00" ) ;
1258
- assert_eq ! (
1259
- trace,
1260
- Some ( SentryTrace ( trace_id, parent_trace_id, Some ( false ) ) )
1261
- ) ;
1262
- }
1263
-
1264
1222
#[ test]
1265
1223
fn disabled_forwards_trace_id ( ) {
1266
1224
let headers = [ (
0 commit comments