@@ -251,7 +251,7 @@ def continue_from_environ(
251
251
# type: (...) -> Transaction
252
252
"""
253
253
Create a Transaction with the given params, then add in data pulled from
254
- the 'sentry-trace', 'baggage' and 'tracestate ' headers from the environ (if any)
254
+ the 'sentry-trace' and 'baggage ' headers from the environ (if any)
255
255
before returning the Transaction.
256
256
257
257
This is different from `continue_from_headers` in that it assumes header
@@ -274,7 +274,7 @@ def continue_from_headers(
274
274
# type: (...) -> Transaction
275
275
"""
276
276
Create a transaction with the given params (including any data pulled from
277
- the 'sentry-trace', 'baggage' and 'tracestate ' headers).
277
+ the 'sentry-trace' and 'baggage ' headers).
278
278
"""
279
279
# TODO move this to the Transaction class
280
280
if cls is Span :
@@ -300,8 +300,6 @@ def continue_from_headers(
300
300
# baggage will be empty and immutable and won't be populated as head SDK.
301
301
baggage .freeze ()
302
302
303
- kwargs .update (extract_tracestate_data (headers .get ("tracestate" )))
304
-
305
303
transaction = Transaction (** kwargs )
306
304
transaction .same_process_as_parent = False
307
305
@@ -310,22 +308,12 @@ def continue_from_headers(
310
308
def iter_headers (self ):
311
309
# type: () -> Iterator[Tuple[str, str]]
312
310
"""
313
- Creates a generator which returns the span's `sentry-trace`, `baggage` and
314
- `tracestate` headers.
315
-
316
- If the span's containing transaction doesn't yet have a
317
- `sentry_tracestate` value, this will cause one to be generated and
318
- stored.
311
+ Creates a generator which returns the span's `sentry-trace` and `baggage` headers.
312
+ If the span's containing transaction doesn't yet have a `baggage` value,
313
+ this will cause one to be generated and stored.
319
314
"""
320
315
yield SENTRY_TRACE_HEADER_NAME , self .to_traceparent ()
321
316
322
- tracestate = self .to_tracestate () if has_tracestate_enabled (self ) else None
323
- # `tracestate` will only be `None` if there's no client or no DSN
324
- # TODO (kmclb) the above will be true once the feature is no longer
325
- # behind a flag
326
- if tracestate :
327
- yield "tracestate" , tracestate
328
-
329
317
if self .containing_transaction :
330
318
baggage = self .containing_transaction .get_baggage ().serialize ()
331
319
if baggage :
@@ -366,57 +354,6 @@ def to_traceparent(self):
366
354
sampled = "0"
367
355
return "%s-%s-%s" % (self .trace_id , self .span_id , sampled )
368
356
369
- def to_tracestate (self ):
370
- # type: () -> Optional[str]
371
- """
372
- Computes the `tracestate` header value using data from the containing
373
- transaction.
374
-
375
- If the containing transaction doesn't yet have a `sentry_tracestate`
376
- value, this will cause one to be generated and stored.
377
-
378
- If there is no containing transaction, a value will be generated but not
379
- stored.
380
-
381
- Returns None if there's no client and/or no DSN.
382
- """
383
-
384
- sentry_tracestate = self .get_or_set_sentry_tracestate ()
385
- third_party_tracestate = (
386
- self .containing_transaction ._third_party_tracestate
387
- if self .containing_transaction
388
- else None
389
- )
390
-
391
- if not sentry_tracestate :
392
- return None
393
-
394
- header_value = sentry_tracestate
395
-
396
- if third_party_tracestate :
397
- header_value = header_value + "," + third_party_tracestate
398
-
399
- return header_value
400
-
401
- def get_or_set_sentry_tracestate (self ):
402
- # type: (Span) -> Optional[str]
403
- """
404
- Read sentry tracestate off of the span's containing transaction.
405
-
406
- If the transaction doesn't yet have a `_sentry_tracestate` value,
407
- compute one and store it.
408
- """
409
- transaction = self .containing_transaction
410
-
411
- if transaction :
412
- if not transaction ._sentry_tracestate :
413
- transaction ._sentry_tracestate = compute_tracestate_entry (self )
414
-
415
- return transaction ._sentry_tracestate
416
-
417
- # orphan span - nowhere to store the value, so just return it
418
- return compute_tracestate_entry (self )
419
-
420
357
def set_tag (self , key , value ):
421
358
# type: (str, Any) -> None
422
359
self ._tags [key ] = value
@@ -528,15 +465,6 @@ def get_trace_context(self):
528
465
if self .status :
529
466
rv ["status" ] = self .status
530
467
531
- # if the transaction didn't inherit a tracestate value, and no outgoing
532
- # requests - whose need for headers would have caused a tracestate value
533
- # to be created - were made as part of the transaction, the transaction
534
- # still won't have a tracestate value, so compute one now
535
- sentry_tracestate = self .get_or_set_sentry_tracestate ()
536
-
537
- if sentry_tracestate :
538
- rv ["tracestate" ] = sentry_tracestate
539
-
540
468
if self .containing_transaction :
541
469
rv [
542
470
"dynamic_sampling_context"
@@ -552,13 +480,6 @@ class Transaction(Span):
552
480
"parent_sampled" ,
553
481
# used to create baggage value for head SDKs in dynamic sampling
554
482
"sample_rate" ,
555
- # the sentry portion of the `tracestate` header used to transmit
556
- # correlation context for server-side dynamic sampling, of the form
557
- # `sentry=xxxxx`, where `xxxxx` is the base64-encoded json of the
558
- # correlation context data, missing trailing any =
559
- "_sentry_tracestate" ,
560
- # tracestate data from other vendors, of the form `dogs=yes,cats=maybe`
561
- "_third_party_tracestate" ,
562
483
"_measurements" ,
563
484
"_contexts" ,
564
485
"_profile" ,
@@ -569,8 +490,6 @@ def __init__(
569
490
self ,
570
491
name = "" , # type: str
571
492
parent_sampled = None , # type: Optional[bool]
572
- sentry_tracestate = None , # type: Optional[str]
573
- third_party_tracestate = None , # type: Optional[str]
574
493
baggage = None , # type: Optional[Baggage]
575
494
source = TRANSACTION_SOURCE_CUSTOM , # type: str
576
495
** kwargs # type: Any
@@ -592,11 +511,6 @@ def __init__(
592
511
self .source = source
593
512
self .sample_rate = None # type: Optional[float]
594
513
self .parent_sampled = parent_sampled
595
- # if tracestate isn't inherited and set here, it will get set lazily,
596
- # either the first time an outgoing request needs it for a header or the
597
- # first time an event needs it for inclusion in the captured data
598
- self ._sentry_tracestate = sentry_tracestate
599
- self ._third_party_tracestate = third_party_tracestate
600
514
self ._measurements = {} # type: Dict[str, Any]
601
515
self ._contexts = {} # type: Dict[str, Any]
602
516
self ._profile = None # type: Optional[sentry_sdk.profiler.Profile]
@@ -901,10 +815,7 @@ def finish(self, hub=None, end_timestamp=None):
901
815
from sentry_sdk .tracing_utils import (
902
816
Baggage ,
903
817
EnvironHeaders ,
904
- compute_tracestate_entry ,
905
818
extract_sentrytrace_data ,
906
- extract_tracestate_data ,
907
- has_tracestate_enabled ,
908
819
has_tracing_enabled ,
909
820
is_valid_sample_rate ,
910
821
maybe_create_breadcrumbs_from_span ,
0 commit comments