Skip to content

Commit eb189ef

Browse files
authored
chore(profiler): Add deprecation warning for session functions (#4171)
We're deprecating the short-lived `start_profile_session` and `stop_profile_session` functions in favor of `start_profiler` and `stop_profiler`, respectively. The functions will be dropped in 3.x, see #4170
1 parent f6db981 commit eb189ef

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

Diff for: sentry_sdk/profiler/continuous_profiler.py

+11-2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import threading
66
import time
77
import uuid
8+
import warnings
89
from collections import deque
910
from datetime import datetime, timezone
1011

@@ -154,7 +155,11 @@ def start_profiler():
154155
def start_profile_session():
155156
# type: () -> None
156157

157-
# TODO: deprecate this as it'll be replaced by `start_profiler`
158+
warnings.warn(
159+
"The `start_profile_session` function is deprecated. Please use `start_profile` instead.",
160+
DeprecationWarning,
161+
stacklevel=2,
162+
)
158163
start_profiler()
159164

160165

@@ -169,7 +174,11 @@ def stop_profiler():
169174
def stop_profile_session():
170175
# type: () -> None
171176

172-
# TODO: deprecate this as it'll be replaced by `stop_profiler`
177+
warnings.warn(
178+
"The `stop_profile_session` function is deprecated. Please use `stop_profile` instead.",
179+
DeprecationWarning,
180+
stacklevel=2,
181+
)
173182
stop_profiler()
174183

175184

0 commit comments

Comments
 (0)