Browse Source

ref(dynamic-sampling): Remove unused feature flags on sentry (#51584)

Riccardo Busetti 1 year ago
parent
commit
47a464dbc9

+ 2 - 9
src/sentry/api/endpoints/project_details.py

@@ -11,7 +11,6 @@ from rest_framework.request import Request
 from rest_framework.response import Response
 from rest_framework.response import Response
 
 
 from sentry import audit_log, features
 from sentry import audit_log, features
-from sentry import options as sentry_options
 from sentry.api.base import region_silo_endpoint
 from sentry.api.base import region_silo_endpoint
 from sentry.api.bases.project import ProjectEndpoint, ProjectPermission
 from sentry.api.bases.project import ProjectEndpoint, ProjectPermission
 from sentry.api.decorators import sudo_required
 from sentry.api.decorators import sudo_required
@@ -371,9 +370,7 @@ class ProjectDetailsEndpoint(ProjectEndpoint):
             data["hasAlertIntegrationInstalled"] = has_alert_integration(project)
             data["hasAlertIntegrationInstalled"] = has_alert_integration(project)
 
 
         # Dynamic Sampling Logic
         # Dynamic Sampling Logic
-        if features.has(
-            "organizations:dynamic-sampling", project.organization
-        ) and sentry_options.get("dynamic-sampling:enabled-biases"):
+        if features.has("organizations:dynamic-sampling", project.organization):
             ds_bias_serializer = DynamicSamplingBiasSerializer(
             ds_bias_serializer = DynamicSamplingBiasSerializer(
                 data=get_user_biases(project.get_option("sentry:dynamic_sampling_biases", None)),
                 data=get_user_biases(project.get_option("sentry:dynamic_sampling_biases", None)),
                 many=True,
                 many=True,
@@ -436,7 +433,6 @@ class ProjectDetailsEndpoint(ProjectEndpoint):
 
 
         if result.get("dynamicSamplingBiases") and not (
         if result.get("dynamicSamplingBiases") and not (
             features.has("organizations:dynamic-sampling", project.organization)
             features.has("organizations:dynamic-sampling", project.organization)
-            and sentry_options.get("dynamic-sampling:enabled-biases")
         ):
         ):
             return Response(
             return Response(
                 {"detail": ["dynamicSamplingBiases is not a valid field"]},
                 {"detail": ["dynamicSamplingBiases is not a valid field"]},
@@ -748,10 +744,7 @@ class ProjectDetailsEndpoint(ProjectEndpoint):
         )
         )
 
 
         data = serialize(project, request.user, DetailedProjectSerializer())
         data = serialize(project, request.user, DetailedProjectSerializer())
-        if not (
-            features.has("organizations:dynamic-sampling", project.organization)
-            and sentry_options.get("dynamic-sampling:enabled-biases")
-        ):
+        if not (features.has("organizations:dynamic-sampling", project.organization)):
             data["dynamicSamplingBiases"] = None
             data["dynamicSamplingBiases"] = None
         # If here because the case of when no dynamic sampling is enabled at all, you would want to kick
         # If here because the case of when no dynamic sampling is enabled at all, you would want to kick
         # out both keys actually
         # out both keys actually

+ 0 - 4
src/sentry/conf/server.py

@@ -1454,8 +1454,6 @@ SENTRY_FEATURES = {
     "organizations:dashboards-mep": False,
     "organizations:dashboards-mep": False,
     # Enable release health widget in dashboards
     # Enable release health widget in dashboards
     "organizations:dashboards-rh-widget": False,
     "organizations:dashboards-rh-widget": False,
-    # Enable the dynamic sampling "Transaction Name" priority in the UI
-    "organizations:dynamic-sampling-transaction-name-priority": False,
     # Enable minimap in the widget viewer modal in dashboards
     # Enable minimap in the widget viewer modal in dashboards
     "organizations:widget-viewer-modal-minimap": False,
     "organizations:widget-viewer-modal-minimap": False,
     # Enable experimental performance improvements.
     # Enable experimental performance improvements.
@@ -1601,8 +1599,6 @@ SENTRY_FEATURES = {
     "organizations:ds-sliding-window": False,
     "organizations:ds-sliding-window": False,
     # Enable the sliding window per org
     # Enable the sliding window per org
     "organizations:ds-sliding-window-org": False,
     "organizations:ds-sliding-window-org": False,
-    # Enable new project/org boost
-    "organizations:ds-boost-new-projects": False,
     # Enable the org recalibration
     # Enable the org recalibration
     "organizations:ds-org-recalibration": False,
     "organizations:ds-org-recalibration": False,
     # Enable view hierarchies options
     # Enable view hierarchies options

+ 2 - 4
src/sentry/discover/models.py

@@ -2,7 +2,7 @@ from django.db import models, transaction
 from django.db.models import Q, UniqueConstraint
 from django.db.models import Q, UniqueConstraint
 from django.utils import timezone
 from django.utils import timezone
 
 
-from sentry import features, options
+from sentry import features
 from sentry.db.models import (
 from sentry.db.models import (
     BaseManager,
     BaseManager,
     FlexibleForeignKey,
     FlexibleForeignKey,
@@ -99,9 +99,7 @@ class TeamKeyTransactionModelManager(BaseManager):
         if project is None:
         if project is None:
             return
             return
 
 
-        if features.has("organizations:dynamic-sampling", project.organization) and options.get(
-            "dynamic-sampling:enabled-biases"
-        ):
+        if features.has("organizations:dynamic-sampling", project.organization):
             from sentry.dynamic_sampling import RuleType, get_enabled_user_biases
             from sentry.dynamic_sampling import RuleType, get_enabled_user_biases
 
 
             # check if option is enabled
             # check if option is enabled

+ 1 - 7
src/sentry/dynamic_sampling/rules/base.py

@@ -56,10 +56,6 @@ def is_sliding_window_org_enabled(organization: Organization) -> bool:
     ) and not features.has("organizations:ds-sliding-window", organization, actor=None)
     ) and not features.has("organizations:ds-sliding-window", organization, actor=None)
 
 
 
 
-def can_boost_new_projects(organization: Organization) -> bool:
-    return features.has("organizations:ds-boost-new-projects", organization, actor=None)
-
-
 def get_guarded_blended_sample_rate(organization: Organization, project: Project) -> float:
 def get_guarded_blended_sample_rate(organization: Organization, project: Project) -> float:
     sample_rate = quotas.get_blended_sample_rate(organization_id=organization.id)  # type:ignore
     sample_rate = quotas.get_blended_sample_rate(organization_id=organization.id)  # type:ignore
 
 
@@ -75,9 +71,7 @@ def get_guarded_blended_sample_rate(organization: Organization, project: Project
     #
     #
     # In case the organization or the project have been recently added, we want to boost to 100% in order to give users
     # In case the organization or the project have been recently added, we want to boost to 100% in order to give users
     # a better experience. Once this condition will become False, the dynamic sampling systems will kick in.
     # a better experience. Once this condition will become False, the dynamic sampling systems will kick in.
-    if can_boost_new_projects(organization) and (
-        is_recently_added(model=organization) or is_recently_added(model=project)
-    ):
+    if is_recently_added(model=project) or is_recently_added(model=organization):
         return 1.0
         return 1.0
 
 
     # We want to use the normal sliding window only if the sliding window at the org level is disabled.
     # We want to use the normal sliding window only if the sliding window at the org level is disabled.

+ 1 - 3
src/sentry/event_manager.py

@@ -919,11 +919,9 @@ def _get_or_create_release_many(jobs: Sequence[Job], projects: ProjectsMapping)
 
 
                 # Dynamic Sampling - Boosting latest release functionality
                 # Dynamic Sampling - Boosting latest release functionality
                 if (
                 if (
-                    options.get("dynamic-sampling:boost-latest-release")
-                    and features.has(
+                    features.has(
                         "organizations:dynamic-sampling", projects[project_id].organization
                         "organizations:dynamic-sampling", projects[project_id].organization
                     )
                     )
-                    and options.get("dynamic-sampling:enabled-biases")
                     and data.get("type") == "transaction"
                     and data.get("type") == "transaction"
                 ):
                 ):
                     with sentry_sdk.start_span(
                     with sentry_sdk.start_span(

+ 0 - 2
src/sentry/features/__init__.py

@@ -218,7 +218,6 @@ default_manager.add("organizations:data-forwarding", OrganizationFeature, Featur
 default_manager.add("organizations:discover-basic", OrganizationFeature, FeatureHandlerStrategy.INTERNAL)
 default_manager.add("organizations:discover-basic", OrganizationFeature, FeatureHandlerStrategy.INTERNAL)
 default_manager.add("organizations:discover-query", OrganizationFeature, FeatureHandlerStrategy.INTERNAL)
 default_manager.add("organizations:discover-query", OrganizationFeature, FeatureHandlerStrategy.INTERNAL)
 default_manager.add("organizations:dynamic-sampling", OrganizationFeature, FeatureHandlerStrategy.INTERNAL)
 default_manager.add("organizations:dynamic-sampling", OrganizationFeature, FeatureHandlerStrategy.INTERNAL)
-default_manager.add("organizations:dynamic-sampling-transaction-name-priority", OrganizationFeature, FeatureHandlerStrategy.REMOTE)
 default_manager.add("organizations:escalating-issues", OrganizationFeature, FeatureHandlerStrategy.INTERNAL)
 default_manager.add("organizations:escalating-issues", OrganizationFeature, FeatureHandlerStrategy.INTERNAL)
 default_manager.add("organizations:escalating-issues-experiment-group", OrganizationFeature, FeatureHandlerStrategy.INTERNAL)
 default_manager.add("organizations:escalating-issues-experiment-group", OrganizationFeature, FeatureHandlerStrategy.INTERNAL)
 default_manager.add("organizations:escalating-issues-v2", OrganizationFeature, FeatureHandlerStrategy.INTERNAL)
 default_manager.add("organizations:escalating-issues-v2", OrganizationFeature, FeatureHandlerStrategy.INTERNAL)
@@ -255,7 +254,6 @@ default_manager.add("organizations:codecov-integration", OrganizationFeature, Fe
 default_manager.add("organizations:codecov-commit-sha-from-git-blame", OrganizationFeature, FeatureHandlerStrategy.REMOTE)
 default_manager.add("organizations:codecov-commit-sha-from-git-blame", OrganizationFeature, FeatureHandlerStrategy.REMOTE)
 default_manager.add("organizations:ds-sliding-window", OrganizationFeature, FeatureHandlerStrategy.INTERNAL)
 default_manager.add("organizations:ds-sliding-window", OrganizationFeature, FeatureHandlerStrategy.INTERNAL)
 default_manager.add("organizations:ds-sliding-window-org", OrganizationFeature, FeatureHandlerStrategy.INTERNAL)
 default_manager.add("organizations:ds-sliding-window-org", OrganizationFeature, FeatureHandlerStrategy.INTERNAL)
-default_manager.add("organizations:ds-boost-new-projects", OrganizationFeature, FeatureHandlerStrategy.INTERNAL)
 default_manager.add("organizations:pr-comment-bot", OrganizationFeature, FeatureHandlerStrategy.REMOTE)
 default_manager.add("organizations:pr-comment-bot", OrganizationFeature, FeatureHandlerStrategy.REMOTE)
 default_manager.add("organizations:ds-org-recalibration", OrganizationFeature, FeatureHandlerStrategy.INTERNAL)
 default_manager.add("organizations:ds-org-recalibration", OrganizationFeature, FeatureHandlerStrategy.INTERNAL)
 
 

+ 1 - 2
src/sentry/models/release.py

@@ -16,7 +16,7 @@ from django.utils.functional import cached_property
 from django.utils.translation import ugettext_lazy as _
 from django.utils.translation import ugettext_lazy as _
 from sentry_relay import RelayError, parse_release
 from sentry_relay import RelayError, parse_release
 
 
-from sentry import features, options
+from sentry import features
 from sentry.constants import BAD_RELEASE_CHARS, COMMIT_RANGE_DELIMITER
 from sentry.constants import BAD_RELEASE_CHARS, COMMIT_RANGE_DELIMITER
 from sentry.db.models import (
 from sentry.db.models import (
     ArrayField,
     ArrayField,
@@ -82,7 +82,6 @@ class ReleaseProjectModelManager(BaseManager):
         # in the project.
         # in the project.
         if (
         if (
             features.has("organizations:dynamic-sampling", project.organization)
             features.has("organizations:dynamic-sampling", project.organization)
-            and options.get("dynamic-sampling:enabled-biases")
             and project_boosted_releases.has_boosted_releases
             and project_boosted_releases.has_boosted_releases
         ):
         ):
             schedule_invalidate_project_config(project_id=project.id, trigger=trigger)
             schedule_invalidate_project_config(project_id=project.id, trigger=trigger)

+ 0 - 5
src/sentry/options/defaults.py

@@ -1263,11 +1263,6 @@ register(
 )  # 1MB
 )  # 1MB
 
 
 # Dynamic Sampling system-wide options
 # Dynamic Sampling system-wide options
-# Kill-switch to disable new dynamic sampling behavior specifically new dynamic sampling biases.
-register("dynamic-sampling:enabled-biases", default=True, flags=FLAG_AUTOMATOR_MODIFIABLE)
-# System-wide options that observes latest releases on transactions and caches these values to be used later in
-# project config computation. This is temporary option to monitor the performance of this feature.
-register("dynamic-sampling:boost-latest-release", default=False, flags=FLAG_AUTOMATOR_MODIFIABLE)
 # Size of the sliding window used for dynamic sampling. It is defaulted to 24 hours.
 # Size of the sliding window used for dynamic sampling. It is defaulted to 24 hours.
 register("dynamic-sampling:sliding_window.size", default=24, flags=FLAG_AUTOMATOR_MODIFIABLE)
 register("dynamic-sampling:sliding_window.size", default=24, flags=FLAG_AUTOMATOR_MODIFIABLE)
 # Number of large transactions to retrieve from Snuba for transaction re-balancing.
 # Number of large transactions to retrieve from Snuba for transaction re-balancing.

+ 2 - 4
src/sentry/relay/config/__init__.py

@@ -19,7 +19,7 @@ import sentry_sdk
 from pytz import utc
 from pytz import utc
 from sentry_sdk import Hub, capture_exception
 from sentry_sdk import Hub, capture_exception
 
 
-from sentry import features, killswitches, options, quotas, utils
+from sentry import features, killswitches, quotas, utils
 from sentry.constants import ObjectStatus
 from sentry.constants import ObjectStatus
 from sentry.datascrubbing import get_datascrubbing_settings, get_pii_config
 from sentry.datascrubbing import get_datascrubbing_settings, get_pii_config
 from sentry.dynamic_sampling import generate_rules
 from sentry.dynamic_sampling import generate_rules
@@ -195,9 +195,7 @@ def get_project_config(
 
 
 
 
 def get_dynamic_sampling_config(project: Project) -> Optional[Mapping[str, Any]]:
 def get_dynamic_sampling_config(project: Project) -> Optional[Mapping[str, Any]]:
-    if features.has("organizations:dynamic-sampling", project.organization) and options.get(
-        "dynamic-sampling:enabled-biases"
-    ):
+    if features.has("organizations:dynamic-sampling", project.organization):
         # For compatibility reasons we want to return an empty list of old rules. This has been done in order to make
         # For compatibility reasons we want to return an empty list of old rules. This has been done in order to make
         # old Relays use empty configs which will result in them forwarding sampling decisions to upstream Relays.
         # old Relays use empty configs which will result in them forwarding sampling decisions to upstream Relays.
         return {"rules": [], "rulesV2": generate_rules(project)}
         return {"rules": [], "rulesV2": generate_rules(project)}

+ 0 - 3
static/app/views/settings/projectPerformance/projectPerformance.tsx

@@ -397,9 +397,6 @@ class ProjectPerformance extends AsyncView<Props, State> {
         type: 'boolean',
         type: 'boolean',
         label: retentionPrioritiesLabels.boostLowVolumeTransactions,
         label: retentionPrioritiesLabels.boostLowVolumeTransactions,
         help: t("Balance high-volume endpoints so they don't drown out low-volume ones"),
         help: t("Balance high-volume endpoints so they don't drown out low-volume ones"),
-        visible: this.props.organization.features.includes(
-          'dynamic-sampling-transaction-name-priority'
-        ),
         getData: this.getRetentionPrioritiesData,
         getData: this.getRetentionPrioritiesData,
       },
       },
       {
       {

Some files were not shown because too many files changed in this diff