diff --git a/src/sentry/conf/server.py b/src/sentry/conf/server.py index d6f6672f00c2..48ab47d26918 100644 --- a/src/sentry/conf/server.py +++ b/src/sentry/conf/server.py @@ -11,7 +11,7 @@ import sys from collections.abc import Callable, Mapping, MutableSequence from datetime import datetime, timedelta -from typing import Any, Final, Literal, Union, overload +from typing import Any, Literal, Union, overload from urllib.parse import urlparse import orjson @@ -2679,32 +2679,12 @@ def custom_parameter_sort(parameter: dict) -> tuple[str, int]: SENTRY_SDK_THREADING_INTEGRATION = os.environ.get("SENTRY_SDK_DISABLE_THREADING") != "1" -# The sample rate to use for profiles. This is conditional on the usage of -# traces_sample_rate. So that means the true sample rate will be approximately -# traces_sample_rate * profiles_sample_rate -# (subject to things like the traces_sampler) -SENTRY_PROFILES_SAMPLE_RATE = 1 if DEBUG else 0 - -# We want to test a few schedulers possible in the profiler. Some are platform -# specific, and each have their own pros/cons. See the sdk for more details. -SENTRY_PROFILER_MODE: Final = "sleep" - -# To have finer control over which process will have profiling enabled, this -# environment variable will be required to enable profiling. +# To have finer control over which process will have continuous profiling enabled, +# this environment variable will be required to enable continuous profiling. # # This is because profiling requires that we run some stuff globally, and we # are not ready to run this on the more critical parts of the codebase such as # the ingest workers yet. -# -# This will allow us to have finer control over where we are running the -# profiler. For example, only on the web server. -SENTRY_PROFILING_ENABLED = os.environ.get("SENTRY_PROFILING_ENABLED", SPOTLIGHT) - -# To have finer control over which process will have continuous profiling enabled, -# this environment variable will be required to enable continuous profiling. -# -# This setting takes precedence over `SENTRY_PROFILING_ENABLED` forcing the SDK -# to operate under the continuous profiling model. SENTRY_CONTINUOUS_PROFILING_ENABLED = os.environ.get("SENTRY_CONTINUOUS_PROFILING_ENABLED", False) # The sample rate to use for continuous profile sessions. This sample rate is diff --git a/src/sentry/conf/types/sdk_config.py b/src/sentry/conf/types/sdk_config.py index 098146bd4e7a..7fbb52ee7f97 100644 --- a/src/sentry/conf/types/sdk_config.py +++ b/src/sentry/conf/types/sdk_config.py @@ -26,9 +26,6 @@ class SdkConfig(TypedDict): before_send: NotRequired[Callable[[Event, Hint], Event | None]] before_send_transaction: NotRequired[Callable[[Event, Hint], Event | None]] before_send_log: NotRequired[Callable[[Log, Hint], Log | None]] - profiles_sample_rate: NotRequired[float] - profiles_sampler: NotRequired[Callable[[dict[str, Any]], float]] - profiler_mode: NotRequired[Literal["sleep", "thread", "gevent", "unknown"]] profile_session_sample_rate: NotRequired[float] profile_lifecycle: NotRequired[Literal["manual", "trace"]] enable_db_query_source: NotRequired[bool] diff --git a/src/sentry/utils/sdk.py b/src/sentry/utils/sdk.py index c8777ea25a7a..6c72f51a0106 100644 --- a/src/sentry/utils/sdk.py +++ b/src/sentry/utils/sdk.py @@ -226,21 +226,6 @@ def traces_sampler(sampling_context): return float(settings.SENTRY_BACKEND_APM_SAMPLING or 0) -def profiles_sampler(sampling_context): - PROFILES_SAMPLING_RATE = { - "consumer.join": options.get("consumer.join.profiling.rate"), - "spans.process.process_message": options.get("spans.process-spans.profiling.rate"), - } - if "transaction_context" in sampling_context: - transaction_name = sampling_context["transaction_context"].get("name") - - if transaction_name in PROFILES_SAMPLING_RATE: - return PROFILES_SAMPLING_RATE[transaction_name] - - # Default to the sampling rate in settings - return float(settings.SENTRY_PROFILES_SAMPLE_RATE or 0) - - def before_send_transaction(event: Event, _: Hint) -> Event | None: # Discard generic redirects. # This condition can be removed once https://github.com/getsentry/team-sdks/issues/48 is fixed. @@ -386,12 +371,9 @@ def configure_sdk(): if settings.SENTRY_CONTINUOUS_PROFILING_ENABLED: sdk_options["profile_session_sample_rate"] = float( - settings.SENTRY_PROFILES_SAMPLE_RATE or 0 + settings.SENTRY_PROFILE_SESSION_SAMPLE_RATE or 0 ) sdk_options["profile_lifecycle"] = settings.SENTRY_PROFILE_LIFECYCLE - elif settings.SENTRY_PROFILING_ENABLED: - sdk_options["profiles_sampler"] = profiles_sampler - sdk_options["profiler_mode"] = settings.SENTRY_PROFILER_MODE from sentry_sdk.integrations.django import DjangoIntegration from sentry_sdk.integrations.logging import LoggingIntegration