11"""
2+ EXPERIMENTAL. Do not use in production.
3+
24The API in this file is only meant to be used in span streaming mode.
35
46You can enable span streaming mode via
@@ -84,6 +86,9 @@ def start_span(
8486 """
8587 Start a span.
8688
89+ EXPERIMENTAL. Use sentry_sdk.start_transaction() and sentry_sdk.start_span()
90+ instead.
91+
8792 The span's parent, unless provided explicitly via the `parent_span` argument,
8893 will be the current active span, if any. If there is none, this span will
8994 become the root of a new span tree. If you explicitly want this span to be
@@ -144,6 +149,8 @@ def continue_trace(incoming: "dict[str, Any]") -> None:
144149 """
145150 Continue a trace from headers or environment variables.
146151
152+ EXPERIMENTAL. Use sentry_sdk.continue_trace() instead.
153+
147154 This function sets the propagation context on the scope. Any span started
148155 in the updated scope will belong under the trace extracted from the
149156 provided propagation headers or environment variables.
@@ -168,6 +175,8 @@ def new_trace() -> None:
168175 """
169176 Resets the propagation context, forcing a new trace.
170177
178+ EXPERIMENTAL.
179+
171180 This function sets the propagation context on the scope. Any span started
172181 in the updated scope will start its own trace.
173182
@@ -531,6 +540,8 @@ def trace(
531540 """
532541 Decorator to start a span around a function call.
533542
543+ EXPERIMENTAL. Use @sentry_sdk.trace instead.
544+
534545 This decorator automatically creates a new span when the decorated function
535546 is called, and finishes the span when the function returns or raises an exception.
536547
@@ -578,7 +589,18 @@ def make_db_query(sql):
578589 # Function implementation
579590 pass
580591 """
581- from sentry_sdk .tracing_utils import create_streaming_span_decorator
592+ from sentry_sdk .tracing_utils import (
593+ create_streaming_span_decorator ,
594+ has_span_streaming_enabled ,
595+ )
596+
597+ client = sentry_sdk .get_client ()
598+ if not has_span_streaming_enabled (client ):
599+ warnings .warn (
600+ "Using span streaming API in non-span-streaming mode. Use "
601+ "@sentry_sdk.trace instead." ,
602+ stacklevel = 2 ,
603+ )
582604
583605 decorator = create_streaming_span_decorator (
584606 name = name ,
0 commit comments