From 2cb208d9f12537cc2082ef15a62f992f45058e7d Mon Sep 17 00:00:00 2001 From: Ivana Kellyer Date: Thu, 30 Jul 2026 15:12:35 +0200 Subject: [PATCH 01/10] test: Use top-level options if available --- tests/integrations/aiohttp/test_aiohttp.py | 4 +- tests/integrations/aiomysql/test_aiomysql.py | 32 +++------- tests/integrations/asgi/test_asgi.py | 58 ++++++++--------- tests/integrations/asyncio/test_asyncio.py | 28 +++------ tests/integrations/asyncpg/test_asyncpg.py | 50 +++++---------- .../test_clickhouse_driver.py | 10 +-- tests/integrations/django/asgi/test_asgi.py | 2 +- tests/integrations/django/test_basic.py | 4 +- .../django/test_data_scrubbing.py | 6 +- tests/integrations/fastapi/test_fastapi.py | 28 +++------ tests/integrations/flask/test_flask.py | 6 +- tests/integrations/litestar/test_litestar.py | 4 +- tests/integrations/mcp/test_mcp.py | 40 ++++++------ .../openai_agents/test_openai_agents.py | 40 +++--------- .../sqlalchemy/test_sqlalchemy.py | 6 +- .../integrations/starlette/test_starlette.py | 38 +++--------- tests/integrations/starlite/test_starlite.py | 20 ++---- tests/integrations/wsgi/test_wsgi.py | 42 ++++--------- tests/test_attributes.py | 4 +- tests/tracing/test_decorator.py | 8 +-- tests/tracing/test_http_headers.py | 8 +-- tests/tracing/test_integration_tests.py | 4 +- tests/tracing/test_sampling.py | 16 ++--- tests/tracing/test_span_streaming.py | 62 +++++++------------ 24 files changed, 166 insertions(+), 354 deletions(-) diff --git a/tests/integrations/aiohttp/test_aiohttp.py b/tests/integrations/aiohttp/test_aiohttp.py index 438b009c07..0aa3f4b014 100644 --- a/tests/integrations/aiohttp/test_aiohttp.py +++ b/tests/integrations/aiohttp/test_aiohttp.py @@ -1904,8 +1904,8 @@ async def test_server_url_query_data_collection_span_streaming( sentry_init( integrations=[AioHttpIntegration()], traces_sample_rate=1.0, + trace_lifecycle="stream", _experiments={ - "trace_lifecycle": "stream", **init_kwargs.pop("_experiments", {}), }, **init_kwargs, @@ -1949,8 +1949,8 @@ async def test_client_url_query_data_collection_span_streaming( sentry_init( integrations=[AioHttpIntegration()], traces_sample_rate=1.0, + trace_lifecycle="stream", _experiments={ - "trace_lifecycle": "stream", **init_kwargs.pop("_experiments", {}), }, **init_kwargs, diff --git a/tests/integrations/aiomysql/test_aiomysql.py b/tests/integrations/aiomysql/test_aiomysql.py index 35594ee8f9..ad0d8ee119 100644 --- a/tests/integrations/aiomysql/test_aiomysql.py +++ b/tests/integrations/aiomysql/test_aiomysql.py @@ -441,9 +441,7 @@ async def test_query_source_disabled( "traces_sample_rate": 1.0, "enable_db_query_source": False, "db_query_source_threshold_ms": 0, - "_experiments": { - "trace_lifecycle": "stream" if span_streaming else "static", - }, + "trace_lifecycle": "stream" if span_streaming else "static", } sentry_init(**sentry_options) @@ -516,9 +514,7 @@ async def test_query_source_enabled( "integrations": [AioMySQLIntegration()], "traces_sample_rate": 1.0, "db_query_source_threshold_ms": 0, - "_experiments": { - "trace_lifecycle": "stream" if span_streaming else "static", - }, + "trace_lifecycle": "stream" if span_streaming else "static", } if enable_db_query_source is not None: sentry_options["enable_db_query_source"] = enable_db_query_source @@ -591,9 +587,7 @@ async def test_query_source(sentry_init, capture_events, capture_items, span_str traces_sample_rate=1.0, enable_db_query_source=True, db_query_source_threshold_ms=0, - _experiments={ - "trace_lifecycle": "stream" if span_streaming else "static", - }, + trace_lifecycle="stream" if span_streaming else "static", ) if span_streaming: @@ -692,9 +686,7 @@ async def test_no_query_source_if_duration_too_short( traces_sample_rate=1.0, enable_db_query_source=True, db_query_source_threshold_ms=100, - _experiments={ - "trace_lifecycle": "stream" if span_streaming else "static", - }, + trace_lifecycle="stream" if span_streaming else "static", ) if span_streaming: @@ -789,9 +781,7 @@ async def test_query_source_if_duration_over_threshold( traces_sample_rate=1.0, enable_db_query_source=True, db_query_source_threshold_ms=100, - _experiments={ - "trace_lifecycle": "stream" if span_streaming else "static", - }, + trace_lifecycle="stream" if span_streaming else "static", ) if span_streaming: @@ -915,9 +905,7 @@ async def test_span_origin(sentry_init, capture_events, capture_items, span_stre sentry_init( integrations=[AioMySQLIntegration()], traces_sample_rate=1.0, - _experiments={ - "trace_lifecycle": "stream" if span_streaming else "static", - }, + trace_lifecycle="stream" if span_streaming else "static", ) if span_streaming: @@ -972,9 +960,7 @@ async def test_multiline_query_description_normalized( sentry_init( integrations=[AioMySQLIntegration()], traces_sample_rate=1.0, - _experiments={ - "trace_lifecycle": "stream" if span_streaming else "static", - }, + trace_lifecycle="stream" if span_streaming else "static", ) if span_streaming: @@ -1099,9 +1085,7 @@ async def test_db_data_on_spans( sentry_init( integrations=[AioMySQLIntegration()], traces_sample_rate=1.0, - _experiments={ - "trace_lifecycle": "stream" if span_streaming else "static", - }, + trace_lifecycle="stream" if span_streaming else "static", ) if span_streaming: diff --git a/tests/integrations/asgi/test_asgi.py b/tests/integrations/asgi/test_asgi.py index 76c730e5b6..f4e8266a69 100644 --- a/tests/integrations/asgi/test_asgi.py +++ b/tests/integrations/asgi/test_asgi.py @@ -186,9 +186,7 @@ async def test_capture_transaction( sentry_init( send_default_pii=should_send_pii, traces_sample_rate=1.0, - _experiments={ - "trace_lifecycle": "stream" if span_streaming else "static", - }, + trace_lifecycle="stream" if span_streaming else "static", ) app = SentryAsgiMiddleware(asgi3_app) @@ -262,9 +260,7 @@ async def test_capture_transaction_with_error( sentry_init( send_default_pii=True, traces_sample_rate=1.0, - _experiments={ - "trace_lifecycle": "stream" if span_streaming else "static", - }, + trace_lifecycle="stream" if span_streaming else "static", ) app = SentryAsgiMiddleware(asgi3_app_with_error) @@ -330,9 +326,7 @@ async def test_has_trace_if_performance_enabled( ): sentry_init( traces_sample_rate=1.0, - _experiments={ - "trace_lifecycle": "stream" if span_streaming else "static", - }, + trace_lifecycle="stream" if span_streaming else "static", ) app = SentryAsgiMiddleware(asgi3_app_with_error_and_msg) @@ -425,9 +419,7 @@ async def test_trace_from_headers_if_performance_enabled( ): sentry_init( traces_sample_rate=1.0, - _experiments={ - "trace_lifecycle": "stream" if span_streaming else "static", - }, + trace_lifecycle="stream" if span_streaming else "static", ) app = SentryAsgiMiddleware(asgi3_app_with_error_and_msg) @@ -526,9 +518,7 @@ async def test_websocket( sentry_init( send_default_pii=True, traces_sample_rate=1.0, - _experiments={ - "trace_lifecycle": "stream" if span_streaming else "static", - }, + trace_lifecycle="stream" if span_streaming else "static", ) asgi3_ws_app = SentryAsgiMiddleware(asgi3_ws_app) @@ -655,9 +645,7 @@ async def test_transaction_style( sentry_init( send_default_pii=True, traces_sample_rate=1.0, - _experiments={ - "trace_lifecycle": "stream" if span_streaming else "static", - }, + trace_lifecycle="stream" if span_streaming else "static", ) app = SentryAsgiMiddleware(asgi3_app, transaction_style=transaction_style) @@ -874,8 +862,8 @@ async def test_get_request_attributes_url_with_filtered_host( sentry_init( send_default_pii=True, traces_sample_rate=1.0, + trace_lifecycle="stream", _experiments={ - "trace_lifecycle": "stream", "data_collection": { "http_headers": {"request": {"mode": "allowlist", "terms": []}} }, @@ -906,8 +894,8 @@ async def test_get_request_attributes_url_with_headers_off( sentry_init( send_default_pii=True, traces_sample_rate=1.0, + trace_lifecycle="stream", _experiments={ - "trace_lifecycle": "stream", "data_collection": {"http_headers": {"request": {"mode": "off"}}}, }, ) @@ -1141,8 +1129,13 @@ async def test_get_request_attributes_query_data_collection( expected_url_full, ): kwargs = {k: v for k, v in init_kwargs.items() if k != "_experiments"} - experiments = {"trace_lifecycle": "stream", **init_kwargs.get("_experiments", {})} - sentry_init(traces_sample_rate=1.0, _experiments=experiments, **kwargs) + experiments = {**init_kwargs.get("_experiments", {})} + sentry_init( + traces_sample_rate=1.0, + trace_lifecycle="stream", + _experiments=experiments, + **kwargs, + ) app = SentryAsgiMiddleware(asgi3_app) items = capture_items("span") @@ -1243,8 +1236,13 @@ async def test_get_request_attributes_client_address_user_info( sentry_init, capture_items, asgi3_app, init_kwargs, has_client, expect_ip ): kwargs = {k: v for k, v in init_kwargs.items() if k != "_experiments"} - experiments = {"trace_lifecycle": "stream", **init_kwargs.get("_experiments", {})} - sentry_init(traces_sample_rate=1.0, _experiments=experiments, **kwargs) + experiments = {**init_kwargs.get("_experiments", {})} + sentry_init( + traces_sample_rate=1.0, + trace_lifecycle="stream", + _experiments=experiments, + **kwargs, + ) app = SentryAsgiMiddleware(asgi3_app) scope = _http_scope() @@ -1304,9 +1302,7 @@ async def test_transaction_name( """ sentry_init( traces_sample_rate=1.0, - _experiments={ - "trace_lifecycle": "stream" if span_streaming else "static", - }, + trace_lifecycle="stream" if span_streaming else "static", ) if span_streaming: @@ -1390,9 +1386,7 @@ def dummy_traces_sampler(sampling_context): sentry_init( traces_sampler=dummy_traces_sampler, traces_sample_rate=1.0, - _experiments={ - "trace_lifecycle": "stream" if span_streaming else "static", - }, + trace_lifecycle="stream" if span_streaming else "static", ) app = SentryAsgiMiddleware(asgi3_app, transaction_style=transaction_style) @@ -1415,9 +1409,7 @@ async def test_custom_transaction_name( ): sentry_init( traces_sample_rate=1.0, - _experiments={ - "trace_lifecycle": "stream" if span_streaming else "static", - }, + trace_lifecycle="stream" if span_streaming else "static", ) app = SentryAsgiMiddleware(asgi3_custom_transaction_app) diff --git a/tests/integrations/asyncio/test_asyncio.py b/tests/integrations/asyncio/test_asyncio.py index 19c0de82ea..53917ac6d4 100644 --- a/tests/integrations/asyncio/test_asyncio.py +++ b/tests/integrations/asyncio/test_asyncio.py @@ -76,9 +76,7 @@ async def test_create_task( integrations=[ AsyncioIntegration(), ], - _experiments={ - "trace_lifecycle": "stream" if span_streaming else "static", - }, + trace_lifecycle="stream" if span_streaming else "static", ) if span_streaming: @@ -171,9 +169,7 @@ async def test_gather( integrations=[ AsyncioIntegration(), ], - _experiments={ - "trace_lifecycle": "stream" if span_streaming else "static", - }, + trace_lifecycle="stream" if span_streaming else "static", ) if span_streaming: @@ -463,9 +459,7 @@ async def test_span_origin( sentry_init( integrations=[AsyncioIntegration()], traces_sample_rate=1.0, - _experiments={ - "trace_lifecycle": "stream" if span_streaming else "static", - }, + trace_lifecycle="stream" if span_streaming else "static", ) if span_streaming: @@ -520,9 +514,7 @@ async def test_task_spans_false( integrations=[ AsyncioIntegration(task_spans=False), ], - _experiments={ - "trace_lifecycle": "stream" if span_streaming else "static", - }, + trace_lifecycle="stream" if span_streaming else "static", ) if span_streaming: @@ -594,9 +586,7 @@ async def test_delayed_enable_integration( ): sentry_init( traces_sample_rate=1.0, - _experiments={ - "trace_lifecycle": "stream" if span_streaming else "static", - }, + trace_lifecycle="stream" if span_streaming else "static", ) assert "asyncio" not in sentry_sdk.get_client().integrations @@ -711,9 +701,7 @@ async def test_delayed_enable_integration_after_disabling( sentry_init( disabled_integrations=[AsyncioIntegration()], traces_sample_rate=1.0, - _experiments={ - "trace_lifecycle": "stream" if span_streaming else "static", - }, + trace_lifecycle="stream" if span_streaming else "static", ) assert "asyncio" not in sentry_sdk.get_client().integrations @@ -782,9 +770,7 @@ async def test_internal_tasks_not_wrapped( sentry_init( integrations=[AsyncioIntegration()], traces_sample_rate=1.0, - _experiments={ - "trace_lifecycle": "stream" if span_streaming else "static", - }, + trace_lifecycle="stream" if span_streaming else "static", ) async def user_task(): diff --git a/tests/integrations/asyncpg/test_asyncpg.py b/tests/integrations/asyncpg/test_asyncpg.py index 3aa4cf30a3..1991b9af05 100644 --- a/tests/integrations/asyncpg/test_asyncpg.py +++ b/tests/integrations/asyncpg/test_asyncpg.py @@ -116,9 +116,9 @@ async def test_connect( ) -> None: sentry_init( integrations=[AsyncPGIntegration()], + trace_lifecycle="stream" if span_streaming else "static", _experiments={ "record_sql_params": True, - "trace_lifecycle": "stream" if span_streaming else "static", }, ) @@ -154,9 +154,9 @@ async def test_execute( ) -> None: sentry_init( integrations=[AsyncPGIntegration()], + trace_lifecycle="stream" if span_streaming else "static", _experiments={ "record_sql_params": True, - "trace_lifecycle": "stream" if span_streaming else "static", }, ) @@ -235,9 +235,9 @@ async def test_execute_many( ) -> None: sentry_init( integrations=[AsyncPGIntegration()], + trace_lifecycle="stream" if span_streaming else "static", _experiments={ "record_sql_params": True, - "trace_lifecycle": "stream" if span_streaming else "static", }, ) @@ -564,9 +564,7 @@ async def test_query_source_disabled( "traces_sample_rate": 1.0, "enable_db_query_source": False, "db_query_source_threshold_ms": 0, - "_experiments": { - "trace_lifecycle": "stream" if span_streaming else "static", - }, + "trace_lifecycle": "stream" if span_streaming else "static", } sentry_init(**sentry_options) @@ -628,9 +626,7 @@ async def test_query_source_enabled( "integrations": [AsyncPGIntegration()], "traces_sample_rate": 1.0, "db_query_source_threshold_ms": 0, - "_experiments": { - "trace_lifecycle": "stream" if span_streaming else "static", - }, + "trace_lifecycle": "stream" if span_streaming else "static", } if enable_db_query_source is not None: sentry_options["enable_db_query_source"] = enable_db_query_source @@ -695,9 +691,7 @@ async def test_query_source(sentry_init, capture_events, capture_items, span_str traces_sample_rate=1.0, enable_db_query_source=True, db_query_source_threshold_ms=0, - _experiments={ - "trace_lifecycle": "stream" if span_streaming else "static", - }, + trace_lifecycle="stream" if span_streaming else "static", ) if span_streaming: @@ -775,9 +769,7 @@ async def test_query_source_with_module_in_search_path( traces_sample_rate=1.0, enable_db_query_source=True, db_query_source_threshold_ms=0, - _experiments={ - "trace_lifecycle": "stream" if span_streaming else "static", - }, + trace_lifecycle="stream" if span_streaming else "static", ) from asyncpg_helpers.helpers import execute_query_in_connection @@ -855,9 +847,7 @@ async def test_no_query_source_if_duration_too_short( traces_sample_rate=1.0, enable_db_query_source=True, db_query_source_threshold_ms=100, - _experiments={ - "trace_lifecycle": "stream" if span_streaming else "static", - }, + trace_lifecycle="stream" if span_streaming else "static", ) if span_streaming: @@ -1004,9 +994,7 @@ async def test_span_origin(sentry_init, capture_events, capture_items, span_stre sentry_init( integrations=[AsyncPGIntegration()], traces_sample_rate=1.0, - _experiments={ - "trace_lifecycle": "stream" if span_streaming else "static", - }, + trace_lifecycle="stream" if span_streaming else "static", ) if span_streaming: @@ -1063,9 +1051,7 @@ async def test_multiline_query_description_normalized( sentry_init( integrations=[AsyncPGIntegration()], traces_sample_rate=1.0, - _experiments={ - "trace_lifecycle": "stream" if span_streaming else "static", - }, + trace_lifecycle="stream" if span_streaming else "static", ) if span_streaming: @@ -1203,9 +1189,7 @@ async def test_query_source_execute( traces_sample_rate=1.0, enable_db_query_source=True, db_query_source_threshold_ms=0, - _experiments={ - "trace_lifecycle": "stream" if span_streaming else "static", - }, + trace_lifecycle="stream" if span_streaming else "static", ) if span_streaming: @@ -1264,9 +1248,7 @@ async def test_query_source_executemany( traces_sample_rate=1.0, enable_db_query_source=True, db_query_source_threshold_ms=0, - _experiments={ - "trace_lifecycle": "stream" if span_streaming else "static", - }, + trace_lifecycle="stream" if span_streaming else "static", ) if span_streaming: @@ -1320,9 +1302,7 @@ async def test_query_source_prepare( traces_sample_rate=1.0, enable_db_query_source=True, db_query_source_threshold_ms=0, - _experiments={ - "trace_lifecycle": "stream" if span_streaming else "static", - }, + trace_lifecycle="stream" if span_streaming else "static", ) if span_streaming: @@ -1384,9 +1364,7 @@ async def test_cursor_iteration_creates_db_cursor_iter_spans( sentry_init( integrations=[AsyncPGIntegration()], traces_sample_rate=1.0, - _experiments={ - "trace_lifecycle": "stream" if span_streaming else "static", - }, + trace_lifecycle="stream" if span_streaming else "static", ) if span_streaming: diff --git a/tests/integrations/clickhouse_driver/test_clickhouse_driver.py b/tests/integrations/clickhouse_driver/test_clickhouse_driver.py index d19f630c4b..1cec232548 100644 --- a/tests/integrations/clickhouse_driver/test_clickhouse_driver.py +++ b/tests/integrations/clickhouse_driver/test_clickhouse_driver.py @@ -642,8 +642,8 @@ def test_clickhouse_client_span_streaming_with_data_collection( sentry_init( integrations=[ClickhouseDriverIntegration()], traces_sample_rate=1.0, + trace_lifecycle="stream", _experiments={ - "trace_lifecycle": "stream", "data_collection": {"database_query_data": True}, }, ) @@ -742,9 +742,9 @@ def test_clickhouse_client_spans( ): sentry_init( integrations=[ClickhouseDriverIntegration()], + trace_lifecycle="stream" if span_streaming else "static", _experiments={ "record_sql_params": True, - "trace_lifecycle": "stream" if span_streaming else "static", }, traces_sample_rate=1.0, ) @@ -1033,9 +1033,9 @@ def test_clickhouse_client_spans_with_pii( ): sentry_init( integrations=[ClickhouseDriverIntegration()], + trace_lifecycle="stream" if span_streaming else "static", _experiments={ "record_sql_params": True, - "trace_lifecycle": "stream" if span_streaming else "static", }, traces_sample_rate=1.0, send_default_pii=True, @@ -1489,9 +1489,9 @@ def test_clickhouse_dbapi_spans( ): sentry_init( integrations=[ClickhouseDriverIntegration()], + trace_lifecycle="stream" if span_streaming else "static", _experiments={ "record_sql_params": True, - "trace_lifecycle": "stream" if span_streaming else "static", }, traces_sample_rate=1.0, ) @@ -1746,9 +1746,9 @@ def test_clickhouse_dbapi_spans_with_pii( ): sentry_init( integrations=[ClickhouseDriverIntegration()], + trace_lifecycle="stream" if span_streaming else "static", _experiments={ "record_sql_params": True, - "trace_lifecycle": "stream" if span_streaming else "static", }, traces_sample_rate=1.0, send_default_pii=True, diff --git a/tests/integrations/django/asgi/test_asgi.py b/tests/integrations/django/asgi/test_asgi.py index 8c58a5c6a6..9abf52b120 100644 --- a/tests/integrations/django/asgi/test_asgi.py +++ b/tests/integrations/django/asgi/test_asgi.py @@ -377,9 +377,9 @@ async def test_async_middleware_spans( sentry_init( integrations=[DjangoIntegration(middleware_spans=True)], traces_sample_rate=1.0, + trace_lifecycle="stream" if span_streaming else "static", _experiments={ "record_sql_params": True, - "trace_lifecycle": "stream" if span_streaming else "static", }, ) diff --git a/tests/integrations/django/test_basic.py b/tests/integrations/django/test_basic.py index 886477cf5c..8f6c32cdb0 100644 --- a/tests/integrations/django/test_basic.py +++ b/tests/integrations/django/test_basic.py @@ -881,9 +881,9 @@ def test_sql_psycopg2_string_composition( sentry_init( integrations=[DjangoIntegration()], send_default_pii=True, + trace_lifecycle="stream" if span_streaming else "static", _experiments={ "record_sql_params": True, - "trace_lifecycle": "stream" if span_streaming else "static", }, ) from django.db import connections @@ -933,9 +933,9 @@ def test_sql_psycopg2_placeholders( sentry_init( integrations=[DjangoIntegration()], send_default_pii=True, + trace_lifecycle="stream" if span_streaming else "static", _experiments={ "record_sql_params": True, - "trace_lifecycle": "stream" if span_streaming else "static", }, ) from django.db import connections diff --git a/tests/integrations/django/test_data_scrubbing.py b/tests/integrations/django/test_data_scrubbing.py index c60497d21f..2627c66a4a 100644 --- a/tests/integrations/django/test_data_scrubbing.py +++ b/tests/integrations/django/test_data_scrubbing.py @@ -338,10 +338,8 @@ def test_span_http_query_data_collection( sentry_init( integrations=[DjangoIntegration()], traces_sample_rate=1.0, - _experiments={ - "trace_lifecycle": "stream", - **init_kwargs.pop("_experiments", {}), - }, + trace_lifecycle="stream", + **init_kwargs.pop("_experiments", {}), **init_kwargs, ) diff --git a/tests/integrations/fastapi/test_fastapi.py b/tests/integrations/fastapi/test_fastapi.py index 41424bc27f..913396f356 100644 --- a/tests/integrations/fastapi/test_fastapi.py +++ b/tests/integrations/fastapi/test_fastapi.py @@ -134,9 +134,7 @@ async def test_request_info_json_body( traces_sample_rate=1.0, send_default_pii=True, integrations=[StarletteIntegration()], - _experiments={ - "trace_lifecycle": "stream" if span_streaming else "static", - }, + trace_lifecycle="stream" if span_streaming else "static", ) app = fastapi_app_factory() @@ -205,9 +203,7 @@ async def test_formdata_request_body( send_default_pii=True, max_request_body_size="always", integrations=[StarletteIntegration()], - _experiments={ - "trace_lifecycle": "stream" if span_streaming else "static", - }, + trace_lifecycle="stream" if span_streaming else "static", ) app = fastapi_app_factory() @@ -285,9 +281,7 @@ async def test_request_body_too_big( traces_sample_rate=1.0, send_default_pii=True, integrations=[StarletteIntegration()], - _experiments={ - "trace_lifecycle": "stream" if span_streaming else "static", - }, + trace_lifecycle="stream" if span_streaming else "static", ) app = fastapi_app_factory() @@ -536,9 +530,7 @@ async def test_original_request_not_scrubbed( auto_enabling_integrations=False, # Ensure httpx is not auto-enabled; its legacy start_span interferes with streaming mode integrations=[StarletteIntegration(), FastApiIntegration()], traces_sample_rate=1.0, - _experiments={ - "trace_lifecycle": "stream" if span_streaming else "static", - }, + trace_lifecycle="stream" if span_streaming else "static", ) app = FastAPI() @@ -703,9 +695,7 @@ def test_transaction_name( FastApiIntegration(transaction_style=transaction_style), ], traces_sample_rate=1.0, - _experiments={ - "trace_lifecycle": "stream" if span_streaming else "static", - }, + trace_lifecycle="stream" if span_streaming else "static", ) if span_streaming: @@ -753,9 +743,7 @@ def test_transaction_name_with_prefix( FastApiIntegration(transaction_style="url"), ], traces_sample_rate=1.0, - _experiments={ - "trace_lifecycle": "stream" if span_streaming else "static", - }, + trace_lifecycle="stream" if span_streaming else "static", ) if span_streaming: @@ -1056,9 +1044,7 @@ def test_request_url(sentry_init, capture_events, capture_items, span_streaming) integrations=[ StarletteIntegration(), ], - _experiments={ - "trace_lifecycle": "stream" if span_streaming else "static", - }, + trace_lifecycle="stream" if span_streaming else "static", ) starlette_app = fastapi_app_factory() diff --git a/tests/integrations/flask/test_flask.py b/tests/integrations/flask/test_flask.py index e770fb99ca..e2ab528e41 100644 --- a/tests/integrations/flask/test_flask.py +++ b/tests/integrations/flask/test_flask.py @@ -1345,10 +1345,8 @@ def test_span_http_query_data_collection( sentry_init( integrations=[flask_sentry.FlaskIntegration()], traces_sample_rate=1.0, - _experiments={ - "trace_lifecycle": "stream", - **init_kwargs.pop("_experiments", {}), - }, + trace_lifecycle="stream", + **init_kwargs.pop("_experiments", {}), **init_kwargs, ) monkeypatch.setattr(flask_sentry, "flask_login", None) diff --git a/tests/integrations/litestar/test_litestar.py b/tests/integrations/litestar/test_litestar.py index 6f3615dabc..07880aee8f 100644 --- a/tests/integrations/litestar/test_litestar.py +++ b/tests/integrations/litestar/test_litestar.py @@ -169,9 +169,7 @@ def test_transaction_name_and_source( sentry_init( traces_sample_rate=1.0, integrations=[LitestarIntegration()], - _experiments={ - "trace_lifecycle": "stream" if span_streaming else "static", - }, + trace_lifecycle="stream" if span_streaming else "static", ) litestar_app = litestar_app_factory() client = TestClient(litestar_app) diff --git a/tests/integrations/mcp/test_mcp.py b/tests/integrations/mcp/test_mcp.py index ccb1322afa..9e427830ab 100644 --- a/tests/integrations/mcp/test_mcp.py +++ b/tests/integrations/mcp/test_mcp.py @@ -77,10 +77,6 @@ async def __call__(self, *args, **kwargs): from sentry_sdk.integrations.mcp import MCPIntegration -def _experiments_for(span_streaming): - return {"trace_lifecycle": "stream" if span_streaming else "static"} - - def _get_response(session_message): """Extract the JSON-RPC response from a SessionMessage (v1 or v2).""" msg = session_message.message @@ -176,7 +172,7 @@ async def test_tool_handler_constructor_registration( sentry_init( integrations=[MCPIntegration()], traces_sample_rate=1.0, - _experiments=_experiments_for(span_streaming), + trace_lifecycle="stream" if span_streaming else "static", ) async def test_tool(ctx, params): @@ -276,7 +272,7 @@ async def test_wrapping_handler_is_idempotent( sentry_init( integrations=[MCPIntegration()], traces_sample_rate=1.0, - _experiments=_experiments_for(span_streaming), + trace_lifecycle="stream" if span_streaming else "static", ) async def test_tool(ctx, params): @@ -340,7 +336,7 @@ async def test_tool_handler_stdio( integrations=[MCPIntegration(include_prompts=include_prompts)], traces_sample_rate=1.0, send_default_pii=send_default_pii, - _experiments=_experiments_for(span_streaming), + trace_lifecycle="stream" if span_streaming else "static", ) server = Server("test-server") @@ -465,7 +461,7 @@ async def test_tool_handler_streamable_http( integrations=[MCPIntegration(include_prompts=include_prompts)], traces_sample_rate=1.0, send_default_pii=send_default_pii, - _experiments=_experiments_for(span_streaming), + trace_lifecycle="stream" if span_streaming else "static", ) server = Server("test-server") @@ -587,7 +583,7 @@ async def test_tool_handler_with_error( sentry_init( integrations=[MCPIntegration()], traces_sample_rate=1.0, - _experiments=_experiments_for(span_streaming), + trace_lifecycle="stream" if span_streaming else "static", ) server = Server("test-server") @@ -692,7 +688,7 @@ async def test_prompt_handler_stdio( integrations=[MCPIntegration(include_prompts=include_prompts)], traces_sample_rate=1.0, send_default_pii=send_default_pii, - _experiments=_experiments_for(span_streaming), + trace_lifecycle="stream" if span_streaming else "static", ) server = Server("test-server") @@ -811,7 +807,7 @@ async def test_prompt_handler_streamable_http( integrations=[MCPIntegration(include_prompts=include_prompts)], traces_sample_rate=1.0, send_default_pii=send_default_pii, - _experiments=_experiments_for(span_streaming), + trace_lifecycle="stream" if span_streaming else "static", ) server = Server("test-server") @@ -918,7 +914,7 @@ async def test_prompt_handler_with_error( sentry_init( integrations=[MCPIntegration()], traces_sample_rate=1.0, - _experiments=_experiments_for(span_streaming), + trace_lifecycle="stream" if span_streaming else "static", ) server = Server("test-server") @@ -999,7 +995,7 @@ async def test_resource_handler_stdio( sentry_init( integrations=[MCPIntegration()], traces_sample_rate=1.0, - _experiments=_experiments_for(span_streaming), + trace_lifecycle="stream" if span_streaming else "static", ) server = Server("test-server") @@ -1101,7 +1097,7 @@ async def test_resource_handler_streamable_http( sentry_init( integrations=[MCPIntegration()], traces_sample_rate=1.0, - _experiments=_experiments_for(span_streaming), + trace_lifecycle="stream" if span_streaming else "static", ) server = Server("test-server") @@ -1206,7 +1202,7 @@ async def test_resource_handler_with_error( sentry_init( integrations=[MCPIntegration()], traces_sample_rate=1.0, - _experiments=_experiments_for(span_streaming), + trace_lifecycle="stream" if span_streaming else "static", ) server = Server("test-server") @@ -1292,7 +1288,7 @@ async def test_tool_result_extraction_tuple( integrations=[MCPIntegration(include_prompts=include_prompts)], traces_sample_rate=1.0, send_default_pii=send_default_pii, - _experiments=_experiments_for(span_streaming), + trace_lifecycle="stream" if span_streaming else "static", ) server = Server("test-server") @@ -1380,7 +1376,7 @@ async def test_tool_result_extraction_unstructured( integrations=[MCPIntegration(include_prompts=include_prompts)], traces_sample_rate=1.0, send_default_pii=send_default_pii, - _experiments=_experiments_for(span_streaming), + trace_lifecycle="stream" if span_streaming else "static", ) server = Server("test-server") @@ -1456,7 +1452,7 @@ async def test_multiple_handlers( sentry_init( integrations=[MCPIntegration()], traces_sample_rate=1.0, - _experiments=_experiments_for(span_streaming), + trace_lifecycle="stream" if span_streaming else "static", ) server = Server("test-server") @@ -1596,7 +1592,7 @@ async def test_prompt_with_dict_result( integrations=[MCPIntegration(include_prompts=include_prompts)], traces_sample_rate=1.0, send_default_pii=send_default_pii, - _experiments=_experiments_for(span_streaming), + trace_lifecycle="stream" if span_streaming else "static", ) server = Server("test-server") @@ -1680,7 +1676,7 @@ async def test_tool_with_complex_arguments( sentry_init( integrations=[MCPIntegration()], traces_sample_rate=1.0, - _experiments=_experiments_for(span_streaming), + trace_lifecycle="stream" if span_streaming else "static", ) server = Server("test-server") @@ -1756,7 +1752,7 @@ async def test_sse_transport_detection( sentry_init( integrations=[MCPIntegration()], traces_sample_rate=1.0, - _experiments=_experiments_for(span_streaming), + trace_lifecycle="stream" if span_streaming else "static", ) server = Server("test-server") @@ -1864,7 +1860,7 @@ async def test_sse_transport_detection_v2( sentry_init( integrations=[MCPIntegration()], traces_sample_rate=1.0, - _experiments=_experiments_for(span_streaming), + trace_lifecycle="stream" if span_streaming else "static", ) server = Server("test-server") diff --git a/tests/integrations/openai_agents/test_openai_agents.py b/tests/integrations/openai_agents/test_openai_agents.py index 1b03989b6a..d8afab98a4 100644 --- a/tests/integrations/openai_agents/test_openai_agents.py +++ b/tests/integrations/openai_agents/test_openai_agents.py @@ -838,9 +838,7 @@ async def test_client_span_custom_model( disabled_integrations=[StdlibIntegration], traces_sample_rate=1.0, stream_gen_ai_spans=stream_gen_ai_spans, - _experiments={ - "trace_lifecycle": "stream" if span_streaming else "static" - }, + trace_lifecycle="stream" if span_streaming else "static", ) items = capture_items("span") @@ -1603,9 +1601,7 @@ async def test_handoff_span( disabled_integrations=[StdlibIntegration], traces_sample_rate=1.0, stream_gen_ai_spans=stream_gen_ai_spans, - _experiments={ - "trace_lifecycle": "stream" if span_streaming else "static" - }, + trace_lifecycle="stream" if span_streaming else "static", ) items = capture_items("transaction", "span") @@ -1782,9 +1778,7 @@ async def test_max_turns_before_handoff_span( disabled_integrations=[StdlibIntegration], traces_sample_rate=1.0, stream_gen_ai_spans=stream_gen_ai_spans, - _experiments={ - "trace_lifecycle": "stream" if span_streaming else "static" - }, + trace_lifecycle="stream" if span_streaming else "static", ) items = capture_items("transaction", "span") @@ -3228,9 +3222,7 @@ async def test_error_captures_input_data( traces_sample_rate=1.0, send_default_pii=True, stream_gen_ai_spans=stream_gen_ai_spans, - _experiments={ - "trace_lifecycle": "stream" if span_streaming else "static" - }, + trace_lifecycle="stream" if span_streaming else "static", ) items = capture_items("event", "span") @@ -3662,9 +3654,7 @@ def failing_tool(message: str) -> str: traces_sample_rate=1.0, send_default_pii=True, stream_gen_ai_spans=stream_gen_ai_spans, - _experiments={ - "trace_lifecycle": "stream" if span_streaming else "static" - }, + trace_lifecycle="stream" if span_streaming else "static", ) items = capture_items("span", "transaction") @@ -3815,9 +3805,7 @@ async def test_invoke_agent_span_includes_usage_data( traces_sample_rate=1.0, send_default_pii=True, stream_gen_ai_spans=stream_gen_ai_spans, - _experiments={ - "trace_lifecycle": "stream" if span_streaming else "static" - }, + trace_lifecycle="stream" if span_streaming else "static", ) items = capture_items("span", "transaction") @@ -3959,9 +3947,7 @@ async def test_ai_client_span_includes_response_model( traces_sample_rate=1.0, send_default_pii=True, stream_gen_ai_spans=stream_gen_ai_spans, - _experiments={ - "trace_lifecycle": "stream" if span_streaming else "static" - }, + trace_lifecycle="stream" if span_streaming else "static", ) items = capture_items("span", "transaction") @@ -4090,9 +4076,7 @@ async def test_ai_client_span_response_model_with_chat_completions( disabled_integrations=[StdlibIntegration], traces_sample_rate=1.0, stream_gen_ai_spans=stream_gen_ai_spans, - _experiments={ - "trace_lifecycle": "stream" if span_streaming else "static" - }, + trace_lifecycle="stream" if span_streaming else "static", ) items = capture_items("span", "transaction") @@ -4433,9 +4417,7 @@ async def test_invoke_agent_span_includes_response_model( traces_sample_rate=1.0, send_default_pii=True, stream_gen_ai_spans=stream_gen_ai_spans, - _experiments={ - "trace_lifecycle": "stream" if span_streaming else "static" - }, + trace_lifecycle="stream" if span_streaming else "static", ) items = capture_items("span", "transaction") @@ -5071,9 +5053,7 @@ async def test_conversation_id_on_all_spans( integrations=[OpenAIAgentsIntegration()], traces_sample_rate=1.0, stream_gen_ai_spans=stream_gen_ai_spans, - _experiments={ - "trace_lifecycle": "stream" if span_streaming else "static" - }, + trace_lifecycle="stream" if span_streaming else "static", ) items = capture_items("span", "transaction") diff --git a/tests/integrations/sqlalchemy/test_sqlalchemy.py b/tests/integrations/sqlalchemy/test_sqlalchemy.py index 15cddb2f7c..e08bb0a423 100644 --- a/tests/integrations/sqlalchemy/test_sqlalchemy.py +++ b/tests/integrations/sqlalchemy/test_sqlalchemy.py @@ -26,9 +26,9 @@ def test_orm_queries( ): sentry_init( integrations=[SqlalchemyIntegration()], + trace_lifecycle="stream" if span_streaming else "static", _experiments={ "record_sql_params": True, - "trace_lifecycle": "stream" if span_streaming else "static", }, ) @@ -101,9 +101,9 @@ def test_transactions( ): sentry_init( integrations=[SqlalchemyIntegration()], + trace_lifecycle="stream" if span_streaming else "static", _experiments={ "record_sql_params": True, - "trace_lifecycle": "stream" if span_streaming else "static", }, traces_sample_rate=1.0, ) @@ -231,9 +231,9 @@ def test_transactions_no_engine_url( ): sentry_init( integrations=[SqlalchemyIntegration()], + trace_lifecycle="stream" if span_streaming else "static", _experiments={ "record_sql_params": True, - "trace_lifecycle": "stream" if span_streaming else "static", }, traces_sample_rate=1.0, ) diff --git a/tests/integrations/starlette/test_starlette.py b/tests/integrations/starlette/test_starlette.py index 8c89c9b399..a29f1aa56e 100644 --- a/tests/integrations/starlette/test_starlette.py +++ b/tests/integrations/starlette/test_starlette.py @@ -296,9 +296,7 @@ async def test_request_info_json_body( traces_sample_rate=1.0, send_default_pii=True, integrations=[StarletteIntegration()], - _experiments={ - "trace_lifecycle": "stream" if span_streaming else "static", - }, + trace_lifecycle="stream" if span_streaming else "static", ) starlette_app = starlette_app_factory() @@ -367,9 +365,7 @@ async def test_formdata_request_body( send_default_pii=True, max_request_body_size="always", integrations=[StarletteIntegration()], - _experiments={ - "trace_lifecycle": "stream" if span_streaming else "static", - }, + trace_lifecycle="stream" if span_streaming else "static", ) starlette_app = starlette_app_factory() @@ -447,9 +443,7 @@ async def test_request_body_too_big( traces_sample_rate=1.0, send_default_pii=True, integrations=[StarletteIntegration()], - _experiments={ - "trace_lifecycle": "stream" if span_streaming else "static", - }, + trace_lifecycle="stream" if span_streaming else "static", ) starlette_app = starlette_app_factory() @@ -765,10 +759,8 @@ def test_span_http_query_data_collection( auto_enabling_integrations=False, integrations=[StarletteIntegration()], traces_sample_rate=1.0, - _experiments={ - "trace_lifecycle": "stream", - **init_kwargs.pop("_experiments", {}), - }, + trace_lifecycle="stream", + **init_kwargs.pop("_experiments", {}), **init_kwargs, ) @@ -1115,9 +1107,7 @@ def test_middleware_spans(sentry_init, capture_events, capture_items, span_strea traces_sample_rate=1.0, integrations=[StarletteIntegration(middleware_spans=True)], auto_enabling_integrations=False, # disable because httpx will enable otherwise, leading to the segment span being an `http.client` sentry.op (the TestClient initiating the request), rather than the more realistic `http.server`. - _experiments={ - "trace_lifecycle": "stream" if span_streaming else "static", - }, + trace_lifecycle="stream" if span_streaming else "static", ) starlette_app = starlette_app_factory( middleware=[Middleware(AuthenticationMiddleware, backend=BasicAuthBackend())] @@ -1187,9 +1177,7 @@ def test_middleware_spans_disabled( traces_sample_rate=1.0, integrations=[StarletteIntegration(middleware_spans=False)], auto_enabling_integrations=False, # disable because httpx will enable otherwise, leading to the segment span being an `http.client` sentry.op (the TestClient initiating the request), rather than the more realistic `http.server`. - _experiments={ - "trace_lifecycle": "stream" if span_streaming else "static", - }, + trace_lifecycle="stream" if span_streaming else "static", ) starlette_app = starlette_app_factory( middleware=[Middleware(AuthenticationMiddleware, backend=BasicAuthBackend())] @@ -1229,9 +1217,7 @@ def test_middleware_callback_spans( traces_sample_rate=1.0, integrations=[StarletteIntegration(middleware_spans=True)], auto_enabling_integrations=False, # disable because httpx will enable otherwise, leading to the segment span being an `http.client` sentry.op (the TestClient initiating the request), rather than the more realistic `http.server`. - _experiments={ - "trace_lifecycle": "stream" if span_streaming else "static", - }, + trace_lifecycle="stream" if span_streaming else "static", ) starlette_app = starlette_app_factory(middleware=[Middleware(SampleMiddleware)]) @@ -1749,9 +1735,7 @@ def test_span_origin(sentry_init, capture_events, capture_items, span_streaming) auto_enabling_integrations=False, # avoid httpx auto-instrumentation leaking spans integrations=[StarletteIntegration(middleware_spans=True)], traces_sample_rate=1.0, - _experiments={ - "trace_lifecycle": "stream" if span_streaming else "static", - }, + trace_lifecycle="stream" if span_streaming else "static", ) starlette_app = starlette_app_factory( middleware=[Middleware(AuthenticationMiddleware, backend=BasicAuthBackend())] @@ -1896,9 +1880,7 @@ def test_request_url(sentry_init, capture_events, capture_items, span_streaming) integrations=[ StarletteIntegration(), ], - _experiments={ - "trace_lifecycle": "stream" if span_streaming else "static", - }, + trace_lifecycle="stream" if span_streaming else "static", ) starlette_app = starlette_app_factory() diff --git a/tests/integrations/starlite/test_starlite.py b/tests/integrations/starlite/test_starlite.py index d596a5921f..e6a416d1f0 100644 --- a/tests/integrations/starlite/test_starlite.py +++ b/tests/integrations/starlite/test_starlite.py @@ -143,9 +143,7 @@ def test_transaction_name_and_source( sentry_init( traces_sample_rate=1.0, integrations=[StarliteIntegration()], - _experiments={ - "trace_lifecycle": "stream" if span_streaming else "static", - }, + trace_lifecycle="stream" if span_streaming else "static", ) starlite_app = starlite_app_factory() client = TestClient(starlite_app) @@ -181,9 +179,7 @@ def test_middleware_spans(sentry_init, capture_events, capture_items, span_strea sentry_init( traces_sample_rate=1.0, integrations=[StarliteIntegration()], - _experiments={ - "trace_lifecycle": "stream" if span_streaming else "static", - }, + trace_lifecycle="stream" if span_streaming else "static", ) logging_config = LoggingMiddlewareConfig() @@ -262,9 +258,7 @@ async def do_stuff(message): sentry_init( traces_sample_rate=1.0, integrations=[StarliteIntegration()], - _experiments={ - "trace_lifecycle": "stream" if span_streaming else "static", - }, + trace_lifecycle="stream" if span_streaming else "static", ) starlite_app = starlite_app_factory(middleware=[SampleMiddleware]) @@ -392,9 +386,7 @@ async def my_send(*args, **kwargs): sentry_init( traces_sample_rate=1.0, integrations=[StarliteIntegration()], - _experiments={ - "trace_lifecycle": "stream" if span_streaming else "static", - }, + trace_lifecycle="stream" if span_streaming else "static", ) starlite_app = starlite_app_factory(middleware=[SamplePartialReceiveSendMiddleware]) @@ -478,9 +470,7 @@ def test_span_origin(sentry_init, capture_events, capture_items, span_streaming) sentry_init( integrations=[StarliteIntegration()], traces_sample_rate=1.0, - _experiments={ - "trace_lifecycle": "stream" if span_streaming else "static", - }, + trace_lifecycle="stream" if span_streaming else "static", ) logging_config = LoggingMiddlewareConfig() diff --git a/tests/integrations/wsgi/test_wsgi.py b/tests/integrations/wsgi/test_wsgi.py index eb73be1499..b50d95e868 100644 --- a/tests/integrations/wsgi/test_wsgi.py +++ b/tests/integrations/wsgi/test_wsgi.py @@ -155,9 +155,7 @@ def dogpark(environ, start_response): sentry_init( send_default_pii=True, traces_sample_rate=1.0, - _experiments={ - "trace_lifecycle": "stream" if span_streaming else "static", - }, + trace_lifecycle="stream" if span_streaming else "static", ) app = SentryWsgiMiddleware(dogpark) client = Client(app) @@ -226,9 +224,7 @@ def dogpark(environ, start_response): sentry_init( send_default_pii=send_pii, traces_sample_rate=1.0, - _experiments={ - "trace_lifecycle": "stream" if span_streaming else "static", - }, + trace_lifecycle="stream" if span_streaming else "static", ) app = SentryWsgiMiddleware(dogpark) client = Client(app) @@ -294,9 +290,7 @@ def dogpark(environ, start_response): sentry_init( traces_sample_rate=1.0, - _experiments={ - "trace_lifecycle": "stream" if span_streaming else "static", - }, + trace_lifecycle="stream" if span_streaming else "static", ) app = SentryWsgiMiddleware(dogpark) client = Client(app) @@ -390,9 +384,7 @@ def dogpark(environ, start_response): sentry_init( traces_sample_rate=1.0, - _experiments={ - "trace_lifecycle": "stream" if span_streaming else "static", - }, + trace_lifecycle="stream" if span_streaming else "static", ) app = SentryWsgiMiddleware(dogpark) client = Client(app) @@ -483,9 +475,7 @@ def app(environ, start_response): sentry_init( send_default_pii=True, traces_sampler=traces_sampler, - _experiments={ - "trace_lifecycle": "stream" if span_streaming else "static", - }, + trace_lifecycle="stream" if span_streaming else "static", ) app = SentryWsgiMiddleware(app) client = Client(app) @@ -529,9 +519,7 @@ def app(environ, start_response): sentry_init( send_default_pii=True, traces_sampler=traces_sampler, - _experiments={ - "trace_lifecycle": "stream" if span_streaming else "static", - }, + trace_lifecycle="stream" if span_streaming else "static", ) app = SentryWsgiMiddleware(app) envelopes = capture_envelopes() @@ -574,9 +562,7 @@ def sample_app(environ, start_response): sentry_init( send_default_pii=True, traces_sampler=traces_sampler, - _experiments={ - "trace_lifecycle": "stream" if span_streaming else "static", - }, + trace_lifecycle="stream" if span_streaming else "static", ) app = SentryWsgiMiddleware(sample_app) envelopes = capture_envelopes() @@ -650,9 +636,7 @@ def dogpark(environ, start_response): sentry_init( send_default_pii=True, traces_sample_rate=1.0, - _experiments={ - "trace_lifecycle": "stream" if span_streaming else "static", - }, + trace_lifecycle="stream" if span_streaming else "static", ) app = SentryWsgiMiddleware(dogpark) @@ -683,9 +667,7 @@ def dogpark(environ, start_response): sentry_init( send_default_pii=True, traces_sample_rate=1.0, - _experiments={ - "trace_lifecycle": "stream" if span_streaming else "static", - }, + trace_lifecycle="stream" if span_streaming else "static", ) app = SentryWsgiMiddleware( dogpark, @@ -1249,10 +1231,8 @@ def dogpark(environ, start_response): sentry_init( traces_sample_rate=1.0, - _experiments={ - "trace_lifecycle": "stream", - **init_kwargs.pop("_experiments", {}), - }, + trace_lifecycle="stream", + **init_kwargs.pop("_experiments", {}), **init_kwargs, ) app = SentryWsgiMiddleware(dogpark) diff --git a/tests/test_attributes.py b/tests/test_attributes.py index dbe0cde844..d76bb13c8f 100644 --- a/tests/test_attributes.py +++ b/tests/test_attributes.py @@ -191,9 +191,7 @@ def test_user_attributes(sentry_init, capture_items): sentry_init( traces_sample_rate=1.0, send_default_pii=True, - _experiments={ - "trace_lifecycle": "stream", - }, + trace_lifecycle="stream", ) items = capture_items("trace_metric", "span") diff --git a/tests/tracing/test_decorator.py b/tests/tracing/test_decorator.py index 4b65a4c5c1..6c66afb6be 100644 --- a/tests/tracing/test_decorator.py +++ b/tests/tracing/test_decorator.py @@ -264,9 +264,7 @@ def test_trace_decorator_child_span_streaming(sentry_init, capture_items): """Spans created with @trace show up as children if a span is active.""" sentry_init( traces_sample_rate=1.0, - _experiments={ - "trace_lifecycle": "stream", - }, + trace_lifecycle="stream", ) items = capture_items("span") @@ -299,9 +297,7 @@ async def test_trace_decorator_async_child_span_streaming(sentry_init, capture_i """Spans created with @trace show up as children if a span is active.""" sentry_init( traces_sample_rate=1.0, - _experiments={ - "trace_lifecycle": "stream", - }, + trace_lifecycle="stream", ) items = capture_items("span") diff --git a/tests/tracing/test_http_headers.py b/tests/tracing/test_http_headers.py index 45c6b53e67..818c934fc2 100644 --- a/tests/tracing/test_http_headers.py +++ b/tests/tracing/test_http_headers.py @@ -32,9 +32,7 @@ def test_to_traceparent(sampled): def test_to_traceparent_span_streaming(sentry_init, traces_sample_rate): sentry_init( traces_sample_rate=traces_sample_rate, - _experiments={ - "trace_lifecycle": "stream", - }, + trace_lifecycle="stream", ) with sentry_sdk.traces.start_span(name="/interactions/other-dogs/new-dog") as span: @@ -111,9 +109,7 @@ def test_iter_headers(monkeypatch): def test_iter_headers_span_streaming(sentry_init, monkeypatch): sentry_init( traces_sample_rate=0.0, - _experiments={ - "trace_lifecycle": "stream", - }, + trace_lifecycle="stream", ) monkeypatch.setattr( StreamedSpan, diff --git a/tests/tracing/test_integration_tests.py b/tests/tracing/test_integration_tests.py index a7d59d2741..8bc380b8b6 100644 --- a/tests/tracing/test_integration_tests.py +++ b/tests/tracing/test_integration_tests.py @@ -58,9 +58,7 @@ def test_basic(sentry_init, capture_events, sample_rate): @pytest.mark.parametrize("sample_rate", [0.0, 1.0]) def test_basic_span_streaming(sentry_init, capture_items, sample_rate): - sentry_init( - traces_sample_rate=sample_rate, _experiments={"trace_lifecycle": "stream"} - ) + sentry_init(traces_sample_rate=sample_rate, trace_lifecycle="stream") items = capture_items() with sentry_sdk.traces.start_span(name="hi"): diff --git a/tests/tracing/test_sampling.py b/tests/tracing/test_sampling.py index eb27a9e156..e95a2a6c0b 100644 --- a/tests/tracing/test_sampling.py +++ b/tests/tracing/test_sampling.py @@ -120,9 +120,7 @@ def test_uses_traces_sample_rate_correctly_span_streaming( ): sentry_init( traces_sample_rate=traces_sample_rate, - _experiments={ - "trace_lifecycle": "stream", - }, + trace_lifecycle="stream", ) sentry_sdk.traces.continue_trace( @@ -163,9 +161,7 @@ def test_uses_traces_sampler_return_value_correctly_span_streaming( ): sentry_init( traces_sampler=mock.Mock(return_value=traces_sampler_return_value), - _experiments={ - "trace_lifecycle": "stream", - }, + trace_lifecycle="stream", ) sentry_sdk.traces.continue_trace( @@ -334,9 +330,7 @@ def test_only_captures_segment_when_sampled_is_true_span_streaming( traces_sampler=mock.Mock( return_value=sampling_decision, ), - _experiments={ - "trace_lifecycle": "stream", - }, + trace_lifecycle="stream", ) items = capture_items() @@ -383,9 +377,7 @@ def test_prefers_traces_sampler_to_traces_sample_rate_span_streaming( sentry_init( traces_sample_rate=traces_sample_rate, traces_sampler=traces_sampler, - _experiments={ - "trace_lifecycle": "stream", - }, + trace_lifecycle="stream", ) span = sentry_sdk.traces.start_span(name="dogpark") diff --git a/tests/tracing/test_span_streaming.py b/tests/tracing/test_span_streaming.py index cae8e181a0..8148795df1 100644 --- a/tests/tracing/test_span_streaming.py +++ b/tests/tracing/test_span_streaming.py @@ -1192,12 +1192,10 @@ def test_outgoing_traceparent_and_baggage_incoming_trace_deferred( def test_outgoing_traceparent_and_baggage_ignored_segment(sentry_init): sentry_init( traces_sample_rate=1.0, - _experiments={ - "trace_lifecycle": "stream", - "ignore_spans": [ - "ignored", - ], - }, + trace_lifecycle="stream", + ignore_spans=[ + "ignored", + ], ) trace_id = "0af7651916cd43dd8448eb211c80319c" @@ -1233,12 +1231,10 @@ def test_outgoing_traceparent_and_baggage_ignored_segment(sentry_init): def test_outgoing_traceparent_and_baggage_ignored_child_span(sentry_init): sentry_init( traces_sample_rate=1.0, - _experiments={ - "trace_lifecycle": "stream", - "ignore_spans": [ - "ignored", - ], - }, + trace_lifecycle="stream", + ignore_spans=[ + "ignored", + ], ) trace_id = "0af7651916cd43dd8448eb211c80319c" @@ -1462,10 +1458,8 @@ def test_ignore_spans_basic( ): sentry_init( traces_sample_rate=1.0, - _experiments={ - "trace_lifecycle": "stream", - "ignore_spans": ["ignored"], - }, + trace_lifecycle="stream", + ignore_spans=["ignored"], ) items = capture_items("span") @@ -1496,10 +1490,8 @@ def test_ignore_spans_ignored_segment_drops_whole_tree( # Ignored segments should drop the whole span tree. sentry_init( traces_sample_rate=1.0, - _experiments={ - "trace_lifecycle": "stream", - "ignore_spans": ["ignored"], - }, + trace_lifecycle="stream", + ignore_spans=["ignored"], ) items = capture_items("span") @@ -1533,10 +1525,8 @@ def test_ignore_spans_ignored_segment_drops_whole_tree_explicit_parent_span( # Ignored segments should drop the whole span tree. sentry_init( traces_sample_rate=1.0, - _experiments={ - "trace_lifecycle": "stream", - "ignore_spans": ["ignored"], - }, + trace_lifecycle="stream", + ignore_spans=["ignored"], ) items = capture_items("span") @@ -1575,10 +1565,8 @@ def test_ignore_spans_set_ignored_child_span_as_parent( # Ignored non-segment spans should NOT drop the whole subtree under them. sentry_init( traces_sample_rate=1.0, - _experiments={ - "trace_lifecycle": "stream", - "ignore_spans": ["ignored"], - }, + trace_lifecycle="stream", + ignore_spans=["ignored"], ) items = capture_items("span") @@ -1617,10 +1605,8 @@ def test_ignore_spans_set_ignored_child_span_as_parent_explicit_parent_span( # Ignored non-segment spans should NOT drop the whole subtree under them. sentry_init( traces_sample_rate=1.0, - _experiments={ - "trace_lifecycle": "stream", - "ignore_spans": ["ignored"], - }, + trace_lifecycle="stream", + ignore_spans=["ignored"], ) items = capture_items("span") @@ -1668,10 +1654,8 @@ def test_ignore_spans_set_ignored_child_span_as_parent_explicit_parent_span( def test_ignore_spans_reparenting(sentry_init, capture_items): sentry_init( traces_sample_rate=1.0, - _experiments={ - "trace_lifecycle": "stream", - "ignore_spans": ["ignored"], - }, + trace_lifecycle="stream", + ignore_spans=["ignored"], ) items = capture_items("span") @@ -1746,8 +1730,8 @@ def test_segment_span_has_profiler_id( profile_lifecycle="trace", profiler_mode="thread", profile_session_sample_rate=1.0, + trace_lifecycle="stream", _experiments={ - "trace_lifecycle": "stream", "continuous_profiling_auto_start": True, }, ) @@ -1781,8 +1765,8 @@ def test_segment_span_no_profiler_id_when_unsampled( profile_lifecycle="trace", profiler_mode="thread", profile_session_sample_rate=0.0, + trace_lifecycle="stream", _experiments={ - "trace_lifecycle": "stream", "continuous_profiling_auto_start": True, }, ) @@ -1817,8 +1801,8 @@ def test_profile_stops_when_segment_ends( profile_lifecycle="trace", profiler_mode="thread", profile_session_sample_rate=1.0, + trace_lifecycle="stream", _experiments={ - "trace_lifecycle": "stream", "continuous_profiling_auto_start": True, }, ) From 6f7e0e7c0b2c21cf15a973391653fc04b869dbb3 Mon Sep 17 00:00:00 2001 From: Ivana Kellyer Date: Thu, 30 Jul 2026 15:18:04 +0200 Subject: [PATCH 02/10] fix --- tests/integrations/django/test_data_scrubbing.py | 4 +++- tests/integrations/flask/test_flask.py | 4 +++- tests/integrations/starlette/test_starlette.py | 4 +++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/tests/integrations/django/test_data_scrubbing.py b/tests/integrations/django/test_data_scrubbing.py index 2627c66a4a..b97cf6b0a1 100644 --- a/tests/integrations/django/test_data_scrubbing.py +++ b/tests/integrations/django/test_data_scrubbing.py @@ -339,7 +339,9 @@ def test_span_http_query_data_collection( integrations=[DjangoIntegration()], traces_sample_rate=1.0, trace_lifecycle="stream", - **init_kwargs.pop("_experiments", {}), + _experiments={ + **init_kwargs.pop("_experiments", {}), + }, **init_kwargs, ) diff --git a/tests/integrations/flask/test_flask.py b/tests/integrations/flask/test_flask.py index e2ab528e41..53339cb05f 100644 --- a/tests/integrations/flask/test_flask.py +++ b/tests/integrations/flask/test_flask.py @@ -1346,7 +1346,9 @@ def test_span_http_query_data_collection( integrations=[flask_sentry.FlaskIntegration()], traces_sample_rate=1.0, trace_lifecycle="stream", - **init_kwargs.pop("_experiments", {}), + _experiments={ + **init_kwargs.pop("_experiments", {}), + }, **init_kwargs, ) monkeypatch.setattr(flask_sentry, "flask_login", None) diff --git a/tests/integrations/starlette/test_starlette.py b/tests/integrations/starlette/test_starlette.py index a29f1aa56e..f95008a792 100644 --- a/tests/integrations/starlette/test_starlette.py +++ b/tests/integrations/starlette/test_starlette.py @@ -760,7 +760,9 @@ def test_span_http_query_data_collection( integrations=[StarletteIntegration()], traces_sample_rate=1.0, trace_lifecycle="stream", - **init_kwargs.pop("_experiments", {}), + _experiments={ + **init_kwargs.pop("_experiments", {}), + }, **init_kwargs, ) From e8bc746322caa908bd5594234585fb8c63fea8b1 Mon Sep 17 00:00:00 2001 From: Ivana Kellyer Date: Thu, 30 Jul 2026 15:21:30 +0200 Subject: [PATCH 03/10] simplify --- tests/integrations/asgi/test_asgi.py | 3 +-- tests/integrations/django/test_data_scrubbing.py | 4 +--- tests/integrations/flask/test_flask.py | 4 +--- tests/integrations/starlette/test_starlette.py | 8 ++------ 4 files changed, 5 insertions(+), 14 deletions(-) diff --git a/tests/integrations/asgi/test_asgi.py b/tests/integrations/asgi/test_asgi.py index f4e8266a69..51a0ec356d 100644 --- a/tests/integrations/asgi/test_asgi.py +++ b/tests/integrations/asgi/test_asgi.py @@ -1497,11 +1497,10 @@ async def app(scope, receive, send): await send({"type": "http.response.body", "body": b"Hello, world!"}) kwargs = dict(init_kwargs) - experiments = kwargs.pop("_experiments", {}) sentry_init( trace_lifecycle="stream", traces_sample_rate=1.0, - _experiments=experiments, + _experiments=kwargs.pop("_experiments", {}), **kwargs, ) sentry_app = SentryAsgiMiddleware(app) diff --git a/tests/integrations/django/test_data_scrubbing.py b/tests/integrations/django/test_data_scrubbing.py index b97cf6b0a1..955f449285 100644 --- a/tests/integrations/django/test_data_scrubbing.py +++ b/tests/integrations/django/test_data_scrubbing.py @@ -339,9 +339,7 @@ def test_span_http_query_data_collection( integrations=[DjangoIntegration()], traces_sample_rate=1.0, trace_lifecycle="stream", - _experiments={ - **init_kwargs.pop("_experiments", {}), - }, + _experiments=init_kwargs.pop("_experiments", {}), **init_kwargs, ) diff --git a/tests/integrations/flask/test_flask.py b/tests/integrations/flask/test_flask.py index 53339cb05f..d8216cf06b 100644 --- a/tests/integrations/flask/test_flask.py +++ b/tests/integrations/flask/test_flask.py @@ -1346,9 +1346,7 @@ def test_span_http_query_data_collection( integrations=[flask_sentry.FlaskIntegration()], traces_sample_rate=1.0, trace_lifecycle="stream", - _experiments={ - **init_kwargs.pop("_experiments", {}), - }, + _experiments=init_kwargs.pop("_experiments", {}), **init_kwargs, ) monkeypatch.setattr(flask_sentry, "flask_login", None) diff --git a/tests/integrations/starlette/test_starlette.py b/tests/integrations/starlette/test_starlette.py index f95008a792..c2405d91fe 100644 --- a/tests/integrations/starlette/test_starlette.py +++ b/tests/integrations/starlette/test_starlette.py @@ -760,9 +760,7 @@ def test_span_http_query_data_collection( integrations=[StarletteIntegration()], traces_sample_rate=1.0, trace_lifecycle="stream", - _experiments={ - **init_kwargs.pop("_experiments", {}), - }, + _experiments=init_kwargs.pop("_experiments", {}), **init_kwargs, ) @@ -869,9 +867,7 @@ def test_user_info_data_collection_with_streamed_spans( integrations=[StarletteIntegration()], traces_sample_rate=1.0, trace_lifecycle="stream", - _experiments={ - **kwargs.pop("_experiments", {}), - }, + _experiments=kwargs.pop("_experiments", {}), **kwargs, ) From 627041f79db7cbfbab4db493762c3659ddd78cb7 Mon Sep 17 00:00:00 2001 From: Ivana Kellyer Date: Thu, 30 Jul 2026 15:22:19 +0200 Subject: [PATCH 04/10] more simplificaiton --- tests/integrations/aiohttp/test_aiohttp.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/tests/integrations/aiohttp/test_aiohttp.py b/tests/integrations/aiohttp/test_aiohttp.py index 0aa3f4b014..7ae87e2f3a 100644 --- a/tests/integrations/aiohttp/test_aiohttp.py +++ b/tests/integrations/aiohttp/test_aiohttp.py @@ -1905,9 +1905,7 @@ async def test_server_url_query_data_collection_span_streaming( integrations=[AioHttpIntegration()], traces_sample_rate=1.0, trace_lifecycle="stream", - _experiments={ - **init_kwargs.pop("_experiments", {}), - }, + _experiments=init_kwargs.pop("_experiments", {}), **init_kwargs, ) @@ -1950,9 +1948,7 @@ async def test_client_url_query_data_collection_span_streaming( integrations=[AioHttpIntegration()], traces_sample_rate=1.0, trace_lifecycle="stream", - _experiments={ - **init_kwargs.pop("_experiments", {}), - }, + _experiments=init_kwargs.pop("_experiments", {}), **init_kwargs, ) From 59d7ebadeb20dc539958cd2a0f5aeeef1a48281f Mon Sep 17 00:00:00 2001 From: Ivana Kellyer Date: Thu, 30 Jul 2026 15:25:57 +0200 Subject: [PATCH 05/10] more simple --- tests/integrations/asgi/test_asgi.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/tests/integrations/asgi/test_asgi.py b/tests/integrations/asgi/test_asgi.py index 51a0ec356d..dede2b517c 100644 --- a/tests/integrations/asgi/test_asgi.py +++ b/tests/integrations/asgi/test_asgi.py @@ -1129,11 +1129,10 @@ async def test_get_request_attributes_query_data_collection( expected_url_full, ): kwargs = {k: v for k, v in init_kwargs.items() if k != "_experiments"} - experiments = {**init_kwargs.get("_experiments", {})} sentry_init( traces_sample_rate=1.0, trace_lifecycle="stream", - _experiments=experiments, + _experiments=init_kwargs.get("_experiments", {}), **kwargs, ) app = SentryAsgiMiddleware(asgi3_app) @@ -1236,11 +1235,10 @@ async def test_get_request_attributes_client_address_user_info( sentry_init, capture_items, asgi3_app, init_kwargs, has_client, expect_ip ): kwargs = {k: v for k, v in init_kwargs.items() if k != "_experiments"} - experiments = {**init_kwargs.get("_experiments", {})} sentry_init( traces_sample_rate=1.0, trace_lifecycle="stream", - _experiments=experiments, + _experiments=init_kwargs.get("_experiments", {}), **kwargs, ) app = SentryAsgiMiddleware(asgi3_app) From 81c3995243672fdcec1f0e990caee2d086f137b3 Mon Sep 17 00:00:00 2001 From: Ivana Kellyer Date: Thu, 30 Jul 2026 15:35:00 +0200 Subject: [PATCH 06/10] . --- tests/integrations/asgi/test_asgi.py | 6 +----- tests/integrations/wsgi/test_wsgi.py | 3 --- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/tests/integrations/asgi/test_asgi.py b/tests/integrations/asgi/test_asgi.py index dede2b517c..2ab49ed50e 100644 --- a/tests/integrations/asgi/test_asgi.py +++ b/tests/integrations/asgi/test_asgi.py @@ -1132,7 +1132,6 @@ async def test_get_request_attributes_query_data_collection( sentry_init( traces_sample_rate=1.0, trace_lifecycle="stream", - _experiments=init_kwargs.get("_experiments", {}), **kwargs, ) app = SentryAsgiMiddleware(asgi3_app) @@ -1234,12 +1233,10 @@ async def test_get_request_data_env_user_info( async def test_get_request_attributes_client_address_user_info( sentry_init, capture_items, asgi3_app, init_kwargs, has_client, expect_ip ): - kwargs = {k: v for k, v in init_kwargs.items() if k != "_experiments"} sentry_init( traces_sample_rate=1.0, trace_lifecycle="stream", - _experiments=init_kwargs.get("_experiments", {}), - **kwargs, + **init_kwargs, ) app = SentryAsgiMiddleware(asgi3_app) @@ -1498,7 +1495,6 @@ async def app(scope, receive, send): sentry_init( trace_lifecycle="stream", traces_sample_rate=1.0, - _experiments=kwargs.pop("_experiments", {}), **kwargs, ) sentry_app = SentryAsgiMiddleware(app) diff --git a/tests/integrations/wsgi/test_wsgi.py b/tests/integrations/wsgi/test_wsgi.py index b50d95e868..27c1c29b11 100644 --- a/tests/integrations/wsgi/test_wsgi.py +++ b/tests/integrations/wsgi/test_wsgi.py @@ -1232,7 +1232,6 @@ def dogpark(environ, start_response): sentry_init( traces_sample_rate=1.0, trace_lifecycle="stream", - **init_kwargs.pop("_experiments", {}), **init_kwargs, ) app = SentryWsgiMiddleware(dogpark) @@ -1295,12 +1294,10 @@ def dogpark(environ, start_response): return ["Go get the ball! Good dog!"] init_kwargs = dict(init_kwargs) # shallow copy so we can mutate - experiments = init_kwargs.pop("_experiments", {}) sentry_init( traces_sample_rate=1.0, trace_lifecycle="stream", - _experiments=experiments, **init_kwargs, ) app = SentryWsgiMiddleware(dogpark) From 4113bd324c51b7a2d315fdd8289ef727b32aac9a Mon Sep 17 00:00:00 2001 From: Ivana Kellyer Date: Thu, 30 Jul 2026 15:35:42 +0200 Subject: [PATCH 07/10] . --- tests/integrations/aiohttp/test_aiohttp.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/integrations/aiohttp/test_aiohttp.py b/tests/integrations/aiohttp/test_aiohttp.py index 7ae87e2f3a..f70964e6dd 100644 --- a/tests/integrations/aiohttp/test_aiohttp.py +++ b/tests/integrations/aiohttp/test_aiohttp.py @@ -1905,7 +1905,6 @@ async def test_server_url_query_data_collection_span_streaming( integrations=[AioHttpIntegration()], traces_sample_rate=1.0, trace_lifecycle="stream", - _experiments=init_kwargs.pop("_experiments", {}), **init_kwargs, ) @@ -1948,7 +1947,6 @@ async def test_client_url_query_data_collection_span_streaming( integrations=[AioHttpIntegration()], traces_sample_rate=1.0, trace_lifecycle="stream", - _experiments=init_kwargs.pop("_experiments", {}), **init_kwargs, ) From 284edeee9fa1081c0e7cb4698ebe4f22b1695216 Mon Sep 17 00:00:00 2001 From: Ivana Kellyer Date: Thu, 30 Jul 2026 15:38:46 +0200 Subject: [PATCH 08/10] . --- tests/integrations/django/test_data_scrubbing.py | 1 - tests/integrations/flask/test_flask.py | 1 - tests/integrations/starlette/test_starlette.py | 1 - 3 files changed, 3 deletions(-) diff --git a/tests/integrations/django/test_data_scrubbing.py b/tests/integrations/django/test_data_scrubbing.py index 955f449285..919aa932c3 100644 --- a/tests/integrations/django/test_data_scrubbing.py +++ b/tests/integrations/django/test_data_scrubbing.py @@ -339,7 +339,6 @@ def test_span_http_query_data_collection( integrations=[DjangoIntegration()], traces_sample_rate=1.0, trace_lifecycle="stream", - _experiments=init_kwargs.pop("_experiments", {}), **init_kwargs, ) diff --git a/tests/integrations/flask/test_flask.py b/tests/integrations/flask/test_flask.py index d8216cf06b..cadf011b4c 100644 --- a/tests/integrations/flask/test_flask.py +++ b/tests/integrations/flask/test_flask.py @@ -1346,7 +1346,6 @@ def test_span_http_query_data_collection( integrations=[flask_sentry.FlaskIntegration()], traces_sample_rate=1.0, trace_lifecycle="stream", - _experiments=init_kwargs.pop("_experiments", {}), **init_kwargs, ) monkeypatch.setattr(flask_sentry, "flask_login", None) diff --git a/tests/integrations/starlette/test_starlette.py b/tests/integrations/starlette/test_starlette.py index c2405d91fe..24b201b026 100644 --- a/tests/integrations/starlette/test_starlette.py +++ b/tests/integrations/starlette/test_starlette.py @@ -760,7 +760,6 @@ def test_span_http_query_data_collection( integrations=[StarletteIntegration()], traces_sample_rate=1.0, trace_lifecycle="stream", - _experiments=init_kwargs.pop("_experiments", {}), **init_kwargs, ) From f54d38a56601be53a9e764625d53d86815a9498e Mon Sep 17 00:00:00 2001 From: Ivana Kellyer Date: Thu, 30 Jul 2026 15:39:42 +0200 Subject: [PATCH 09/10] . --- tests/integrations/starlette/test_starlette.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/integrations/starlette/test_starlette.py b/tests/integrations/starlette/test_starlette.py index 24b201b026..e8198ce7b8 100644 --- a/tests/integrations/starlette/test_starlette.py +++ b/tests/integrations/starlette/test_starlette.py @@ -866,7 +866,6 @@ def test_user_info_data_collection_with_streamed_spans( integrations=[StarletteIntegration()], traces_sample_rate=1.0, trace_lifecycle="stream", - _experiments=kwargs.pop("_experiments", {}), **kwargs, ) From 2035de45df3e445977c9500d739bc787913a54b2 Mon Sep 17 00:00:00 2001 From: Ivana Kellyer Date: Thu, 30 Jul 2026 15:40:14 +0200 Subject: [PATCH 10/10] . --- tests/integrations/asgi/test_asgi.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/integrations/asgi/test_asgi.py b/tests/integrations/asgi/test_asgi.py index 2ab49ed50e..7f1924128e 100644 --- a/tests/integrations/asgi/test_asgi.py +++ b/tests/integrations/asgi/test_asgi.py @@ -1128,11 +1128,10 @@ async def test_get_request_attributes_query_data_collection( expected_query, expected_url_full, ): - kwargs = {k: v for k, v in init_kwargs.items() if k != "_experiments"} sentry_init( traces_sample_rate=1.0, trace_lifecycle="stream", - **kwargs, + **init_kwargs, ) app = SentryAsgiMiddleware(asgi3_app)