Skip to content

Commit 97ee0b1

Browse files
authored
feat(span-streaming): Add experimental trace_lifecycle switch (1) (#5397)
- Add a new experimental `trace_lifecycle` option (used in follow up PRs) - Add a new util function for checking which mode the SDK is in Chipping away at #5317 to transform it into reviewable and mergeable PRs.
1 parent e061eb1 commit 97ee0b1

2 files changed

Lines changed: 8 additions & 0 deletions

File tree

sentry_sdk/consts.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ class CompressionAlgo(Enum):
8282
"before_send_log": Optional[Callable[[Log, Hint], Optional[Log]]],
8383
"enable_metrics": Optional[bool],
8484
"before_send_metric": Optional[Callable[[Metric, Hint], Optional[Metric]]],
85+
"trace_lifecycle": Optional[Literal["static", "stream"]],
8586
},
8687
total=False,
8788
)

sentry_sdk/tracing_utils.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,13 @@ def has_tracing_enabled(options: "Optional[Dict[str, Any]]") -> bool:
106106
)
107107

108108

109+
def has_span_streaming_enabled(options: "Optional[dict[str, Any]]") -> bool:
110+
if options is None:
111+
return False
112+
113+
return (options.get("_experiments") or {}).get("trace_lifecycle") == "stream"
114+
115+
109116
@contextlib.contextmanager
110117
def record_sql_queries(
111118
cursor: "Any",

0 commit comments

Comments
 (0)