Skip to content

Commit 39a051d

Browse files
committed
Merge branch 'master' into scttcper/resolved-release-pr-link
2 parents a4bfec7 + 65725e3 commit 39a051d

57 files changed

Lines changed: 710 additions & 738 deletions

File tree

Some content is hidden

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

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ dependencies = [
5757
"mmh3>=4.0.0",
5858
"msgspec>=0.19.0",
5959
"msgpack>=1.2.1",
60-
"objectstore-client>=0.1.11",
60+
"objectstore-client>=0.1.13",
6161
"openai>=1.3.5",
6262
"orjson>=3.10.10",
6363
"packaging>=24.1",
@@ -85,7 +85,7 @@ dependencies = [
8585
"rfc3339-validator>=0.1.2",
8686
"rfc3986-validator>=0.1.1",
8787
# [end] jsonschema format validators
88-
"sentry-arroyo>=2.41.1",
88+
"sentry-arroyo>=2.41.3",
8989
"sentry-conventions>=0.15.0",
9090
"sentry-forked-email-reply-parser>=0.5.12.post1",
9191
"sentry-kafka-schemas>=2.1.40",

src/sentry/api/serializers/models/event.py

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from collections import defaultdict
55
from collections.abc import Sequence
66
from datetime import datetime, timezone
7-
from typing import Any, TypedDict
7+
from typing import Any, NotRequired, TypedDict
88

99
import sentry_sdk
1010
import sqlparse
@@ -16,11 +16,13 @@
1616
from sentry.api.serializers.models.release import GroupEventReleaseSerializer
1717
from sentry.api.serializers.models.userreport import UserReportSerializerResponse
1818
from sentry.api.serializers.types import GroupEventReleaseSerializerResponse
19+
from sentry.eventtypes import EventTypeStr
1920
from sentry.grouping.api import GroupingConfig
21+
from sentry.interfaces.sdk import EventSdkApiContext
2022
from sentry.interfaces.user import EventUserApiContext
2123
from sentry.issues.issue_occurrence import IssueOccurrenceResponse
2224
from sentry.models.eventattachment import EventAttachment
23-
from sentry.models.eventerror import EventError
25+
from sentry.models.eventerror import EventError, EventErrorApiContext
2426
from sentry.models.release import Release
2527
from sentry.models.userreport import UserReport
2628
from sentry.sdk_updates import SdkSetupState, get_suggested_updates
@@ -53,6 +55,11 @@ class EventTag(EventTagOptional):
5355
value: str
5456

5557

58+
class MeasurementValue(TypedDict):
59+
value: float
60+
unit: NotRequired[str | None]
61+
62+
5663
def get_crash_files(events):
5764
event_ids = [x.event_id for x in events if x.platform == "native"]
5865
if event_ids:
@@ -160,12 +167,12 @@ class BaseEventSerializerResponse(TypedDict):
160167
size: int | None
161168
entries: list[Any]
162169
dist: str | None
163-
sdk: dict[str, str]
170+
sdk: EventSdkApiContext | None
164171
context: dict[str, Any] | None
165172
packages: dict[str, Any]
166-
type: str
167-
metadata: Any
168-
errors: list[Any]
173+
type: EventTypeStr
174+
metadata: dict[str, Any]
175+
errors: list[EventErrorApiContext]
169176
occurrence: IssueOccurrenceResponse | None
170177
_meta: dict[str, Any]
171178

@@ -179,10 +186,10 @@ class ErrorEventFields(TypedDict, total=False):
179186

180187

181188
class TransactionEventFields(TypedDict, total=False):
182-
startTimestamp: datetime
183-
endTimestamp: datetime
184-
measurements: Any
185-
breakdowns: Any
189+
startTimestamp: float
190+
endTimestamp: float
191+
measurements: dict[str, MeasurementValue] | None
192+
breakdowns: dict[str, dict[str, MeasurementValue]] | None
186193

187194

188195
class EventSerializerResponse(
@@ -599,7 +606,7 @@ def serialize(self, obj, attrs, user, **kwargs):
599606
"platform": str | None,
600607
"dateCreated": datetime,
601608
"crashFile": str | None,
602-
"metadata": dict[str, Any] | None,
609+
"metadata": dict[str, Any],
603610
},
604611
)
605612

src/sentry/api/serializers/models/group.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
from sentry.api.serializers import Serializer, register, serialize
1717
from sentry.api.serializers.models.actor import ActorSerializer, ActorSerializerResponse
1818
from sentry.constants import LOG_LEVELS
19+
from sentry.eventtypes import EventTypeStr
1920
from sentry.integrations.mixins.issues import IssueBasicIntegration
2021
from sentry.integrations.services.integration import integration_service
2122
from sentry.issues.grouptype import GroupCategory
@@ -135,7 +136,7 @@ class BaseGroupSerializerResponse(BaseGroupResponseOptional):
135136
seerAutofixLastTriggered: datetime | None
136137
seerExplorerAutofixLastTriggered: datetime | None
137138
project: GroupProjectResponse
138-
type: str
139+
type: EventTypeStr
139140
issueType: str
140141
issueCategory: str
141142
metadata: dict[str, Any]
@@ -1201,7 +1202,7 @@ class SimpleGroupSerializerResponse(TypedDict):
12011202
substatus: GroupSubStatusStr | None
12021203
platform: str | None
12031204
project: GroupProjectResponse
1204-
type: str
1205+
type: EventTypeStr
12051206
issueType: str
12061207
issueCategory: str
12071208
metadata: dict[str, Any]

src/sentry/api/serializers/models/group_stream.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
snuba_tsdb,
2727
)
2828
from sentry.constants import StatsPeriod
29+
from sentry.eventtypes import EventTypeStr
2930
from sentry.integrations.api.serializers.models.external_issue import ExternalIssueSerializer
3031
from sentry.integrations.models.external_issue import ExternalIssue
3132
from sentry.issues.grouptype import GroupCategory
@@ -265,7 +266,7 @@ class StreamGroupSerializerSnubaResponse(TypedDict):
265266
seerAutofixLastTriggered: NotRequired[datetime | None]
266267
seerExplorerAutofixLastTriggered: NotRequired[datetime | None]
267268
project: NotRequired[GroupProjectResponse]
268-
type: NotRequired[str]
269+
type: NotRequired[EventTypeStr]
269270
issueType: NotRequired[str]
270271
issueCategory: NotRequired[str]
271272
metadata: NotRequired[dict[str, Any]]

src/sentry/api/urls.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -520,9 +520,6 @@
520520
from sentry.seer.endpoints.organization_seer_agent_pr_groups import (
521521
OrganizationSeerAgentPRGroupsEndpoint,
522522
)
523-
from sentry.seer.endpoints.organization_seer_agent_runs import (
524-
OrganizationSeerAgentRunsEndpoint,
525-
)
526523
from sentry.seer.endpoints.organization_seer_agent_update import (
527524
OrganizationSeerAgentUpdateEndpoint,
528525
)
@@ -2361,11 +2358,6 @@ def create_group_urls(name_prefix: str) -> list[URLPattern | URLResolver]:
23612358
OrganizationSeerAgentChatEndpoint.as_view(),
23622359
name="sentry-api-0-organization-seer-explorer-chat-run-id",
23632360
),
2364-
re_path(
2365-
r"^(?P<organization_id_or_slug>[^/]+)/seer/explorer-runs/$",
2366-
OrganizationSeerAgentRunsEndpoint.as_view(),
2367-
name="sentry-api-0-organization-seer-explorer-runs",
2368-
),
23692361
re_path(
23702362
r"^(?P<organization_id_or_slug>[^/]+)/seer/runs/$",
23712363
OrganizationSeerRunsEndpoint.as_view(),

src/sentry/apidocs/examples/event_examples.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,13 @@
22

33
from drf_spectacular.utils import OpenApiExample
44

5-
from sentry.api.serializers.models.event import EventSerializerResponse, GroupEventDetailsResponse
5+
from sentry.api.serializers.models.event import (
6+
EventSerializerResponse,
7+
GroupEventDetailsResponse,
8+
SimpleEventSerializerResponse,
9+
)
610

7-
SIMPLE_EVENT = {
11+
SIMPLE_EVENT: SimpleEventSerializerResponse = {
812
"eventID": "9fac2ceed9344f2bbfdd1fdacb0ed9b1",
913
"tags": [
1014
{"key": "browser", "value": "Chrome 60.0"},
@@ -16,7 +20,7 @@
1620
{"key": "release", "value": "17642328ead24b51867165985996d04b29310337"},
1721
{"key": "server_name", "value": "web1.example.com"},
1822
],
19-
"dateCreated": "2020-09-11T17:46:36Z",
23+
"dateCreated": datetime.fromisoformat("2020-09-11T17:46:36Z"),
2024
"user": None,
2125
"message": "",
2226
"title": "This is an example Python exception",
@@ -28,7 +32,10 @@
2832
"location": "example.py:123",
2933
"culprit": "/books/new/",
3034
"projectID": "49271",
31-
"metadata": None,
35+
"metadata": {
36+
"type": "ExampleException",
37+
"value": "This is an example Python exception",
38+
},
3239
}
3340

3441
GROUP_EVENT: GroupEventDetailsResponse = {

src/sentry/apidocs/examples/organization_examples.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -956,7 +956,7 @@ class OrganizationExamples:
956956
"packages": {"my.package": "1.0.0"},
957957
"platform": "python",
958958
"projectID": "1",
959-
"sdk": {},
959+
"sdk": {"name": "sentry.python", "version": "2.0.0"},
960960
"size": 7055,
961961
"tags": [
962962
{"key": "browser", "value": "Chrome 28.0"},

src/sentry/eventtypes/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from sentry.eventtypes.base import DefaultEvent
2+
from sentry.eventtypes.base import EventTypeStr as EventTypeStr
23
from sentry.eventtypes.error import ErrorEvent
34
from sentry.eventtypes.feedback import FeedbackEvent
45
from sentry.eventtypes.generic import GenericEvent

src/sentry/eventtypes/base.py

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,28 @@
11
from collections.abc import Mapping, MutableMapping
2-
from typing import Any
2+
from typing import Any, ClassVar, Literal
33
from warnings import warn
44

55
from sentry.utils.safe import get_path
66
from sentry.utils.strings import strip, truncatechars
77

88
# Note: Detecting eventtypes is implemented in the Relay Rust library.
99

10+
EventTypeStr = Literal[
11+
"default",
12+
"error",
13+
"csp",
14+
"nel",
15+
"hpkp",
16+
"expectct",
17+
"expectstaple",
18+
"transaction",
19+
"generic",
20+
"feedback",
21+
]
22+
1023

1124
class BaseEvent:
12-
key: str # abstract
25+
key: ClassVar[EventTypeStr] # abstract
1326

1427
def get_metadata(self, data: MutableMapping[str, Any]) -> dict[str, str]:
1528
metadata = self.extract_metadata(data)
@@ -42,7 +55,7 @@ def to_string(self, metadata: dict[str, str | None]) -> str:
4255

4356

4457
class DefaultEvent(BaseEvent):
45-
key = "default"
58+
key: ClassVar[EventTypeStr] = "default"
4659

4760
def extract_metadata(self, data: MutableMapping[str, Any]) -> dict[str, str]:
4861
message = strip(

src/sentry/features/temporary.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,8 @@ def register_temporary_features(manager: FeatureManager) -> None:
204204
manager.add("organizations:preprod-build-distribution-pr-comments", OrganizationFeature, FeatureHandlerStrategy.FLAGPOLE, api_expose=True)
205205
# Enable enforcement of preprod distribution quota checks (when disabled, distribution quota checks always return True)
206206
manager.add("organizations:preprod-enforce-distribution-quota", OrganizationFeature, FeatureHandlerStrategy.FLAGPOLE, api_expose=False)
207+
# Enable preprod PR comments for size analysis
208+
manager.add("organizations:preprod-size-analysis-pr-comments", OrganizationFeature, FeatureHandlerStrategy.FLAGPOLE, api_expose=True)
207209
# Enable preprod size monitors frontend
208210
manager.add("organizations:preprod-size-monitors-frontend", OrganizationFeature, FeatureHandlerStrategy.FLAGPOLE, api_expose=True)
209211
# Enables the playstation ingestion in relay
@@ -342,6 +344,8 @@ def register_temporary_features(manager: FeatureManager) -> None:
342344
manager.add("organizations:seer-public-rpc", OrganizationFeature, FeatureHandlerStrategy.FLAGPOLE, api_expose=False)
343345
# Organizations on the old usage-based (v0) Seer plan
344346
manager.add("organizations:seer-added", OrganizationFeature, FeatureHandlerStrategy.INTERNAL, api_expose=True)
347+
# Enables auto-conversion of number operators for search query builder
348+
manager.add("organizations:search-query-builder-number-operator-conversion", OrganizationFeature, FeatureHandlerStrategy.FLAGPOLE, api_expose=True)
345349
# Organizations on the new seat-based Seer plan
346350
manager.add("organizations:seat-based-seer-enabled", OrganizationFeature, FeatureHandlerStrategy.INTERNAL, api_expose=True)
347351
# Render Sentry App schema-backed forms using the backend JSON form adapter.

0 commit comments

Comments
 (0)