Skip to content

Commit f42bc4b

Browse files
committed
feat: Support feature flags in span first
1 parent 3971a12 commit f42bc4b

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

sentry_sdk/feature_flags.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import copy
22
import sentry_sdk
33
from sentry_sdk._lru_cache import LRUCache
4+
from sentry_sdk.traces import StreamedSpan
45
from sentry_sdk.tracing import Span
56
from threading import Lock
67

@@ -62,5 +63,8 @@ def add_feature_flag(flag: str, result: bool) -> None:
6263
flags.set(flag, result)
6364

6465
span = sentry_sdk.get_current_span()
65-
if span and isinstance(span, Span):
66-
span.set_flag(f"flag.evaluation.{flag}", result)
66+
if span:
67+
if isinstance(span, Span):
68+
span.set_flag(f"flag.evaluation.{flag}", result)
69+
elif isinstance(span, StreamedSpan):
70+
span.set_attribute(f"flag.evaluation.{flag}", result)

0 commit comments

Comments
 (0)