Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion scripts/init_serverless_sdk.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
dsn=os.environ["SENTRY_DSN"],
integrations=[AwsLambdaIntegration(timeout_warning=True)],
traces_sample_rate=float(os.environ["SENTRY_TRACES_SAMPLE_RATE"]),
trace_lifecycle="stream",
)


Expand Down
11 changes: 2 additions & 9 deletions sentry_sdk/consts.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ class CompressionAlgo(Enum):
"transport_num_pools": Optional[int],
"transport_http2": Optional[bool],
"transport_async": Optional[bool],
"trace_lifecycle": Optional[Literal["static", "stream"]],
"data_collection": Optional[DataCollectionUserOptions],
},
total=False,
Expand Down Expand Up @@ -1304,7 +1303,6 @@ def __init__(
attach_stacktrace: bool = False,
ca_certs: "Optional[str]" = None,
traces_sample_rate: "Optional[float]" = None,
trace_lifecycle: "Optional[Literal['static', 'stream']]" = None,
traces_sampler: "Optional[TracesSampler]" = None,
profiler_mode: "Optional[ContinuousProfilerMode]" = None,
profile_lifecycle: 'Literal["manual", "trace"]' = "manual",
Expand Down Expand Up @@ -1727,17 +1725,12 @@ def __init__(

:param before_send_span: An optional function to modify spans before they're sent to Sentry.
Modifications to the span's attributes and name will be retained. Unlike ``before_send_log``
and ``before_send_metric``, spans cannot be dropped by returning None. Only works when
``trace_lifecycle="stream"`` is enabled.
and ``before_send_metric``, spans cannot be dropped by returning None.

:param stream_gen_ai_spans: When set, generative AI spans are sent in a new transport format to
reduce downstream data loss.

:param trace_lifecycle: Controls how traces are sent. Set to `"stream"` to send spans as they
finish, or `"static"` to send a completed trace as a transaction event.

:param ignore_spans: A sequence of span-matching rules. Matching spans are ignored when
`trace_lifecycle="stream"` is enabled.
:param ignore_spans: A sequence of span-matching rules. Matching spans are ignored.

:param _experiments: Dictionary of experimental, opt-in features that are not yet stable.

Expand Down
3 changes: 0 additions & 3 deletions sentry_sdk/traces.py
Original file line number Diff line number Diff line change
Expand Up @@ -848,9 +848,6 @@ def get_current_span(
) -> "Optional[StreamedSpan]":
"""
Returns the currently active span on the scope if the span is a `StreamedSpan`, otherwise `None`.

This function will only return a non-`None` value when the streaming trace lifecycle is enabled.
To enable the lifecycle, pass `trace_lifecycle="stream"` to `sentry.init()`.
"""
scope = scope or sentry_sdk.get_current_scope()
current_span = scope.streamed_span
Expand Down
38 changes: 2 additions & 36 deletions tests/integrations/aiohttp/test_aiohttp.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,6 @@ async def test_tracing_unparseable_url(sentry_init, aiohttp_client, capture_item
sentry_init(
integrations=[AioHttpIntegration()],
traces_sample_rate=1.0,
trace_lifecycle="stream",
)

async def hello(request):
Expand Down Expand Up @@ -341,7 +340,6 @@ async def test_traces_sampler_gets_request_object_in_sampling_context(
traces_sampler = mock.Mock()
sentry_init(
integrations=[AioHttpIntegration()],
trace_lifecycle="stream",
traces_sampler=traces_sampler,
)

Expand Down Expand Up @@ -372,7 +370,6 @@ async def test_has_trace_if_performance_enabled(
sentry_init(
integrations=[AioHttpIntegration()],
traces_sample_rate=1.0,
trace_lifecycle="stream",
)

async def hello(request):
Expand Down Expand Up @@ -423,7 +420,7 @@ async def hello(request):
async def test_has_trace_if_performance_disabled(
sentry_init, aiohttp_client, capture_events
):
sentry_init(integrations=[AioHttpIntegration()], trace_lifecycle="stream")
sentry_init(integrations=[AioHttpIntegration()])

async def hello(request):
capture_message("It's a good day to try dividing by 0")
Expand Down Expand Up @@ -459,7 +456,6 @@ async def test_trace_from_headers_if_performance_enabled(
sentry_init(
integrations=[AioHttpIntegration()],
traces_sample_rate=1.0,
trace_lifecycle="stream",
)

async def hello(request):
Expand Down Expand Up @@ -592,7 +588,6 @@ def before_breadcrumb(crumb, hint):
sentry_init(
integrations=[AioHttpIntegration()],
before_breadcrumb=before_breadcrumb,
trace_lifecycle="stream",
**pii_options,
)

Expand Down Expand Up @@ -686,9 +681,7 @@ async def test_crumb_capture_client_error(
url_expected,
query_expected,
):
sentry_init(
integrations=[AioHttpIntegration()], trace_lifecycle="stream", **pii_options
)
sentry_init(integrations=[AioHttpIntegration()], **pii_options)

async def handler(request):
return web.Response(status=status_code)
Expand Down Expand Up @@ -738,7 +731,6 @@ async def test_outgoing_trace_headers_adds_missing_unsigned_propagation_headers(
sentry_init(
integrations=[AioHttpIntegration()],
traces_sample_rate=1.0,
trace_lifecycle="stream",
)

async def handler(request):
Expand Down Expand Up @@ -780,7 +772,6 @@ async def test_outgoing_trace_headers_appends_baggage_but_preserves_sentry_trace
sentry_init(
integrations=[AioHttpIntegration()],
traces_sample_rate=1.0,
trace_lifecycle="stream",
release="d08ebdb9309e1b004c6f52202de58a09c2268e42",
)

Expand Down Expand Up @@ -815,7 +806,6 @@ async def test_outgoing_trace_headers_preserves_signed_propagation_headers(
sentry_init(
integrations=[AioHttpIntegration()],
traces_sample_rate=1.0,
trace_lifecycle="stream",
)

async def handler(request):
Expand Down Expand Up @@ -855,7 +845,6 @@ async def test_outgoing_trace_headers_preserves_query_signed_baggage(
sentry_init(
integrations=[AioHttpIntegration()],
traces_sample_rate=1.0,
trace_lifecycle="stream",
)

async def handler(request):
Expand Down Expand Up @@ -894,7 +883,6 @@ async def test_request_source_disabled(
sentry_init(
integrations=[AioHttpIntegration()],
traces_sample_rate=1.0,
trace_lifecycle="stream",
enable_http_request_source=False,
http_request_source_threshold_ms=0,
)
Expand Down Expand Up @@ -946,7 +934,6 @@ async def test_request_source_enabled(
sentry_init(
integrations=[AioHttpIntegration()],
traces_sample_rate=1.0,
trace_lifecycle="stream",
http_request_source_threshold_ms=0,
**extra_options,
)
Expand Down Expand Up @@ -989,7 +976,6 @@ async def test_request_source(
sentry_init(
integrations=[AioHttpIntegration()],
traces_sample_rate=1.0,
trace_lifecycle="stream",
enable_http_request_source=True,
http_request_source_threshold_ms=0,
)
Expand Down Expand Up @@ -1050,7 +1036,6 @@ async def test_request_source_with_module_in_search_path(
sentry_init(
integrations=[AioHttpIntegration()],
traces_sample_rate=1.0,
trace_lifecycle="stream",
enable_http_request_source=True,
http_request_source_threshold_ms=0,
)
Expand Down Expand Up @@ -1105,7 +1090,6 @@ async def test_no_request_source_if_duration_too_short(
sentry_init(
integrations=[AioHttpIntegration()],
traces_sample_rate=1.0,
trace_lifecycle="stream",
enable_http_request_source=True,
http_request_source_threshold_ms=10**10,
)
Expand Down Expand Up @@ -1151,7 +1135,6 @@ async def test_request_source_if_duration_over_threshold(
sentry_init(
integrations=[AioHttpIntegration()],
traces_sample_rate=1.0,
trace_lifecycle="stream",
enable_http_request_source=True,
http_request_source_threshold_ms=0,
)
Expand Down Expand Up @@ -1211,7 +1194,6 @@ async def test_span_origin(
):
sentry_init(
integrations=[AioHttpIntegration()],
trace_lifecycle="stream",
traces_sample_rate=1.0,
)

Expand Down Expand Up @@ -1363,7 +1345,6 @@ async def test_tracing(sentry_init, aiohttp_client, capture_items, send_pii):
integrations=[AioHttpIntegration()],
traces_sample_rate=1.0,
send_default_pii=send_pii,
trace_lifecycle="stream",
)

async def hello(request):
Expand Down Expand Up @@ -1434,7 +1415,6 @@ async def test_user_address_with_data_collection(
sentry_init(
integrations=[AioHttpIntegration()],
traces_sample_rate=1.0,
trace_lifecycle="stream",
**init_kwargs,
)

Expand Down Expand Up @@ -1468,7 +1448,6 @@ async def test_sensitive_header_scrubbing(sentry_init, aiohttp_client, capture_i
sentry_init(
integrations=[AioHttpIntegration()],
traces_sample_rate=1.0,
trace_lifecycle="stream",
)

async def hello(request):
Expand Down Expand Up @@ -1628,7 +1607,6 @@ async def test_sensitive_header_passthrough_with_pii(
integrations=[AioHttpIntegration()],
traces_sample_rate=1.0,
send_default_pii=options["send_default_pii"],
trace_lifecycle="stream",
_experiments={
"data_collection": options["data_collection"],
},
Expand Down Expand Up @@ -1682,7 +1660,6 @@ async def test_sensitive_header_passthrough_with_pii_without_data_collection(
integrations=[AioHttpIntegration()],
traces_sample_rate=1.0,
send_default_pii=True,
trace_lifecycle="stream",
)

async def hello(request):
Expand Down Expand Up @@ -1720,7 +1697,6 @@ async def test_url_query_attribute(
integrations=[AioHttpIntegration()],
traces_sample_rate=1.0,
send_default_pii=send_pii,
trace_lifecycle="stream",
)

async def hello(request):
Expand Down Expand Up @@ -1777,7 +1753,6 @@ async def test_transaction_style(
sentry_init(
integrations=[AioHttpIntegration(transaction_style=transaction_style)],
traces_sample_rate=1.0,
trace_lifecycle="stream",
)

async def hello(request):
Expand Down Expand Up @@ -1819,7 +1794,6 @@ async def test_http_route(
sentry_init(
integrations=[AioHttpIntegration()],
traces_sample_rate=1.0,
trace_lifecycle="stream",
)

async def hello(request):
Expand All @@ -1843,7 +1817,6 @@ async def test_server_error(sentry_init, aiohttp_client, capture_items):
sentry_init(
integrations=[AioHttpIntegration()],
traces_sample_rate=1.0,
trace_lifecycle="stream",
)

async def hello(request):
Expand Down Expand Up @@ -1882,7 +1855,6 @@ async def test_http_exception(sentry_init, aiohttp_client, capture_items):
sentry_init(
integrations=[AioHttpIntegration()],
traces_sample_rate=1.0,
trace_lifecycle="stream",
)

async def hello(request):
Expand Down Expand Up @@ -1914,7 +1886,6 @@ async def test_http_exception_ok_status_not_overridden(
sentry_init(
integrations=[AioHttpIntegration()],
traces_sample_rate=1.0,
trace_lifecycle="stream",
)

async def hello(request):
Expand Down Expand Up @@ -1948,7 +1919,6 @@ async def test_outgoing_client_span(
integrations=[AioHttpIntegration()],
traces_sample_rate=1.0,
send_default_pii=send_pii,
trace_lifecycle="stream",
)

async def handler(request):
Expand Down Expand Up @@ -2007,7 +1977,6 @@ async def test_outgoing_trace_headers(
sentry_init(
integrations=[AioHttpIntegration()],
traces_sample_rate=1.0,
trace_lifecycle="stream",
)

async def handler(request):
Expand Down Expand Up @@ -2041,7 +2010,6 @@ async def test_user_ip_address_on_all_spans(
integrations=[AioHttpIntegration()],
traces_sample_rate=1.0,
send_default_pii=send_default_pii,
trace_lifecycle="stream",
)

async def hello(request):
Expand Down Expand Up @@ -2153,7 +2121,6 @@ async def test_server_url_query_data_collection(
sentry_init(
integrations=[AioHttpIntegration()],
traces_sample_rate=1.0,
trace_lifecycle="stream",
**init_kwargs,
)

Expand Down Expand Up @@ -2195,7 +2162,6 @@ async def test_client_url_query_data_collection(
sentry_init(
integrations=[AioHttpIntegration()],
traces_sample_rate=1.0,
trace_lifecycle="stream",
**init_kwargs,
)

Expand Down
8 changes: 0 additions & 8 deletions tests/integrations/aiomysql/test_aiomysql.py
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,6 @@ async def test_query_source_disabled(sentry_init, capture_items):
traces_sample_rate=1.0,
enable_db_query_source=False,
db_query_source_threshold_ms=0,
trace_lifecycle="stream",
)

items = capture_items("span")
Expand Down Expand Up @@ -739,7 +738,6 @@ async def test_query_source_enabled(sentry_init, capture_items, enable_db_query_
"integrations": [AioMySQLIntegration()],
"traces_sample_rate": 1.0,
"db_query_source_threshold_ms": 0,
"trace_lifecycle": "stream",
}
if enable_db_query_source is not None:
sentry_options["enable_db_query_source"] = enable_db_query_source
Expand Down Expand Up @@ -787,7 +785,6 @@ async def test_query_source(sentry_init, capture_items):
traces_sample_rate=1.0,
enable_db_query_source=True,
db_query_source_threshold_ms=0,
trace_lifecycle="stream",
)

items = capture_items("span")
Expand Down Expand Up @@ -843,7 +840,6 @@ async def test_no_query_source_if_duration_too_short(sentry_init, capture_items)
traces_sample_rate=1.0,
enable_db_query_source=True,
db_query_source_threshold_ms=100,
trace_lifecycle="stream",
)

items = capture_items("span")
Expand Down Expand Up @@ -898,7 +894,6 @@ async def test_query_source_if_duration_over_threshold(sentry_init, capture_item
traces_sample_rate=1.0,
enable_db_query_source=True,
db_query_source_threshold_ms=100,
trace_lifecycle="stream",
)

items = capture_items("span")
Expand Down Expand Up @@ -964,7 +959,6 @@ async def test_span_origin(sentry_init, capture_items):
sentry_init(
integrations=[AioMySQLIntegration()],
traces_sample_rate=1.0,
trace_lifecycle="stream",
)

items = capture_items("span")
Expand Down Expand Up @@ -998,7 +992,6 @@ async def test_multiline_query_description_normalized(sentry_init, capture_items
sentry_init(
integrations=[AioMySQLIntegration()],
traces_sample_rate=1.0,
trace_lifecycle="stream",
)

items = capture_items("span")
Expand Down Expand Up @@ -1038,7 +1031,6 @@ async def test_db_data_on_spans(sentry_init, capture_items):
sentry_init(
integrations=[AioMySQLIntegration()],
traces_sample_rate=1.0,
trace_lifecycle="stream",
)

items = capture_items("span")
Expand Down
Loading
Loading