Skip to content

fix: correct function names in deprecation warnings for start/stop_pr… - #8268

Open
AHS0003 wants to merge 1 commit into
getsentry:masterfrom
AHS0003:fix/deprecation-warning-function-names
Open

AHS0003 wants to merge 1 commit into
getsentry:masterfrom
AHS0003:fix/deprecation-warning-function-names

Conversation

@AHS0003

@AHS0003 AHS0003 commented Nov 13, 2026

Copy link
Copy Markdown

Fix incorrect function names in deprecation warnings

Problem

start_profile_session() and stop_profile_session() are deprecated wrappers in
sentry_sdk/profiler/continuous_profiler.py. Their deprecation warnings tell users to migrate to
start_profile and stop_profile but those functions do not exist in the codebase.

Fix

Point the warnings to the correct replacement functions: start_profiler and stop_profiler.

 def start_profile_session() -> None:
     warnings.warn(
-        "The `start_profile_session` function is deprecated. Please use `start_profile` instead.",
+        "The `start_profile_session` function is deprecated. Please use `start_profiler` instead.",
         DeprecationWarning,
         stacklevel=2,
     )

 def stop_profile_session() -> None:
     warnings.warn(
-        "The `stop_profile_session` function is deprecated. Please use `stop_profile` instead.",
+        "The `stop_profile_session` function is deprecated. Please use `stop_profiler` instead.",
         DeprecationWarning,
         stacklevel=2,
     )

Notes

The comment in sentry_sdk/profiler/__init__.py already confirms the intent:

"start_profile_session",  # TODO: Deprecate this in favor of `start_profiler`
"stop_profile_session",   # TODO: Deprecate this in favor of `stop_profiler`

The deprecation was implemented but with the wrong target name, so any user following
the warning would get a AttributeError trying to call a function that doesn't exist.

@AHS0003
AHS0003 requested a review from a team as a code owner November 13, 2026 22:41

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant