Skip to content

Commit 7e665c1

Browse files
Merge branch 'master' into isabella/remove-metric-alert-limit-flag
2 parents 7385120 + 310ea71 commit 7e665c1

File tree

1,184 files changed

+8294
-6794
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,184 files changed

+8294
-6794
lines changed

.github/CODEOWNERS

+7-1
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,8 @@ yarn.lock @getsentry/owners-js-de
142142

143143
## Hybrid Cloud
144144
/src/sentry/silo/ @getsentry/hybrid-cloud
145+
/src/sentry/hybridcloud @getsentry/hybrid-cloud
145146
/src/sentry/services/hybrid_cloud/ @getsentry/hybrid-cloud
146-
/src/sentry/api_gateway/ @getsentry/hybrid-cloud
147147
/src/sentry/middleware/api_gateway.py @getsentry/hybrid-cloud
148148
/src/sentry/middleware/customer_domain.py @getsentry/hybrid-cloud
149149
/src/sentry/middleware/subdomain.py @getsentry/hybrid-cloud
@@ -416,6 +416,8 @@ static/app/components/events/eventStatisticalDetector/ @getse
416416
/src/sentry/models/release_threshold @getsentry/enterprise
417417
/src/sentry/api/endpoints/release_threshold*.py @getsentry/enterprise
418418
/src/sentry/web/frontend/auth_login.py @getsentry/enterprise
419+
src/sentry/api/endpoints/oauth_userinfo.py @getsentry/enterprise
420+
src/sentry/api/endpoints/user_social_identity* @getsentry/enterprise
419421
## End of Enterprise
420422

421423

@@ -480,6 +482,7 @@ static/app/components/events/eventStatisticalDetector/ @getse
480482
/static/app/types/metrics.tsx @getsentry/telemetry-experience
481483
/static/app/types/project.tsx @getsentry/telemetry-experience
482484
/static/app/utils/metrics/ @getsentry/telemetry-experience
485+
/static/app/views/ddm/ @getsentry/telemetry-experience
483486
/static/app/views/performance/landing/dynamicSamplingMetricsAccuracy.spec.tsx @getsentry/telemetry-experience
484487
/static/app/views/performance/landing/dynamicSamplingMetricsAccuracyAlert.tsx @getsentry/telemetry-experience
485488
/static/app/views/settings/project/dynamicSampling/ @getsentry/telemetry-experience
@@ -510,3 +513,6 @@ static/app/components/events/eventStatisticalDetector/ @getse
510513
/static/app/utils/analytics.tsx @getsentry/issues
511514
/static/app/utils/routeAnalytics* @getsentry/issues
512515
## End of Issues
516+
517+
## Billing
518+
/src/sentry/api/endpoints/check_am2_compatibility.py @getsentry/revenue

migrations_lockfile.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ feedback: 0003_feedback_add_env
99
hybridcloud: 0009_make_user_id_optional_for_slug_reservation_replica
1010
nodestore: 0002_nodestore_no_dictfield
1111
replays: 0003_add_size_to_recording_segment
12-
sentry: 0606_update_user_to_optional_organization_slug_reservation
12+
sentry: 0607_drop_externalactor_actorid
1313
social_auth: 0002_default_auto_field

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@
137137
"papaparse": "^5.3.2",
138138
"pegjs": "^0.10.0",
139139
"pegjs-loader": "^0.5.6",
140-
"platformicons": "^5.8.1",
140+
"platformicons": "^5.8.2",
141141
"po-catalog-loader": "2.0.0",
142142
"prettier": "3.0.3",
143143
"prismjs": "^1.29.0",

pyproject.toml

-1
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,6 @@ module = [
258258
"sentry.api.endpoints.user_identity_config",
259259
"sentry.api.endpoints.user_index",
260260
"sentry.api.endpoints.user_notification_details",
261-
"sentry.api.endpoints.user_notification_fine_tuning",
262261
"sentry.api.endpoints.user_permission_details",
263262
"sentry.api.endpoints.user_permissions",
264263
"sentry.api.endpoints.user_permissions_config",

requirements-base.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ sentry-kafka-schemas>=0.1.33
6565
sentry-kafka-schemas>=0.1.34
6666
sentry-redis-tools>=0.1.7
6767
sentry-relay>=0.8.35
68-
sentry-sdk>=1.35.0
68+
sentry-sdk>=1.37.0
6969
snuba-sdk>=2.0.9
7070
simplejson>=3.17.6
7171
sqlparse>=0.4.4

requirements-dev-frozen.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ sentry-forked-djangorestframework-stubs==3.14.4.post2
176176
sentry-kafka-schemas==0.1.34
177177
sentry-redis-tools==0.1.7
178178
sentry-relay==0.8.35
179-
sentry-sdk==1.35.0
179+
sentry-sdk==1.37.0
180180
sentry-usage-accountant==0.0.10
181181
simplejson==3.17.6
182182
six==1.16.0

requirements-frozen.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ sentry-arroyo==2.14.21
117117
sentry-kafka-schemas==0.1.34
118118
sentry-redis-tools==0.1.7
119119
sentry-relay==0.8.35
120-
sentry-sdk==1.35.0
120+
sentry-sdk==1.37.0
121121
sentry-usage-accountant==0.0.10
122122
simplejson==3.17.6
123123
six==1.16.0

src/sentry/api/api_owners.py

+2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ class ApiOwner(Enum):
77
Value should map to team's github group
88
"""
99

10+
BILLING = "revenue"
1011
DISCOVER_N_DASHBOARDS = "discover-n-dashboards"
1112
TELEMETRY_EXPERIENCE = "telemetry-experience"
1213
ENTERPRISE = "enterprise"
@@ -23,4 +24,5 @@ class ApiOwner(Enum):
2324
WEB_FRONTEND_SDKS = "team-web-sdk-frontend"
2425
FEEDBACK = "feedback-backend"
2526
CRONS = "crons"
27+
DATA = "data"
2628
UNOWNED = "unowned"

src/sentry/api/base.py

+1-11
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import logging
55
import time
66
from datetime import datetime, timedelta, timezone
7-
from typing import Any, Callable, Iterable, Mapping, Optional, Tuple, Type
7+
from typing import Any, Callable, Iterable, Mapping, Tuple, Type
88
from urllib.parse import quote as urlquote
99

1010
import sentry_sdk
@@ -30,7 +30,6 @@
3030
from sentry.ratelimits.config import DEFAULT_RATE_LIMIT_CONFIG, RateLimitConfig
3131
from sentry.silo import SiloLimit, SiloMode
3232
from sentry.types.ratelimit import RateLimit, RateLimitCategory
33-
from sentry.types.region import is_region_name
3433
from sentry.utils import json
3534
from sentry.utils.audit import create_audit_entry
3635
from sentry.utils.cursors import Cursor
@@ -581,15 +580,6 @@ def track_set_commits_local(self, request: Request, organization_id=None, projec
581580
)
582581

583582

584-
def resolve_region(request: HttpRequest) -> Optional[str]:
585-
subdomain = getattr(request, "subdomain", None)
586-
if subdomain is None:
587-
return None
588-
if is_region_name(subdomain):
589-
return subdomain
590-
return None
591-
592-
593583
class EndpointSiloLimit(SiloLimit):
594584
def modify_endpoint_class(self, decorated_class: Type[Endpoint]) -> type:
595585
dispatch_override = self.create_override(decorated_class.dispatch)

src/sentry/api/bases/organization.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from rest_framework.permissions import BasePermission
1010
from rest_framework.request import Request
1111

12-
from sentry.api.base import Endpoint, resolve_region
12+
from sentry.api.base import Endpoint
1313
from sentry.api.exceptions import ResourceDoesNotExist
1414
from sentry.api.helpers.environments import get_environments
1515
from sentry.api.permissions import SentryPermission
@@ -31,6 +31,7 @@
3131
RpcUserOrganizationContext,
3232
organization_service,
3333
)
34+
from sentry.types.region import subdomain_is_region
3435
from sentry.utils import auth
3536
from sentry.utils.hashlib import hash_values
3637
from sentry.utils.numbers import format_grouped_length
@@ -208,7 +209,7 @@ class ControlSiloOrganizationEndpoint(Endpoint):
208209
def convert_args(
209210
self, request: Request, organization_slug: str | None = None, *args: Any, **kwargs: Any
210211
) -> tuple[tuple[Any, ...], dict[str, Any]]:
211-
if resolve_region(request) is None:
212+
if not subdomain_is_region(request):
212213
subdomain = getattr(request, "subdomain", None)
213214
if subdomain is not None and subdomain != organization_slug:
214215
raise ResourceDoesNotExist
@@ -451,7 +452,7 @@ def get_filter_params(
451452
def convert_args(
452453
self, request: Request, organization_slug: str | None = None, *args: Any, **kwargs: Any
453454
) -> tuple[tuple[Any, ...], dict[str, Any]]:
454-
if resolve_region(request) is None:
455+
if not subdomain_is_region(request):
455456
subdomain = getattr(request, "subdomain", None)
456457
if subdomain is not None and subdomain != organization_slug:
457458
raise ResourceDoesNotExist

src/sentry/api/endpoints/accept_organization_invite.py

+9-4
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import logging
44
from typing import Mapping, Optional
55

6+
from django.http import HttpRequest
67
from django.urls import reverse
78
from rest_framework import status
89
from rest_framework.request import Request
@@ -33,6 +34,7 @@ def get_invite_state(
3334
member_id: int,
3435
organization_slug: Optional[str],
3536
user_id: int,
37+
request: HttpRequest,
3638
) -> Optional[RpcUserInviteContext]:
3739
if organization_slug is None:
3840
member_mapping: OrganizationMemberMapping | None = None
@@ -66,9 +68,8 @@ def get_invite_state(
6668
extra={
6769
"member_id": member_id,
6870
"org_id": member_mapping.organization_id,
69-
"token_expired": invite_context.member.token_expired
70-
if invite_context and invite_context.member
71-
else -1,
71+
"url": request.path,
72+
"method": request.method,
7273
},
7374
)
7475
else:
@@ -103,7 +104,10 @@ def get(
103104
self, request: Request, member_id: int, token: str, organization_slug: Optional[str] = None
104105
) -> Response:
105106
invite_context = get_invite_state(
106-
member_id=int(member_id), organization_slug=organization_slug, user_id=request.user.id
107+
member_id=int(member_id),
108+
organization_slug=organization_slug,
109+
user_id=request.user.id,
110+
request=request,
107111
)
108112
if invite_context is None:
109113
return self.respond_invalid()
@@ -197,6 +201,7 @@ def post(
197201
member_id=int(member_id),
198202
organization_slug=organization_slug,
199203
user_id=request.user.id,
204+
request=request,
200205
)
201206
if invite_context is None:
202207
return self.respond_invalid()

src/sentry/api/endpoints/api_application_rotate_secret.py

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from rest_framework.request import Request
44
from rest_framework.response import Response
55

6+
from sentry.api.api_owners import ApiOwner
67
from sentry.api.api_publish_status import ApiPublishStatus
78
from sentry.api.base import Endpoint, control_silo_endpoint
89
from sentry.api.exceptions import ResourceDoesNotExist
@@ -15,6 +16,7 @@ class ApiApplicationRotateSecretEndpoint(Endpoint):
1516
publish_status = {
1617
"POST": ApiPublishStatus.UNKNOWN,
1718
}
19+
owner = ApiOwner.ENTERPRISE
1820
authentication_classes = (SessionAuthentication,)
1921
permission_classes = (IsAuthenticated,)
2022

src/sentry/api/endpoints/check_am2_compatibility.py

+2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
from rest_framework.request import Request
33
from rest_framework.response import Response
44

5+
from sentry.api.api_owners import ApiOwner
56
from sentry.api.api_publish_status import ApiPublishStatus
67
from sentry.api.base import Endpoint, region_silo_endpoint
78
from sentry.api.permissions import SuperuserPermission
@@ -16,6 +17,7 @@
1617

1718
@region_silo_endpoint
1819
class CheckAM2CompatibilityEndpoint(Endpoint):
20+
owner = ApiOwner.BILLING
1921
publish_status = {
2022
"GET": ApiPublishStatus.UNKNOWN,
2123
}

src/sentry/api/endpoints/codeowners/external_actor/team_details.py

+2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from rest_framework.request import Request
66
from rest_framework.response import Response
77

8+
from sentry.api.api_owners import ApiOwner
89
from sentry.api.api_publish_status import ApiPublishStatus
910
from sentry.api.base import region_silo_endpoint
1011
from sentry.api.bases.external_actor import ExternalActorEndpointMixin, ExternalTeamSerializer
@@ -22,6 +23,7 @@ class ExternalTeamDetailsEndpoint(TeamEndpoint, ExternalActorEndpointMixin):
2223
"DELETE": ApiPublishStatus.UNKNOWN,
2324
"PUT": ApiPublishStatus.UNKNOWN,
2425
}
26+
owner = ApiOwner.ENTERPRISE
2527

2628
def convert_args(
2729
self,

src/sentry/api/endpoints/codeowners/external_actor/team_index.py

+2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from rest_framework.request import Request
55
from rest_framework.response import Response
66

7+
from sentry.api.api_owners import ApiOwner
78
from sentry.api.api_publish_status import ApiPublishStatus
89
from sentry.api.base import region_silo_endpoint
910
from sentry.api.bases.external_actor import ExternalActorEndpointMixin, ExternalTeamSerializer
@@ -19,6 +20,7 @@ class ExternalTeamEndpoint(TeamEndpoint, ExternalActorEndpointMixin):
1920
publish_status = {
2021
"POST": ApiPublishStatus.UNKNOWN,
2122
}
23+
owner = ApiOwner.ENTERPRISE
2224

2325
def post(self, request: Request, team: Team) -> Response:
2426
"""

src/sentry/api/endpoints/codeowners/external_actor/user_details.py

+2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from rest_framework.request import Request
88
from rest_framework.response import Response
99

10+
from sentry.api.api_owners import ApiOwner
1011
from sentry.api.api_publish_status import ApiPublishStatus
1112
from sentry.api.base import region_silo_endpoint
1213
from sentry.api.bases.external_actor import ExternalActorEndpointMixin, ExternalUserSerializer
@@ -24,6 +25,7 @@ class ExternalUserDetailsEndpoint(OrganizationEndpoint, ExternalActorEndpointMix
2425
"DELETE": ApiPublishStatus.UNKNOWN,
2526
"PUT": ApiPublishStatus.UNKNOWN,
2627
}
28+
owner = ApiOwner.ENTERPRISE
2729

2830
def convert_args( # type: ignore[override]
2931
self,

src/sentry/api/endpoints/codeowners/external_actor/user_index.py

+2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from rest_framework.request import Request
55
from rest_framework.response import Response
66

7+
from sentry.api.api_owners import ApiOwner
78
from sentry.api.api_publish_status import ApiPublishStatus
89
from sentry.api.base import region_silo_endpoint
910
from sentry.api.bases import OrganizationEndpoint
@@ -19,6 +20,7 @@ class ExternalUserEndpoint(OrganizationEndpoint, ExternalActorEndpointMixin):
1920
publish_status = {
2021
"POST": ApiPublishStatus.UNKNOWN,
2122
}
23+
owner = ApiOwner.ENTERPRISE
2224

2325
def post(self, request: Request, organization: Organization) -> Response:
2426
"""

src/sentry/api/endpoints/data_scrubbing_selector_suggestions.py

+2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from sentry_relay.processing import pii_selector_suggestions_from_event
66

77
from sentry import nodestore
8+
from sentry.api.api_owners import ApiOwner
89
from sentry.api.api_publish_status import ApiPublishStatus
910
from sentry.api.base import region_silo_endpoint
1011
from sentry.api.bases.organization import OrganizationEndpoint
@@ -16,6 +17,7 @@ class DataScrubbingSelectorSuggestionsEndpoint(OrganizationEndpoint):
1617
publish_status = {
1718
"GET": ApiPublishStatus.UNKNOWN,
1819
}
20+
owner = ApiOwner.OWNERS_INGEST
1921

2022
def get(self, request: Request, organization) -> Response:
2123
"""

src/sentry/api/endpoints/oauth_userinfo.py

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from rest_framework.request import Request
44
from rest_framework.response import Response
55

6+
from sentry.api.api_owners import ApiOwner
67
from sentry.api.api_publish_status import ApiPublishStatus
78
from sentry.api.base import Endpoint, control_silo_endpoint
89
from sentry.api.exceptions import ParameterValidationError, ResourceDoesNotExist, SentryAPIException
@@ -21,6 +22,7 @@ class OAuthUserInfoEndpoint(Endpoint):
2122
publish_status = {
2223
"GET": ApiPublishStatus.UNKNOWN,
2324
}
25+
owner = ApiOwner.ENTERPRISE
2426
authentication_classes = ()
2527
permission_classes = ()
2628

src/sentry/api/endpoints/organization_access_request_details.py

+2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from rest_framework.response import Response
55

66
from sentry import audit_log
7+
from sentry.api.api_owners import ApiOwner
78
from sentry.api.api_publish_status import ApiPublishStatus
89
from sentry.api.base import region_silo_endpoint
910
from sentry.api.bases.organization import OrganizationEndpoint, OrganizationPermission
@@ -49,6 +50,7 @@ class OrganizationAccessRequestDetailsEndpoint(OrganizationEndpoint):
4950
"GET": ApiPublishStatus.UNKNOWN,
5051
"PUT": ApiPublishStatus.UNKNOWN,
5152
}
53+
owner = ApiOwner.ENTERPRISE
5254
permission_classes = [AccessRequestPermission]
5355

5456
# TODO(dcramer): this should go onto AccessRequestPermission
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
from rest_framework.request import Request
2+
from rest_framework.response import Response
3+
4+
from sentry.api.api_owners import ApiOwner
5+
from sentry.api.api_publish_status import ApiPublishStatus
6+
from sentry.api.base import region_silo_endpoint
7+
from sentry.api.bases.organization import OrganizationEndpoint
8+
from sentry.api.serializers import serialize
9+
from sentry.api.serializers.models.code_locations import CodeLocationsSerializer
10+
from sentry.api.utils import get_date_range_from_params
11+
from sentry.sentry_metrics.querying.metadata import get_code_locations
12+
13+
14+
@region_silo_endpoint
15+
class OrganizationDDMMetaEndpoint(OrganizationEndpoint):
16+
owner = ApiOwner.TELEMETRY_EXPERIENCE
17+
18+
publish_status = {
19+
"GET": ApiPublishStatus.PRIVATE,
20+
}
21+
22+
"""Get meta data for one or more metrics for a given set of projects in a time interval"""
23+
# Returns only code locations for now
24+
25+
def get(self, request: Request, organization) -> Response:
26+
start, end = get_date_range_from_params(request.GET)
27+
28+
code_locations = get_code_locations(
29+
metric_mris=request.GET.getlist("metric", []),
30+
start=start,
31+
end=end,
32+
organization=organization,
33+
projects=self.get_projects(request, organization),
34+
)
35+
36+
return Response(
37+
{"codeLocations": serialize(code_locations, request.user, CodeLocationsSerializer())},
38+
status=200,
39+
)

0 commit comments

Comments
 (0)