From af30dd0b5186d60cd6fb832cbbaf9ee251a13dd9 Mon Sep 17 00:00:00 2001 From: Ivana Kellyer Date: Thu, 6 Aug 2026 13:20:38 +0200 Subject: [PATCH 1/8] reenable test --- tests/integrations/threading/test_threading.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/integrations/threading/test_threading.py b/tests/integrations/threading/test_threading.py index 70a4d47e37..e322ba31da 100644 --- a/tests/integrations/threading/test_threading.py +++ b/tests/integrations/threading/test_threading.py @@ -38,7 +38,6 @@ def crash(): assert not events -@pytest.mark.skip(reason="Temporarily disable to release SDK 2.0a1.") def test_circular_references(sentry_init, request): sentry_init(default_integrations=False, integrations=[ThreadingIntegration()]) From ff601967f4579307c6e309d47e85ebc014fe4fa1 Mon Sep 17 00:00:00 2001 From: Ivana Kellyer Date: Thu, 6 Aug 2026 13:29:47 +0200 Subject: [PATCH 2/8] chore: Clean up profiler interface --- sentry_sdk/profiler/continuous_profiler.py | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/sentry_sdk/profiler/continuous_profiler.py b/sentry_sdk/profiler/continuous_profiler.py index ed525f52bd..8ca901e83e 100644 --- a/sentry_sdk/profiler/continuous_profiler.py +++ b/sentry_sdk/profiler/continuous_profiler.py @@ -5,7 +5,6 @@ import threading import time import uuid -import warnings from collections import deque from datetime import datetime, timezone from typing import TYPE_CHECKING @@ -153,15 +152,6 @@ def start_profiler() -> None: _scheduler.manual_start() -def start_profile_session() -> None: - warnings.warn( - "The `start_profile_session` function is deprecated. Please use `start_profile` instead.", - DeprecationWarning, - stacklevel=2, - ) - start_profiler() - - def stop_profiler() -> None: if _scheduler is None: return @@ -169,15 +159,6 @@ def stop_profiler() -> None: _scheduler.manual_stop() -def stop_profile_session() -> None: - warnings.warn( - "The `stop_profile_session` function is deprecated. Please use `stop_profile` instead.", - DeprecationWarning, - stacklevel=2, - ) - stop_profiler() - - def teardown_continuous_profiler() -> None: stop_profiler() From 203d197950905d9fc7ee139e45757717ad3b41a7 Mon Sep 17 00:00:00 2001 From: Ivana Kellyer Date: Thu, 6 Aug 2026 13:31:51 +0200 Subject: [PATCH 3/8] revert threading change --- tests/integrations/threading/test_threading.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/integrations/threading/test_threading.py b/tests/integrations/threading/test_threading.py index e322ba31da..70a4d47e37 100644 --- a/tests/integrations/threading/test_threading.py +++ b/tests/integrations/threading/test_threading.py @@ -38,6 +38,7 @@ def crash(): assert not events +@pytest.mark.skip(reason="Temporarily disable to release SDK 2.0a1.") def test_circular_references(sentry_init, request): sentry_init(default_integrations=False, integrations=[ThreadingIntegration()]) From ac77b9584ef3c6156870bbb3faace697361fd190 Mon Sep 17 00:00:00 2001 From: Ivana Kellyer Date: Thu, 6 Aug 2026 13:38:16 +0200 Subject: [PATCH 4/8] remove everywhere --- MIGRATION_GUIDE.md | 1 + sentry_sdk/profiler/__init__.py | 4 - tests/profiler/test_continuous_profiler.py | 174 +++------------------ 3 files changed, 19 insertions(+), 160 deletions(-) diff --git a/MIGRATION_GUIDE.md b/MIGRATION_GUIDE.md index 5ecc5f1ad9..67cec07492 100644 --- a/MIGRATION_GUIDE.md +++ b/MIGRATION_GUIDE.md @@ -48,6 +48,7 @@ Looking to upgrade from Sentry SDK 2.x to 3.x? Here's a comprehensive list of wh - The deprecated `@ai_track` decorator was removed. - The deprecated `push_scope` and `configure_scope` APIs have been removed. Use `with new_scope():` to push a new scope and `scope = get_current_scope()` to retrieve the current scope instead. - Transaction profiling and related code was removed. +- The `start_profile_session` and `stop_profile_session` were removed in favor of `start_profile` and `stop_profile`, respectively. - Removed the deprecated Hub class and all uses of hub throughout the SDK in arguments, options, etc. Use a scope instead. - The `SentrySpanProcessor`, `SentryPropagator`, `instrumenter`, and associated OpenTelemetry compatibility code was removed along with the `opentelemetry` extra and the `SentryPropagator` entrypoint. Use the `OTLPIntegration` instead. - Removed the `auto_session_tracing` decorator. Use `track_session` instead. diff --git a/sentry_sdk/profiler/__init__.py b/sentry_sdk/profiler/__init__.py index 99d8cd2d61..af45f84164 100644 --- a/sentry_sdk/profiler/__init__.py +++ b/sentry_sdk/profiler/__init__.py @@ -1,7 +1,5 @@ from sentry_sdk.profiler.continuous_profiler import ( - start_profile_session, start_profiler, - stop_profile_session, stop_profiler, ) from sentry_sdk.profiler.utils import ( @@ -14,9 +12,7 @@ ) __all__ = [ - "start_profile_session", # TODO: Deprecate this in favor of `start_profiler` "start_profiler", - "stop_profile_session", # TODO: Deprecate this in favor of `stop_profiler` "stop_profiler", "DEFAULT_SAMPLING_FREQUENCY", "MAX_STACK_DEPTH", diff --git a/tests/profiler/test_continuous_profiler.py b/tests/profiler/test_continuous_profiler.py index 0997634614..5e4db26e0e 100644 --- a/tests/profiler/test_continuous_profiler.py +++ b/tests/profiler/test_continuous_profiler.py @@ -11,9 +11,7 @@ get_profiler_id, is_profile_session_sampled, setup_continuous_profiler, - start_profile_session, start_profiler, - stop_profile_session, stop_profiler, ) from tests.conftest import ApproxDict @@ -297,21 +295,6 @@ def assert_single_segment_without_profile_chunks(envelopes): pytest.param("gevent", marks=requires_gevent), ], ) -@pytest.mark.parametrize( - ["start_profiler_func", "stop_profiler_func"], - [ - pytest.param( - start_profile_session, - stop_profile_session, - id="start_profile_session/stop_profile_session (deprecated)", - ), - pytest.param( - start_profiler, - stop_profiler, - id="start_profiler/stop_profiler", - ), - ], -) @pytest.mark.parametrize( "make_options", [ @@ -323,8 +306,6 @@ def test_continuous_profiler_auto_start_and_manual_stop( sentry_init, capture_envelopes, mode, - start_profiler_func, - stop_profiler_func, make_options, teardown_profiling, ): @@ -343,7 +324,7 @@ def test_continuous_profiler_auto_start_and_manual_stop( pass for _ in range(3): - stop_profiler_func() + stop_profiler() assert_single_transaction_with_profile_chunks(envelopes, thread) @@ -355,7 +336,7 @@ def test_continuous_profiler_auto_start_and_manual_stop( assert_single_transaction_without_profile_chunks(envelopes) - start_profiler_func() + start_profiler() envelopes.clear() @@ -363,7 +344,7 @@ def test_continuous_profiler_auto_start_and_manual_stop( with sentry_sdk.start_span(op="op"): pass - stop_profiler_func() + stop_profiler() assert_single_transaction_with_profile_chunks(envelopes, thread) @@ -376,21 +357,6 @@ def test_continuous_profiler_auto_start_and_manual_stop( pytest.param("gevent", marks=requires_gevent), ], ) -@pytest.mark.parametrize( - ["start_profiler_func", "stop_profiler_func"], - [ - pytest.param( - start_profile_session, - stop_profile_session, - id="start_profile_session/stop_profile_session (deprecated)", - ), - pytest.param( - start_profiler, - stop_profiler, - id="start_profiler/stop_profiler", - ), - ], -) @pytest.mark.parametrize( "make_options", [ @@ -402,8 +368,6 @@ def test_continuous_profiler_auto_start_and_manual_stop_span_streaming( sentry_init, capture_envelopes, mode, - start_profiler_func, - stop_profiler_func, make_options, teardown_profiling, ): @@ -423,7 +387,7 @@ def test_continuous_profiler_auto_start_and_manual_stop_span_streaming( pass for _ in range(3): - stop_profiler_func() + stop_profiler() sentry_sdk.flush() assert_single_segment_with_profile_chunks(envelopes, thread) @@ -437,7 +401,7 @@ def test_continuous_profiler_auto_start_and_manual_stop_span_streaming( sentry_sdk.flush() assert_single_segment_without_profile_chunks(envelopes) - start_profiler_func() + start_profiler() envelopes.clear() @@ -445,7 +409,7 @@ def test_continuous_profiler_auto_start_and_manual_stop_span_streaming( with sentry_sdk.traces.start_span(name="op"): pass - stop_profiler_func() + stop_profiler() sentry_sdk.flush() assert_single_segment_with_profile_chunks(envelopes, thread) @@ -458,21 +422,6 @@ def test_continuous_profiler_auto_start_and_manual_stop_span_streaming( pytest.param("gevent", marks=requires_gevent), ], ) -@pytest.mark.parametrize( - ["start_profiler_func", "stop_profiler_func"], - [ - pytest.param( - start_profile_session, - stop_profile_session, - id="start_profile_session/stop_profile_session (deprecated)", - ), - pytest.param( - start_profiler, - stop_profiler, - id="start_profiler/stop_profiler", - ), - ], -) @pytest.mark.parametrize( "make_options", [ @@ -485,8 +434,6 @@ def test_continuous_profiler_manual_start_and_stop_sampled( sentry_init, capture_envelopes, mode, - start_profiler_func, - stop_profiler_func, make_options, teardown_profiling, ): @@ -503,7 +450,7 @@ def test_continuous_profiler_manual_start_and_stop_sampled( thread = threading.current_thread() for _ in range(3): - start_profiler_func() + start_profiler() envelopes.clear() @@ -515,7 +462,7 @@ def test_continuous_profiler_manual_start_and_stop_sampled( assert get_profiler_id() is not None, "profiler should be running" - stop_profiler_func() + stop_profiler() assert_single_transaction_with_profile_chunks(envelopes, thread) @@ -540,21 +487,6 @@ def test_continuous_profiler_manual_start_and_stop_sampled( pytest.param("gevent", marks=requires_gevent), ], ) -@pytest.mark.parametrize( - ["start_profiler_func", "stop_profiler_func"], - [ - pytest.param( - start_profile_session, - stop_profile_session, - id="start_profile_session/stop_profile_session (deprecated)", - ), - pytest.param( - start_profiler, - stop_profiler, - id="start_profiler/stop_profiler", - ), - ], -) @pytest.mark.parametrize( "make_options", [ @@ -567,8 +499,6 @@ def test_continuous_profiler_manual_start_and_stop_sampled_span_streaming( sentry_init, capture_envelopes, mode, - start_profiler_func, - stop_profiler_func, make_options, teardown_profiling, ): @@ -586,7 +516,7 @@ def test_continuous_profiler_manual_start_and_stop_sampled_span_streaming( thread = threading.current_thread() for _ in range(3): - start_profiler_func() + start_profiler() envelopes.clear() @@ -598,7 +528,7 @@ def test_continuous_profiler_manual_start_and_stop_sampled_span_streaming( assert get_profiler_id() is not None, "profiler should be running" - stop_profiler_func() + stop_profiler() sentry_sdk.flush() assert_single_segment_with_profile_chunks(envelopes, thread) @@ -625,21 +555,6 @@ def test_continuous_profiler_manual_start_and_stop_sampled_span_streaming( pytest.param("gevent", marks=requires_gevent), ], ) -@pytest.mark.parametrize( - ["start_profiler_func", "stop_profiler_func"], - [ - pytest.param( - start_profile_session, - stop_profile_session, - id="start_profile_session/stop_profile_session (deprecated)", - ), - pytest.param( - start_profiler, - stop_profiler, - id="start_profiler/stop_profiler", - ), - ], -) @pytest.mark.parametrize( "make_options", [ @@ -651,8 +566,6 @@ def test_continuous_profiler_manual_start_and_stop_unsampled( sentry_init, capture_envelopes, mode, - start_profiler_func, - stop_profiler_func, make_options, teardown_profiling, ): @@ -666,13 +579,13 @@ def test_continuous_profiler_manual_start_and_stop_unsampled( envelopes = capture_envelopes() - start_profiler_func() + start_profiler() with sentry_sdk.start_transaction(name="profiling"): with sentry_sdk.start_span(op="op"): pass - stop_profiler_func() + stop_profiler() assert_single_transaction_without_profile_chunks(envelopes) @@ -684,21 +597,6 @@ def test_continuous_profiler_manual_start_and_stop_unsampled( pytest.param("gevent", marks=requires_gevent), ], ) -@pytest.mark.parametrize( - ["start_profiler_func", "stop_profiler_func"], - [ - pytest.param( - start_profile_session, - stop_profile_session, - id="start_profile_session/stop_profile_session (deprecated)", - ), - pytest.param( - start_profiler, - stop_profiler, - id="start_profiler/stop_profiler", - ), - ], -) @pytest.mark.parametrize( "make_options", [ @@ -710,8 +608,6 @@ def test_continuous_profiler_manual_start_and_stop_unsampled_span_streaming( sentry_init, capture_envelopes, mode, - start_profiler_func, - stop_profiler_func, make_options, teardown_profiling, ): @@ -726,13 +622,13 @@ def test_continuous_profiler_manual_start_and_stop_unsampled_span_streaming( envelopes = capture_envelopes() - start_profiler_func() + start_profiler() with sentry_sdk.traces.start_span(name="profiling"): with sentry_sdk.traces.start_span(name="op"): pass - stop_profiler_func() + stop_profiler() sentry_sdk.flush() assert_single_segment_without_profile_chunks(envelopes) @@ -1010,21 +906,6 @@ def test_continuous_profiler_auto_start_and_stop_unsampled_span_streaming( ), ], ) -@pytest.mark.parametrize( - ["start_profiler_func", "stop_profiler_func"], - [ - pytest.param( - start_profile_session, - stop_profile_session, - id="start_profile_session/stop_profile_session (deprecated)", - ), - pytest.param( - start_profiler, - stop_profiler, - id="start_profiler/stop_profiler", - ), - ], -) @pytest.mark.parametrize( "make_options", [ @@ -1035,8 +916,6 @@ def test_continuous_profiler_auto_start_and_stop_unsampled_span_streaming( def test_continuous_profiler_manual_start_and_stop_noop_when_using_trace_lifecyle( sentry_init, mode, - start_profiler_func, - stop_profiler_func, class_name, make_options, teardown_profiling, @@ -1052,13 +931,13 @@ def test_continuous_profiler_manual_start_and_stop_noop_when_using_trace_lifecyl with mock.patch( f"sentry_sdk.profiler.continuous_profiler.{class_name}.ensure_running" ) as mock_ensure_running: - start_profiler_func() + start_profiler() mock_ensure_running.assert_not_called() with mock.patch( f"sentry_sdk.profiler.continuous_profiler.{class_name}.teardown" ) as mock_teardown: - stop_profiler_func() + stop_profiler() mock_teardown.assert_not_called() @@ -1073,21 +952,6 @@ def test_continuous_profiler_manual_start_and_stop_noop_when_using_trace_lifecyl ), ], ) -@pytest.mark.parametrize( - ["start_profiler_func", "stop_profiler_func"], - [ - pytest.param( - start_profile_session, - stop_profile_session, - id="start_profile_session/stop_profile_session (deprecated)", - ), - pytest.param( - start_profiler, - stop_profiler, - id="start_profiler/stop_profiler", - ), - ], -) @pytest.mark.parametrize( "make_options", [ @@ -1098,8 +962,6 @@ def test_continuous_profiler_manual_start_and_stop_noop_when_using_trace_lifecyl def test_continuous_profiler_manual_start_and_stop_noop_when_using_trace_lifecyle_span_streaming( sentry_init, mode, - start_profiler_func, - stop_profiler_func, class_name, make_options, teardown_profiling, @@ -1116,13 +978,13 @@ def test_continuous_profiler_manual_start_and_stop_noop_when_using_trace_lifecyl with mock.patch( f"sentry_sdk.profiler.continuous_profiler.{class_name}.ensure_running" ) as mock_ensure_running: - start_profiler_func() + start_profiler() mock_ensure_running.assert_not_called() with mock.patch( f"sentry_sdk.profiler.continuous_profiler.{class_name}.teardown" ) as mock_teardown: - stop_profiler_func() + stop_profiler() mock_teardown.assert_not_called() From 5addb391c8710fae21e63a1c7c5e7c2921a63460 Mon Sep 17 00:00:00 2001 From: Ivana Kellyer Date: Thu, 6 Aug 2026 13:45:33 +0200 Subject: [PATCH 5/8] remove deprecated continuous_profiling_mode --- MIGRATION_GUIDE.md | 1 + sentry_sdk/consts.py | 4 +- tests/profiler/test_continuous_profiler.py | 167 +++------------------ 3 files changed, 20 insertions(+), 152 deletions(-) diff --git a/MIGRATION_GUIDE.md b/MIGRATION_GUIDE.md index 67cec07492..b6a0511709 100644 --- a/MIGRATION_GUIDE.md +++ b/MIGRATION_GUIDE.md @@ -49,6 +49,7 @@ Looking to upgrade from Sentry SDK 2.x to 3.x? Here's a comprehensive list of wh - The deprecated `push_scope` and `configure_scope` APIs have been removed. Use `with new_scope():` to push a new scope and `scope = get_current_scope()` to retrieve the current scope instead. - Transaction profiling and related code was removed. - The `start_profile_session` and `stop_profile_session` were removed in favor of `start_profile` and `stop_profile`, respectively. +- The experimental `continuous_profiling_mode` option was removed. Use the top-level `profiler_mode`, instead. - Removed the deprecated Hub class and all uses of hub throughout the SDK in arguments, options, etc. Use a scope instead. - The `SentrySpanProcessor`, `SentryPropagator`, `instrumenter`, and associated OpenTelemetry compatibility code was removed along with the `opentelemetry` extra and the `SentryPropagator` entrypoint. Use the `OTLPIntegration` instead. - Removed the `auto_session_tracing` decorator. Use `track_session` instead. diff --git a/sentry_sdk/consts.py b/sentry_sdk/consts.py index 1a205a31de..55b6354b96 100644 --- a/sentry_sdk/consts.py +++ b/sentry_sdk/consts.py @@ -52,7 +52,6 @@ class CompressionAlgo(Enum): IgnoreSpansConfig, Log, Metric, - ProfilerMode, SpanJSON, TracesSampler, TransactionProcessor, @@ -69,7 +68,6 @@ class CompressionAlgo(Enum): "max_flags": Optional[int], "record_sql_params": Optional[bool], "continuous_profiling_auto_start": Optional[bool], - "continuous_profiling_mode": Optional[ContinuousProfilerMode], "transport_zlib_compression_level": Optional[int], "transport_compression_level": Optional[int], "transport_compression_algo": Optional[CompressionAlgo], @@ -1294,7 +1292,7 @@ def __init__( traces_sample_rate: "Optional[float]" = None, trace_lifecycle: "Optional[Literal['static', 'stream']]" = None, traces_sampler: "Optional[TracesSampler]" = None, - profiler_mode: "Optional[ProfilerMode]" = None, + profiler_mode: "Optional[ContinuousProfilerMode]" = None, profile_lifecycle: 'Literal["manual", "trace"]' = "manual", profile_session_sample_rate: "Optional[float]" = None, auto_enabling_integrations: bool = True, diff --git a/tests/profiler/test_continuous_profiler.py b/tests/profiler/test_continuous_profiler.py index 5e4db26e0e..a4b50efc8e 100644 --- a/tests/profiler/test_continuous_profiler.py +++ b/tests/profiler/test_continuous_profiler.py @@ -25,29 +25,17 @@ requires_gevent = pytest.mark.skipif(gevent is None, reason="gevent not enabled") -def get_client_options(use_top_level_profiler_mode): - def client_options( - mode=None, auto_start=None, profile_session_sample_rate=1.0, lifecycle="manual" - ): - if use_top_level_profiler_mode: - return { - "profile_lifecycle": lifecycle, - "profiler_mode": mode, - "profile_session_sample_rate": profile_session_sample_rate, - "_experiments": { - "continuous_profiling_auto_start": auto_start, - }, - } - return { - "profile_lifecycle": lifecycle, - "profile_session_sample_rate": profile_session_sample_rate, - "_experiments": { - "continuous_profiling_auto_start": auto_start, - "continuous_profiling_mode": mode, - }, - } - - return client_options +def make_options( + mode=None, auto_start=None, profile_session_sample_rate=1.0, lifecycle="manual" +): + return { + "profile_lifecycle": lifecycle, + "profiler_mode": mode, + "profile_session_sample_rate": profile_session_sample_rate, + "_experiments": { + "continuous_profiling_auto_start": auto_start, + }, + } mock_sdk_info = { @@ -57,18 +45,10 @@ def client_options( } -@pytest.mark.parametrize("mode", [pytest.param("foo")]) -@pytest.mark.parametrize( - "make_options", - [ - pytest.param(get_client_options(True), id="non-experiment"), - pytest.param(get_client_options(False), id="experiment"), - ], -) -def test_continuous_profiler_invalid_mode(mode, make_options, teardown_profiling): +def test_continuous_profiler_invalid_mode(mode, teardown_profiling): with pytest.raises(ValueError): setup_continuous_profiler( - make_options(mode=mode), + make_options(), mock_sdk_info, lambda envelope: None, ) @@ -81,17 +61,9 @@ def test_continuous_profiler_invalid_mode(mode, make_options, teardown_profiling pytest.param("gevent", marks=requires_gevent), ], ) -@pytest.mark.parametrize( - "make_options", - [ - pytest.param(get_client_options(True), id="non-experiment"), - pytest.param(get_client_options(False), id="experiment"), - ], -) -def test_continuous_profiler_valid_mode(mode, make_options, teardown_profiling): - options = make_options(mode=mode) +def test_continuous_profiler_valid_mode(mode, teardown_profiling): setup_continuous_profiler( - options, + make_options(mode=mode), mock_sdk_info, lambda envelope: None, ) @@ -104,14 +76,7 @@ def test_continuous_profiler_valid_mode(mode, make_options, teardown_profiling): pytest.param("gevent", marks=requires_gevent), ], ) -@pytest.mark.parametrize( - "make_options", - [ - pytest.param(get_client_options(True), id="non-experiment"), - pytest.param(get_client_options(False), id="experiment"), - ], -) -def test_continuous_profiler_setup_twice(mode, make_options, teardown_profiling): +def test_continuous_profiler_setup_twice(mode, teardown_profiling): assert not is_profile_session_sampled() # setting up the first time should return True to indicate success @@ -295,18 +260,10 @@ def assert_single_segment_without_profile_chunks(envelopes): pytest.param("gevent", marks=requires_gevent), ], ) -@pytest.mark.parametrize( - "make_options", - [ - pytest.param(get_client_options(True), id="non-experiment"), - pytest.param(get_client_options(False), id="experiment"), - ], -) def test_continuous_profiler_auto_start_and_manual_stop( sentry_init, capture_envelopes, mode, - make_options, teardown_profiling, ): options = make_options(mode=mode, auto_start=True) @@ -357,18 +314,10 @@ def test_continuous_profiler_auto_start_and_manual_stop( pytest.param("gevent", marks=requires_gevent), ], ) -@pytest.mark.parametrize( - "make_options", - [ - pytest.param(get_client_options(True), id="non-experiment"), - pytest.param(get_client_options(False), id="experiment"), - ], -) def test_continuous_profiler_auto_start_and_manual_stop_span_streaming( sentry_init, capture_envelopes, mode, - make_options, teardown_profiling, ): options = make_options(mode=mode, auto_start=True) @@ -422,19 +371,11 @@ def test_continuous_profiler_auto_start_and_manual_stop_span_streaming( pytest.param("gevent", marks=requires_gevent), ], ) -@pytest.mark.parametrize( - "make_options", - [ - pytest.param(get_client_options(True), id="non-experiment"), - pytest.param(get_client_options(False), id="experiment"), - ], -) @mock.patch("sentry_sdk.profiler.continuous_profiler.PROFILE_BUFFER_SECONDS", 0.01) def test_continuous_profiler_manual_start_and_stop_sampled( sentry_init, capture_envelopes, mode, - make_options, teardown_profiling, ): options = make_options( @@ -487,19 +428,11 @@ def test_continuous_profiler_manual_start_and_stop_sampled( pytest.param("gevent", marks=requires_gevent), ], ) -@pytest.mark.parametrize( - "make_options", - [ - pytest.param(get_client_options(True), id="non-experiment"), - pytest.param(get_client_options(False), id="experiment"), - ], -) @mock.patch("sentry_sdk.profiler.continuous_profiler.PROFILE_BUFFER_SECONDS", 0.01) def test_continuous_profiler_manual_start_and_stop_sampled_span_streaming( sentry_init, capture_envelopes, mode, - make_options, teardown_profiling, ): options = make_options( @@ -555,18 +488,10 @@ def test_continuous_profiler_manual_start_and_stop_sampled_span_streaming( pytest.param("gevent", marks=requires_gevent), ], ) -@pytest.mark.parametrize( - "make_options", - [ - pytest.param(get_client_options(True), id="non-experiment"), - pytest.param(get_client_options(False), id="experiment"), - ], -) def test_continuous_profiler_manual_start_and_stop_unsampled( sentry_init, capture_envelopes, mode, - make_options, teardown_profiling, ): options = make_options( @@ -597,18 +522,10 @@ def test_continuous_profiler_manual_start_and_stop_unsampled( pytest.param("gevent", marks=requires_gevent), ], ) -@pytest.mark.parametrize( - "make_options", - [ - pytest.param(get_client_options(True), id="non-experiment"), - pytest.param(get_client_options(False), id="experiment"), - ], -) def test_continuous_profiler_manual_start_and_stop_unsampled_span_streaming( sentry_init, capture_envelopes, mode, - make_options, teardown_profiling, ): options = make_options( @@ -641,19 +558,11 @@ def test_continuous_profiler_manual_start_and_stop_unsampled_span_streaming( pytest.param("gevent", marks=requires_gevent), ], ) -@pytest.mark.parametrize( - "make_options", - [ - pytest.param(get_client_options(True), id="non-experiment"), - pytest.param(get_client_options(False), id="experiment"), - ], -) @mock.patch("sentry_sdk.profiler.continuous_profiler.DEFAULT_SAMPLING_FREQUENCY", 21) def test_continuous_profiler_auto_start_and_stop_sampled( sentry_init, capture_envelopes, mode, - make_options, teardown_profiling, ): options = make_options( @@ -724,19 +633,11 @@ def test_continuous_profiler_auto_start_and_stop_sampled( pytest.param("gevent", marks=requires_gevent), ], ) -@pytest.mark.parametrize( - "make_options", - [ - pytest.param(get_client_options(True), id="non-experiment"), - pytest.param(get_client_options(False), id="experiment"), - ], -) @mock.patch("sentry_sdk.profiler.continuous_profiler.DEFAULT_SAMPLING_FREQUENCY", 21) def test_continuous_profiler_auto_start_and_stop_sampled_span_streaming( sentry_init, capture_envelopes, mode, - make_options, teardown_profiling, ): options = make_options( @@ -809,19 +710,11 @@ def test_continuous_profiler_auto_start_and_stop_sampled_span_streaming( pytest.param("gevent", marks=requires_gevent), ], ) -@pytest.mark.parametrize( - "make_options", - [ - pytest.param(get_client_options(True), id="non-experiment"), - pytest.param(get_client_options(False), id="experiment"), - ], -) @mock.patch("sentry_sdk.profiler.continuous_profiler.PROFILE_BUFFER_SECONDS", 0.01) def test_continuous_profiler_auto_start_and_stop_unsampled( sentry_init, capture_envelopes, mode, - make_options, teardown_profiling, ): options = make_options( @@ -854,19 +747,11 @@ def test_continuous_profiler_auto_start_and_stop_unsampled( pytest.param("gevent", marks=requires_gevent), ], ) -@pytest.mark.parametrize( - "make_options", - [ - pytest.param(get_client_options(True), id="non-experiment"), - pytest.param(get_client_options(False), id="experiment"), - ], -) @mock.patch("sentry_sdk.profiler.continuous_profiler.PROFILE_BUFFER_SECONDS", 0.01) def test_continuous_profiler_auto_start_and_stop_unsampled_span_streaming( sentry_init, capture_envelopes, mode, - make_options, teardown_profiling, ): options = make_options( @@ -906,18 +791,10 @@ def test_continuous_profiler_auto_start_and_stop_unsampled_span_streaming( ), ], ) -@pytest.mark.parametrize( - "make_options", - [ - pytest.param(get_client_options(True), id="non-experiment"), - pytest.param(get_client_options(False), id="experiment"), - ], -) def test_continuous_profiler_manual_start_and_stop_noop_when_using_trace_lifecyle( sentry_init, mode, class_name, - make_options, teardown_profiling, ): options = make_options( @@ -952,18 +829,10 @@ def test_continuous_profiler_manual_start_and_stop_noop_when_using_trace_lifecyl ), ], ) -@pytest.mark.parametrize( - "make_options", - [ - pytest.param(get_client_options(True), id="non-experiment"), - pytest.param(get_client_options(False), id="experiment"), - ], -) def test_continuous_profiler_manual_start_and_stop_noop_when_using_trace_lifecyle_span_streaming( sentry_init, mode, class_name, - make_options, teardown_profiling, ): options = make_options( @@ -1008,7 +877,7 @@ def test_continuous_profiler_run_does_not_null_buffer( """ from sentry_sdk.profiler import continuous_profiler as cp - options = get_client_options(True)( + options = make_options( mode="thread", profile_session_sample_rate=1.0, lifecycle="manual" ) sentry_init(traces_sample_rate=1.0, **options) @@ -1072,7 +941,7 @@ def test_continuous_profiler_run_does_not_null_buffer_span_streaming( """ from sentry_sdk.profiler import continuous_profiler as cp - options = get_client_options(True)( + options = make_options( mode="thread", profile_session_sample_rate=1.0, lifecycle="manual" ) sentry_init( From edb597eb5f06d261a01ead8e8ccb8c37ba7490b3 Mon Sep 17 00:00:00 2001 From: Ivana Kellyer Date: Thu, 6 Aug 2026 13:52:58 +0200 Subject: [PATCH 6/8] . --- sentry_sdk/profiler/continuous_profiler.py | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/sentry_sdk/profiler/continuous_profiler.py b/sentry_sdk/profiler/continuous_profiler.py index 8ca901e83e..2e82289e72 100644 --- a/sentry_sdk/profiler/continuous_profiler.py +++ b/sentry_sdk/profiler/continuous_profiler.py @@ -81,19 +81,12 @@ def setup_continuous_profiler( # them to spawn a native thread for sampling. # Instead we default to the GeventContinuousScheduler which is capable of # spawning native threads within gevent. - default_profiler_mode = GeventContinuousScheduler.mode + profiler_mode = GeventContinuousScheduler.mode else: - default_profiler_mode = ThreadContinuousScheduler.mode + profiler_mode = ThreadContinuousScheduler.mode if options.get("profiler_mode") is not None: profiler_mode = options["profiler_mode"] - else: - # TODO: deprecate this and just use the existing `profiler_mode` - experiments = options.get("_experiments", {}) - - profiler_mode = ( - experiments.get("continuous_profiling_mode") or default_profiler_mode - ) frequency = DEFAULT_SAMPLING_FREQUENCY From 878a970a090176a099ec18acee24ec134c3c13eb Mon Sep 17 00:00:00 2001 From: Ivana Kellyer Date: Thu, 6 Aug 2026 13:53:59 +0200 Subject: [PATCH 7/8] . --- tests/profiler/test_continuous_profiler.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/profiler/test_continuous_profiler.py b/tests/profiler/test_continuous_profiler.py index a4b50efc8e..a684041002 100644 --- a/tests/profiler/test_continuous_profiler.py +++ b/tests/profiler/test_continuous_profiler.py @@ -48,7 +48,7 @@ def make_options( def test_continuous_profiler_invalid_mode(mode, teardown_profiling): with pytest.raises(ValueError): setup_continuous_profiler( - make_options(), + make_options(mode="foo"), mock_sdk_info, lambda envelope: None, ) From 8dd02ce7f722072a81c8daec3c7403e6a5c996d8 Mon Sep 17 00:00:00 2001 From: Ivana Kellyer Date: Thu, 6 Aug 2026 14:11:49 +0200 Subject: [PATCH 8/8] . --- tests/profiler/test_continuous_profiler.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/profiler/test_continuous_profiler.py b/tests/profiler/test_continuous_profiler.py index a684041002..c5367a77b3 100644 --- a/tests/profiler/test_continuous_profiler.py +++ b/tests/profiler/test_continuous_profiler.py @@ -45,7 +45,7 @@ def make_options( } -def test_continuous_profiler_invalid_mode(mode, teardown_profiling): +def test_continuous_profiler_invalid_mode(teardown_profiling): with pytest.raises(ValueError): setup_continuous_profiler( make_options(mode="foo"),