@@ -251,7 +251,7 @@ def continue_from_environ(
251251 # type: (...) -> Transaction
252252 """
253253 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)
255255 before returning the Transaction.
256256
257257 This is different from `continue_from_headers` in that it assumes header
@@ -274,7 +274,7 @@ def continue_from_headers(
274274 # type: (...) -> Transaction
275275 """
276276 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).
278278 """
279279 # TODO move this to the Transaction class
280280 if cls is Span :
@@ -300,8 +300,6 @@ def continue_from_headers(
300300 # baggage will be empty and immutable and won't be populated as head SDK.
301301 baggage .freeze ()
302302
303- kwargs .update (extract_tracestate_data (headers .get ("tracestate" )))
304-
305303 transaction = Transaction (** kwargs )
306304 transaction .same_process_as_parent = False
307305
@@ -310,22 +308,12 @@ def continue_from_headers(
310308 def iter_headers (self ):
311309 # type: () -> Iterator[Tuple[str, str]]
312310 """
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.
319314 """
320315 yield SENTRY_TRACE_HEADER_NAME , self .to_traceparent ()
321316
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-
329317 if self .containing_transaction :
330318 baggage = self .containing_transaction .get_baggage ().serialize ()
331319 if baggage :
@@ -366,57 +354,6 @@ def to_traceparent(self):
366354 sampled = "0"
367355 return "%s-%s-%s" % (self .trace_id , self .span_id , sampled )
368356
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-
420357 def set_tag (self , key , value ):
421358 # type: (str, Any) -> None
422359 self ._tags [key ] = value
@@ -528,15 +465,6 @@ def get_trace_context(self):
528465 if self .status :
529466 rv ["status" ] = self .status
530467
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-
540468 if self .containing_transaction :
541469 rv [
542470 "dynamic_sampling_context"
@@ -552,13 +480,6 @@ class Transaction(Span):
552480 "parent_sampled" ,
553481 # used to create baggage value for head SDKs in dynamic sampling
554482 "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" ,
562483 "_measurements" ,
563484 "_contexts" ,
564485 "_profile" ,
@@ -569,8 +490,6 @@ def __init__(
569490 self ,
570491 name = "" , # type: str
571492 parent_sampled = None , # type: Optional[bool]
572- sentry_tracestate = None , # type: Optional[str]
573- third_party_tracestate = None , # type: Optional[str]
574493 baggage = None , # type: Optional[Baggage]
575494 source = TRANSACTION_SOURCE_CUSTOM , # type: str
576495 ** kwargs # type: Any
@@ -592,11 +511,6 @@ def __init__(
592511 self .source = source
593512 self .sample_rate = None # type: Optional[float]
594513 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
600514 self ._measurements = {} # type: Dict[str, Any]
601515 self ._contexts = {} # type: Dict[str, Any]
602516 self ._profile = None # type: Optional[sentry_sdk.profiler.Profile]
@@ -901,10 +815,7 @@ def finish(self, hub=None, end_timestamp=None):
901815from sentry_sdk .tracing_utils import (
902816 Baggage ,
903817 EnvironHeaders ,
904- compute_tracestate_entry ,
905818 extract_sentrytrace_data ,
906- extract_tracestate_data ,
907- has_tracestate_enabled ,
908819 has_tracing_enabled ,
909820 is_valid_sample_rate ,
910821 maybe_create_breadcrumbs_from_span ,
0 commit comments