Просмотр исходного кода

revert(perf-issues): This is a revert of commit SHA 6adcf35f2c554ef873379334ff7afb536eacc71e (#42573)

Reverting a revert. Essentially, this applies all the changes from
https://github.com/getsentry/sentry/pull/42466

to be merged after https://github.com/getsentry/getsentry/pull/9168
Dameli Ushbayeva 2 лет назад
Родитель
Сommit
7f6640a25c

+ 1 - 7
src/sentry/api/endpoints/organization_events_spans_count_histogram.py

@@ -3,7 +3,6 @@ from rest_framework import serializers
 from rest_framework.request import Request
 from rest_framework.request import Request
 from rest_framework.response import Response
 from rest_framework.response import Response
 
 
-from sentry import features
 from sentry.api.base import region_silo_endpoint
 from sentry.api.base import region_silo_endpoint
 from sentry.api.bases import NoProjects, OrganizationEventsV2EndpointBase
 from sentry.api.bases import NoProjects, OrganizationEventsV2EndpointBase
 from sentry.snuba import discover
 from sentry.snuba import discover
@@ -31,17 +30,12 @@ class SpansCountHistogramSerializer(serializers.Serializer):
         return spanOp
         return spanOp
 
 
 
 
+# TODO(udameli): Remove the endpoint because it will not be used
 @region_silo_endpoint
 @region_silo_endpoint
 class OrganizationEventsSpansCountHistogramEndpoint(OrganizationEventsV2EndpointBase):
 class OrganizationEventsSpansCountHistogramEndpoint(OrganizationEventsV2EndpointBase):
     private = True
     private = True
 
 
-    def has_feature(self, organization, request):
-        return features.has("organizations:performance-issues", organization, actor=request.user)
-
     def get(self, request: Request, organization) -> Response:
     def get(self, request: Request, organization) -> Response:
-        if not self.has_feature(organization, request):
-            return Response(status=404)
-
         try:
         try:
             params = self.get_snuba_params(request, organization)
             params = self.get_snuba_params(request, organization)
         except NoProjects:
         except NoProjects:

+ 2 - 5
src/sentry/api/endpoints/project_event_details.py

@@ -5,7 +5,7 @@ from typing import Any, List
 from rest_framework.request import Request
 from rest_framework.request import Request
 from rest_framework.response import Response
 from rest_framework.response import Response
 
 
-from sentry import eventstore, features
+from sentry import eventstore
 from sentry.api.base import region_silo_endpoint
 from sentry.api.base import region_silo_endpoint
 from sentry.api.bases.project import ProjectEndpoint
 from sentry.api.bases.project import ProjectEndpoint
 from sentry.api.serializers import DetailedEventSerializer, serialize
 from sentry.api.serializers import DetailedEventSerializer, serialize
@@ -22,10 +22,7 @@ def wrap_event_response(request_user: Any, event: Event, project: Project, envir
     prev_event_id = None
     prev_event_id = None
 
 
     if event.group_id:
     if event.group_id:
-        if (
-            features.has("organizations:performance-issues", project.organization)
-            and event.get_event_type() == "transaction"
-        ):
+        if event.get_event_type() == "transaction":
             conditions = apply_performance_conditions([], event.group)
             conditions = apply_performance_conditions([], event.group)
             _filter = eventstore.Filter(
             _filter = eventstore.Filter(
                 conditions=conditions,
                 conditions=conditions,

+ 0 - 2
src/sentry/api/endpoints/project_performance_issue_settings.py

@@ -27,8 +27,6 @@ class ProjectPerformanceIssueSettingsEndpoint(ProjectEndpoint):
     def has_feature(self, project, request) -> bool:
     def has_feature(self, project, request) -> bool:
         return features.has(
         return features.has(
             "organizations:performance-view", project.organization, actor=request.user
             "organizations:performance-view", project.organization, actor=request.user
-        ) and features.has(
-            "organizations:performance-issues", project.organization, actor=request.user
         )
         )
 
 
     def get(self, request: Request, project) -> Response:
     def get(self, request: Request, project) -> Response:

+ 1 - 5
src/sentry/api/endpoints/project_rules_configuration.py

@@ -23,7 +23,6 @@ class ProjectRulesConfigurationEndpoint(ProjectEndpoint):
         can_create_tickets = features.has(
         can_create_tickets = features.has(
             "organizations:integrations-ticket-rules", project.organization
             "organizations:integrations-ticket-rules", project.organization
         )
         )
-        perf_issue_filters = features.has("organizations:performance-issues", project.organization)
 
 
         # TODO: conditions need to be based on actions
         # TODO: conditions need to be based on actions
         for rule_type, rule_cls in rules:
         for rule_type, rule_cls in rules:
@@ -69,10 +68,7 @@ class ProjectRulesConfigurationEndpoint(ProjectEndpoint):
                 ):
                 ):
                     condition_list.append(context)
                     condition_list.append(context)
             elif rule_type.startswith("filter/"):
             elif rule_type.startswith("filter/"):
-                if perf_issue_filters or context["id"] not in {
-                    "sentry.rules.filters.issue_category.IssueCategoryFilter",
-                }:
-                    filter_list.append(context)
+                filter_list.append(context)
             elif rule_type.startswith("action/"):
             elif rule_type.startswith("action/"):
                 action_list.append(context)
                 action_list.append(context)
 
 

+ 14 - 18
src/sentry/api/issue_search.py

@@ -143,15 +143,13 @@ def convert_category_value(
     environments: Optional[Sequence[Environment]],
     environments: Optional[Sequence[Environment]],
 ) -> List[int]:
 ) -> List[int]:
     """Convert a value like 'error' or 'performance' to the GroupType value for issue lookup"""
     """Convert a value like 'error' or 'performance' to the GroupType value for issue lookup"""
-    if features.has("organizations:performance-issues", projects[0].organization):
-        results = []
-        for category in value:
-            group_category = getattr(GroupCategory, category.upper(), None)
-            if not group_category:
-                raise InvalidSearchQuery(f"Invalid category value of '{category}'")
-            results.extend([type.value for type in GROUP_CATEGORY_TO_TYPES.get(group_category, [])])
-        return results
-    return []
+    results = []
+    for category in value:
+        group_category = getattr(GroupCategory, category.upper(), None)
+        if not group_category:
+            raise InvalidSearchQuery(f"Invalid category value of '{category}'")
+        results.extend([type.value for type in GROUP_CATEGORY_TO_TYPES.get(group_category, [])])
+    return results
 
 
 
 
 def convert_type_value(
 def convert_type_value(
@@ -161,15 +159,13 @@ def convert_type_value(
     environments: Optional[Sequence[Environment]],
     environments: Optional[Sequence[Environment]],
 ) -> List[int]:
 ) -> List[int]:
     """Convert a value like 'error' or 'performance_n_plus_one_db_queries' to the GroupType value for issue lookup"""
     """Convert a value like 'error' or 'performance_n_plus_one_db_queries' to the GroupType value for issue lookup"""
-    if features.has("organizations:performance-issues", projects[0].organization):
-        results = []
-        for type in value:
-            group_type = getattr(GroupType, type.upper(), None)
-            if not group_type:
-                raise InvalidSearchQuery(f"Invalid type value of '{type}'")
-            results.append(group_type.value)
-        return results
-    return []
+    results = []
+    for type in value:
+        group_type = getattr(GroupType, type.upper(), None)
+        if not group_type:
+            raise InvalidSearchQuery(f"Invalid type value of '{type}'")
+        results.append(group_type.value)
+    return results
 
 
 
 
 value_converters: Mapping[str, ValueConverter] = {
 value_converters: Mapping[str, ValueConverter] = {

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

@@ -1137,8 +1137,6 @@ SENTRY_FEATURES = {
     "organizations:performance-mep-reintroduce-histograms": False,
     "organizations:performance-mep-reintroduce-histograms": False,
     # Enable showing INP web vital in default views
     # Enable showing INP web vital in default views
     "organizations:performance-vitals-inp": False,
     "organizations:performance-vitals-inp": False,
-    # Enable processing transactions in post_process_group
-    "organizations:performance-issues-post-process-group": False,
     # Enable internal view for bannerless MEP view
     # Enable internal view for bannerless MEP view
     "organizations:performance-mep-bannerless-ui": False,
     "organizations:performance-mep-bannerless-ui": False,
     # Enable updated landing page widget designs
     # Enable updated landing page widget designs
@@ -1165,10 +1163,6 @@ SENTRY_FEATURES = {
     "organizations:notification-all-recipients": False,
     "organizations:notification-all-recipients": False,
     # Enable the new native stack trace design
     # Enable the new native stack trace design
     "organizations:native-stack-trace-v2": False,
     "organizations:native-stack-trace-v2": False,
-    # Enable performance issues
-    "organizations:performance-issues": False,
-    # Enable the creation of performance issues in the ingest pipeline. Turning this on will eventually make performance issues be created with default settings.
-    "organizations:performance-issues-ingest": False,
     # Enable performance issues dev options, includes changing detection thresholds and other parts of issues that we're using for development.
     # Enable performance issues dev options, includes changing detection thresholds and other parts of issues that we're using for development.
     "organizations:performance-issues-dev": False,
     "organizations:performance-issues-dev": False,
     # Enables updated all events tab in a performance issue
     # Enables updated all events tab in a performance issue

+ 2 - 7
src/sentry/event_manager.py

@@ -2267,14 +2267,9 @@ def _save_aggregate_performance(jobs: Sequence[PerformanceJob], projects: Projec
         event = job["event"]
         event = job["event"]
         project = event.project
         project = event.project
 
 
-        if not features.has("organizations:performance-issues-ingest", project.organization):
-            continue
-        # General system-wide option
-        rate = options.get("performance.issues.all.problem-creation") or 0
-
-        # More granular, per-project option
+        # Granular, per-project option
         per_project_rate = project.get_option("sentry:performance_issue_creation_rate", 1.0)
         per_project_rate = project.get_option("sentry:performance_issue_creation_rate", 1.0)
-        if rate > random.random() and per_project_rate > random.random():
+        if per_project_rate > random.random():
 
 
             kwargs = _create_kwargs(job)
             kwargs = _create_kwargs(job)
             kwargs["culprit"] = job["culprit"]
             kwargs["culprit"] = job["culprit"]

+ 1 - 5
src/sentry/eventstore/snuba/backend.py

@@ -6,11 +6,9 @@ from datetime import datetime, timedelta
 import sentry_sdk
 import sentry_sdk
 from django.utils import timezone
 from django.utils import timezone
 
 
-from sentry import features
 from sentry.eventstore.base import EventStorage
 from sentry.eventstore.base import EventStorage
 from sentry.eventstore.models import Event
 from sentry.eventstore.models import Event
 from sentry.models.group import Group
 from sentry.models.group import Group
-from sentry.models.organization import Organization
 from sentry.snuba.dataset import Dataset
 from sentry.snuba.dataset import Dataset
 from sentry.snuba.events import Columns
 from sentry.snuba.events import Columns
 from sentry.utils import snuba
 from sentry.utils import snuba
@@ -202,9 +200,7 @@ class SnubaEventStorage(EventStorage):
             # Set passed group_id if not a transaction
             # Set passed group_id if not a transaction
             if event.get_event_type() == "transaction":
             if event.get_event_type() == "transaction":
                 logger.warning("eventstore.passed-group-id-for-transaction")
                 logger.warning("eventstore.passed-group-id-for-transaction")
-                org = Organization.objects.get(project__id=project_id)
-                if features.has("organizations:performance-issues", org):
-                    return event.for_group(Group.objects.get(id=group_id))
+                return event.for_group(Group.objects.get(id=group_id))
             else:
             else:
                 event.group_id = group_id
                 event.group_id = group_id
 
 

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

@@ -116,9 +116,6 @@ default_manager.add("organizations:org-subdomains", OrganizationFeature)
 default_manager.add("organizations:performance-anomaly-detection-ui", OrganizationFeature, True)
 default_manager.add("organizations:performance-anomaly-detection-ui", OrganizationFeature, True)
 default_manager.add("organizations:performance-chart-interpolation", OrganizationFeature, True)
 default_manager.add("organizations:performance-chart-interpolation", OrganizationFeature, True)
 default_manager.add("organizations:performance-dry-run-mep", OrganizationFeature, True)
 default_manager.add("organizations:performance-dry-run-mep", OrganizationFeature, True)
-default_manager.add("organizations:performance-issues", OrganizationFeature, True)
-default_manager.add("organizations:performance-issues-ingest", OrganizationFeature)
-default_manager.add("organizations:performance-issues-post-process-group", OrganizationFeature)
 default_manager.add("organizations:performance-issues-dev", OrganizationFeature, True)
 default_manager.add("organizations:performance-issues-dev", OrganizationFeature, True)
 default_manager.add("organizations:performance-issues-all-events-tab", OrganizationFeature, True)
 default_manager.add("organizations:performance-issues-all-events-tab", OrganizationFeature, True)
 default_manager.add("organizations:performance-onboarding-checklist", OrganizationFeature, True)
 default_manager.add("organizations:performance-onboarding-checklist", OrganizationFeature, True)

+ 1 - 2
src/sentry/issues/search.py

@@ -4,7 +4,6 @@ import functools
 from copy import deepcopy
 from copy import deepcopy
 from typing import Any, Callable, Mapping, Optional, Protocol, Sequence, Set, TypedDict
 from typing import Any, Callable, Mapping, Optional, Protocol, Sequence, Set, TypedDict
 
 
-from sentry import features
 from sentry.api.event_search import SearchFilter, SearchKey, SearchValue
 from sentry.api.event_search import SearchFilter, SearchKey, SearchValue
 from sentry.models import Environment, Organization
 from sentry.models import Environment, Organization
 from sentry.search.events.filter import convert_search_filter_to_snuba_query
 from sentry.search.events.filter import convert_search_filter_to_snuba_query
@@ -139,7 +138,7 @@ def _query_params_for_perf(
     conditions: Sequence[Any],
     conditions: Sequence[Any],
 ) -> Optional[SnubaQueryParams]:
 ) -> Optional[SnubaQueryParams]:
     organization = Organization.objects.filter(id=organization_id).first()
     organization = Organization.objects.filter(id=organization_id).first()
-    if organization and features.has("organizations:performance-issues", organization):
+    if organization:
         transaction_conditions = _updated_conditions(
         transaction_conditions = _updated_conditions(
             "event.type",
             "event.type",
             "=",
             "=",

Некоторые файлы не были показаны из-за большого количества измененных файлов