Skip to content

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

Merged
sentrivana merged 1 commit into
getsentry:masterfrom
AHS0003:fix/deprecation-warning-function-names
Nov 16, 2026
Merged

sentrivana merged 1 commit into
getsentry:masterfrom
AHS0003:fix/deprecation-warning-function-names

Conversation

@AHS0003

@AHS0003 AHS0003 commented Nov 13, 2026

Copy link
Copy Markdown
Contributor

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

@sentrivana sentrivana left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, ty @AHS0003

@sentrivana
sentrivana enabled auto-merge (squash) November 16, 2026 08:44
@sentrivana
sentrivana merged commit c944c23 into getsentry:master Nov 16, 2026
167 checks passed
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.

2 participants