Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions MIGRATION_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ 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.
- 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.
Expand Down
4 changes: 1 addition & 3 deletions sentry_sdk/consts.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ class CompressionAlgo(Enum):
IgnoreSpansConfig,
Log,
Metric,
ProfilerMode,
SpanJSON,
TracesSampler,
TransactionProcessor,
Expand All @@ -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],
Expand Down Expand Up @@ -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,
Expand Down
4 changes: 0 additions & 4 deletions sentry_sdk/profiler/__init__.py
Original file line number Diff line number Diff line change
@@ -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 (
Expand All @@ -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",
Expand Down
30 changes: 2 additions & 28 deletions sentry_sdk/profiler/continuous_profiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -82,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

Expand Down Expand Up @@ -153,31 +145,13 @@ 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

_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()

Expand Down
Loading
Loading