Browse Source

Merge remote-tracking branch 'origin/master' into aknaus/feat/metrics-extraction/selectable-aggregates

Arthur Knaus 3 days ago
parent
commit
83b493d1ba

+ 1 - 7
pyproject.toml

@@ -528,10 +528,7 @@ module = [
     "sentry.grouping.component",
     "sentry.grouping.fingerprinting",
     "sentry.grouping.parameterization",
-    "sentry.hybridcloud",
-    "sentry.hybridcloud.migrations.*",
-    "sentry.hybridcloud.options",
-    "sentry.hybridcloud.rpc_services.*",
+    "sentry.hybridcloud.*",
     "sentry.issues",
     "sentry.issues.analytics",
     "sentry.issues.apps",
@@ -596,14 +593,11 @@ module = [
     "sentry.services.hybrid_cloud.orgauthtoken.*",
     "sentry.services.hybrid_cloud.project.*",
     "sentry.services.hybrid_cloud.project_key.*",
-    "sentry.services.hybrid_cloud.region",
     "sentry.services.hybrid_cloud.replica.*",
     "sentry.services.hybrid_cloud.repository.*",
-    "sentry.services.hybrid_cloud.rpcmetrics",
     "sentry.services.hybrid_cloud.tombstone.*",
     "sentry.services.hybrid_cloud.user.*",
     "sentry.services.hybrid_cloud.user_option.*",
-    "sentry.services.hybrid_cloud.util",
     "sentry.snuba.metrics.extraction",
     "sentry.stacktraces.platform",
     "sentry.tasks.beacon",

+ 1 - 1
requirements-base.txt

@@ -66,7 +66,7 @@ sentry-kafka-schemas>=0.1.93
 sentry-ophio==0.2.7
 sentry-redis-tools>=0.1.7
 sentry-relay>=0.8.67
-sentry-sdk>=2.6.0
+sentry-sdk>=2.7.0
 slack-sdk>=3.27.2
 snuba-sdk>=2.0.33
 simplejson>=3.17.6

+ 1 - 1
requirements-dev-frozen.txt

@@ -186,7 +186,7 @@ sentry-kafka-schemas==0.1.93
 sentry-ophio==0.2.7
 sentry-redis-tools==0.1.7
 sentry-relay==0.8.67
-sentry-sdk==2.6.0
+sentry-sdk==2.7.0
 sentry-usage-accountant==0.0.10
 simplejson==3.17.6
 six==1.16.0

+ 1 - 1
requirements-frozen.txt

@@ -127,7 +127,7 @@ sentry-kafka-schemas==0.1.93
 sentry-ophio==0.2.7
 sentry-redis-tools==0.1.7
 sentry-relay==0.8.67
-sentry-sdk==2.6.0
+sentry-sdk==2.7.0
 sentry-usage-accountant==0.0.10
 simplejson==3.17.6
 six==1.16.0

+ 1 - 3
src/sentry/api/base.py

@@ -46,7 +46,6 @@ from sentry.utils.http import (
 )
 from sentry.utils.sdk import capture_exception, merge_context_into_scope
 
-from ..services.hybrid_cloud import rpcmetrics
 from ..utils.pagination_factory import (
     annotate_span_with_pagination_args,
     clamp_pagination_per_page,
@@ -449,8 +448,7 @@ class Endpoint(APIView):
                     getattr(part, "__name__", None) or str(part) for part in (type(self), handler)
                 ),
             ) as span:
-                with rpcmetrics.wrap_sdk_span(span):
-                    response = handler(request, *args, **kwargs)
+                response = handler(request, *args, **kwargs)
 
         except Exception as exc:
             response = self.handle_exception(request, exc)

+ 4 - 1
src/sentry/api/endpoints/organization_details.py

@@ -36,6 +36,7 @@ from sentry.constants import (
     DATA_CONSENT_DEFAULT,
     DEBUG_FILES_ROLE_DEFAULT,
     EVENTS_MEMBER_ADMIN_DEFAULT,
+    EXTRAPOLATE_METRICS_DEFAULT,
     GITHUB_COMMENT_BOT_DEFAULT,
     ISSUE_ALERTS_THREAD_DEFAULT,
     JOIN_REQUESTS_DEFAULT,
@@ -52,6 +53,7 @@ from sentry.constants import (
     SENSITIVE_FIELDS_DEFAULT,
 )
 from sentry.datascrubbing import validate_pii_config_update, validate_pii_selectors
+from sentry.hybridcloud.rpc import IDEMPOTENCY_KEY_LENGTH
 from sentry.integrations.utils.codecov import has_codecov_integration
 from sentry.lang.native.utils import (
     STORE_CRASH_REPORTS_DEFAULT,
@@ -63,7 +65,6 @@ from sentry.models.options.organization_option import OrganizationOption
 from sentry.models.organization import Organization, OrganizationStatus
 from sentry.models.scheduledeletion import RegionScheduledDeletion
 from sentry.models.useremail import UserEmail
-from sentry.services.hybrid_cloud import IDEMPOTENCY_KEY_LENGTH
 from sentry.services.hybrid_cloud.auth import auth_service
 from sentry.services.hybrid_cloud.organization import organization_service
 from sentry.services.hybrid_cloud.organization.model import (
@@ -204,6 +205,7 @@ ORG_OPTIONS = (
         bool,
         METRICS_ACTIVATE_LAST_FOR_GAUGES_DEFAULT,
     ),
+    ("extrapolateMetrics", "sentry:extrapolate_metrics", bool, EXTRAPOLATE_METRICS_DEFAULT),
 )
 
 DELETION_STATUSES = frozenset(
@@ -262,6 +264,7 @@ class OrganizationSerializer(BaseOrganizationSerializer):
     allowJoinRequests = serializers.BooleanField(required=False)
     relayPiiConfig = serializers.CharField(required=False, allow_blank=True, allow_null=True)
     apdexThreshold = serializers.IntegerField(min_value=1, required=False)
+    extrapolateMetrics = serializers.BooleanField(required=False)
 
     @cached_property
     def _has_legacy_rate_limits(self):

+ 1 - 0
src/sentry/api/endpoints/organization_events.py

@@ -194,6 +194,7 @@ class OrganizationEventsEndpoint(OrganizationEventsV2EndpointBase):
     publish_status = {
         "GET": ApiPublishStatus.PUBLIC,
     }
+    snuba_methods = ["GET"]
 
     enforce_rate_limit = True
 

+ 3 - 1
src/sentry/api/endpoints/organization_events_meta.py

@@ -23,6 +23,7 @@ class OrganizationEventsMetaEndpoint(OrganizationEventsEndpointBase):
     publish_status = {
         "GET": ApiPublishStatus.PRIVATE,
     }
+    snuba_methods = ["GET"]
 
     def get(self, request: Request, organization) -> Response:
         try:
@@ -37,7 +38,7 @@ class OrganizationEventsMetaEndpoint(OrganizationEventsEndpointBase):
                 selected_columns=["count()"],
                 params=params,
                 query=request.query_params.get("query"),
-                referrer="api.organization-events-meta",
+                referrer=Referrer.API_ORGANIZATION_EVENTS_META.value,
             )
 
         return Response({"count": result["data"][0]["count"]})
@@ -114,6 +115,7 @@ class OrganizationSpansSamplesEndpoint(OrganizationEventsEndpointBase):
     publish_status = {
         "GET": ApiPublishStatus.PRIVATE,
     }
+    snuba_methods = ["GET"]
 
     def get(self, request: Request, organization) -> Response:
         try:

+ 1 - 0
src/sentry/api/endpoints/organization_events_stats.py

@@ -111,6 +111,7 @@ class OrganizationEventsStatsEndpoint(OrganizationEventsV2EndpointBase):
     publish_status = {
         "GET": ApiPublishStatus.UNKNOWN,
     }
+    sunba_methods = ["GET"]
 
     def get_features(self, organization: Organization, request: Request) -> Mapping[str, bool]:
         feature_names = [

+ 10 - 5
src/sentry/api/endpoints/organization_events_trace.py

@@ -277,7 +277,9 @@ class TraceEvent:
                         selected_columns=["occurrence_id"],
                     )
                     occurrence_ids = occurrence_query.process_results(
-                        occurrence_query.run_query("api.trace-view.get-occurrence-ids")
+                        occurrence_query.run_query(
+                            referrer=Referrer.API_TRACE_VIEW_GET_OCCURRENCE_IDS.value
+                        )
                     )["data"]
 
                     issue_occurrences = IssueOccurrence.fetch_multi(
@@ -470,7 +472,9 @@ def count_performance_issues(trace_id: str, params: Mapping[str, str]) -> int:
         limit=MAX_TRACE_SIZE,
     )
     transaction_query.columns.append(Function("count()", alias="total_groups"))
-    count = transaction_query.run_query("api.trace-view.count-performance-issues")
+    count = transaction_query.run_query(
+        referrer=Referrer.API_TRACE_VIEW_COUNT_PERFORMANCE_ISSUES.value
+    )
     return count["data"][0].get("total_groups", 0)
 
 
@@ -627,7 +631,7 @@ def query_trace_data(
             error_query.get_snql_query(),
             occurrence_query.get_snql_query(),
         ],
-        referrer="api.trace-view.get-events",
+        referrer=Referrer.API_TRACE_VIEW_GET_EVENTS.value,
     )
 
     transformed_results = [
@@ -837,7 +841,7 @@ def augment_transactions_with_spans(
             referrer=Referrer.API_TRACE_VIEW_GET_PARENTS.value,
         )
         parents_results = results[0]
-        for (result, query) in zip(results, queries):
+        for result, query in zip(results, queries):
             if len(result["data"]) == query.limit.limit:
                 hit_limit = True
         for result in results[1:]:
@@ -887,6 +891,7 @@ class OrganizationEventsTraceEndpointBase(OrganizationEventsV2EndpointBase):
     publish_status = {
         "GET": ApiPublishStatus.PRIVATE,
     }
+    snuba_methods = ["GET"]
 
     def get_projects(self, request: Request, organization, project_ids=None, project_slugs=None):
         """The trace endpoint always wants to get all projects regardless of what's passed into the API
@@ -1601,7 +1606,7 @@ class OrganizationEventsTraceMetaEndpoint(OrganizationEventsTraceEndpointBase):
                 params=params,
                 query=f"trace:{trace_id}",
                 limit=1,
-                referrer="api.trace-view.get-meta",
+                referrer=Referrer.API_TRACE_VIEW_GET_META.value,
             )
             if len(result["data"]) == 0:
                 return Response(status=404)

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