Skip to content

Commit f80007d

Browse files
authored
Merge branch 'master' into scttcper/fix-team-project-features-dupe
2 parents 0c90f23 + b901833 commit f80007d

File tree

69 files changed

+2246
-3900
lines changed

Some content is hidden

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

69 files changed

+2246
-3900
lines changed

src/sentry/api/urls.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -563,9 +563,6 @@
563563
from sentry.seer.supergroups.endpoints.organization_supergroup_details import (
564564
OrganizationSupergroupDetailsEndpoint,
565565
)
566-
from sentry.seer.supergroups.endpoints.organization_supergroups import (
567-
OrganizationSupergroupsEndpoint,
568-
)
569566
from sentry.seer.supergroups.endpoints.organization_supergroups_by_group import (
570567
OrganizationSupergroupsByGroupEndpoint,
571568
)
@@ -2439,11 +2436,6 @@ def create_group_urls(name_prefix: str) -> list[URLPattern | URLResolver]:
24392436
OrganizationSeerExplorerUpdateEndpoint.as_view(),
24402437
name="sentry-api-0-organization-seer-explorer-update",
24412438
),
2442-
re_path(
2443-
r"^(?P<organization_id_or_slug>[^/]+)/seer/supergroups/$",
2444-
OrganizationSupergroupsEndpoint.as_view(),
2445-
name="sentry-api-0-organization-supergroups",
2446-
),
24472439
re_path(
24482440
r"^(?P<organization_id_or_slug>[^/]+)/seer/supergroups/by-group/$",
24492441
OrganizationSupergroupsByGroupEndpoint.as_view(),

src/sentry/audit_log/events.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -399,23 +399,23 @@ def _render_repo_event(action: str, audit_log_entry: AuditLogEntry) -> str:
399399

400400
class RepoAddedAuditLogEvent(AuditLogEvent):
401401
def __init__(self) -> None:
402-
super().__init__(event_id=1161, name="REPO_ADDED", api_name="repo.added")
402+
super().__init__(event_id=1170, name="REPO_ADDED", api_name="repo.added")
403403

404404
def render(self, audit_log_entry: AuditLogEntry) -> str:
405405
return _render_repo_event("added", audit_log_entry)
406406

407407

408408
class RepoDisabledAuditLogEvent(AuditLogEvent):
409409
def __init__(self) -> None:
410-
super().__init__(event_id=1162, name="REPO_DISABLED", api_name="repo.disabled")
410+
super().__init__(event_id=1171, name="REPO_DISABLED", api_name="repo.disabled")
411411

412412
def render(self, audit_log_entry: AuditLogEntry) -> str:
413413
return _render_repo_event("disabled", audit_log_entry)
414414

415415

416416
class RepoEnabledAuditLogEvent(AuditLogEvent):
417417
def __init__(self) -> None:
418-
super().__init__(event_id=1163, name="REPO_ENABLED", api_name="repo.enabled")
418+
super().__init__(event_id=1172, name="REPO_ENABLED", api_name="repo.enabled")
419419

420420
def render(self, audit_log_entry: AuditLogEntry) -> str:
421421
return _render_repo_event("enabled", audit_log_entry)

src/sentry/features/temporary.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -481,6 +481,8 @@ def register_temporary_features(manager: FeatureManager) -> None:
481481
manager.add("organizations:tracemetrics-attributes-dropdown-side-panel", OrganizationFeature, FeatureHandlerStrategy.FLAGPOLE, api_expose=True)
482482
# Enable trace metrics product (known internally as tracemetrics) in UI and backend
483483
manager.add("organizations:tracemetrics-enabled", OrganizationFeature, FeatureHandlerStrategy.FLAGPOLE, api_expose=True)
484+
# Enable equations in trace metrics explore
485+
manager.add("organizations:tracemetrics-equations-in-explore", OrganizationFeature, FeatureHandlerStrategy.FLAGPOLE, api_expose=True)
484486
# Enable trace metrics product to be ingested via Relay
485487
manager.add("organizations:tracemetrics-ingestion", OrganizationFeature, FeatureHandlerStrategy.FLAGPOLE, api_expose=True)
486488
# Enable trace metrics multi-metric selection in dashboards

src/sentry/incidents/action_handlers.py

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -462,22 +462,15 @@ def send_alert(
462462

463463
incident_serialized_response = serialize(incident, serializer=IncidentSerializer())
464464

465-
success = send_incident_alert_notification(
465+
send_incident_alert_notification(
466466
notification_context=notification_context,
467467
alert_context=alert_context,
468468
metric_issue_context=metric_issue_context,
469469
incident_serialized_response=incident_serialized_response,
470470
organization=incident.organization,
471+
project_id=project.id,
471472
notification_uuid=notification_uuid,
472473
)
473-
if success:
474-
self.record_alert_sent_analytics(
475-
organization_id=incident.organization.id,
476-
project_id=project.id,
477-
alert_id=incident.alert_rule.id,
478-
external_id=action.sentry_app_id,
479-
notification_uuid=notification_uuid,
480-
)
481474

482475

483476
def format_duration(minutes):

src/sentry/integrations/github/tasks/sync_repos.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ def sync_repos_for_org(organization_integration_id: int) -> None:
188188
event_name="REPO_ADDED",
189189
organization_id=organization_id,
190190
repo=repo,
191-
source="repository sync",
191+
source="automatic SCM syncing",
192192
provider=integration.provider,
193193
)
194194

@@ -197,7 +197,7 @@ def sync_repos_for_org(organization_integration_id: int) -> None:
197197
event_name="REPO_ENABLED",
198198
organization_id=organization_id,
199199
repo=repo,
200-
source="repository sync",
200+
source="automatic SCM syncing",
201201
provider=integration.provider,
202202
)
203203

src/sentry/integrations/services/integration/impl.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@
4545
serialize_integration_external_project,
4646
serialize_organization_integration,
4747
)
48-
from sentry.rules.actions.notify_event_service import find_alert_rule_action_ui_component
4948
from sentry.sentry_apps.api.serializers.app_platform_event import AppPlatformEvent
5049
from sentry.sentry_apps.metrics import (
5150
SentryAppEventType,
@@ -54,7 +53,11 @@
5453
)
5554
from sentry.sentry_apps.models.sentry_app import SentryApp
5655
from sentry.sentry_apps.models.sentry_app_installation import SentryAppInstallation
57-
from sentry.sentry_apps.utils.webhooks import MetricAlertActionType, SentryAppResourceType
56+
from sentry.sentry_apps.utils.webhooks import (
57+
MetricAlertActionType,
58+
SentryAppResourceType,
59+
find_alert_rule_action_ui_component,
60+
)
5861
from sentry.shared_integrations.exceptions import ApiError
5962
from sentry.utils import json
6063
from sentry.utils.sentry_apps import send_and_save_webhook_request

src/sentry/integrations/slack/integration.py

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,12 @@ def send_notification(
114114
client = self.get_client()
115115
try:
116116
client.chat_postMessage(
117-
channel=target.resource_id, blocks=payload["blocks"], text=payload["text"]
117+
channel=target.resource_id,
118+
blocks=payload["blocks"] if len(payload["blocks"]) > 0 else None,
119+
text=payload["text"],
120+
attachments=payload.get("attachments"),
121+
unfurl_links=False,
122+
unfurl_media=False,
118123
)
119124
except SlackApiError as e:
120125
translate_slack_api_error(e)
@@ -132,8 +137,11 @@ def send_notification_with_threading(
132137
)
133138
kwargs: dict[str, Any] = dict(
134139
channel=target.resource_id,
135-
blocks=payload["blocks"],
140+
blocks=payload["blocks"] if len(payload["blocks"]) > 0 else None,
136141
text=payload["text"],
142+
attachments=payload.get("attachments"),
143+
unfurl_links=False,
144+
unfurl_media=False,
137145
)
138146

139147
if threading_context.thread_ts is not None:
@@ -159,8 +167,9 @@ def send_threaded_message(
159167
try:
160168
client.chat_postMessage(
161169
channel=channel_id,
162-
blocks=renderable["blocks"],
170+
blocks=renderable["blocks"] if len(renderable["blocks"]) > 0 else None,
163171
text=renderable["text"],
172+
attachments=renderable.get("attachments"),
164173
thread_ts=thread_ts,
165174
)
166175
except SlackApiError as e:
@@ -178,7 +187,8 @@ def send_threaded_ephemeral_message(
178187
try:
179188
client.chat_postEphemeral(
180189
channel=channel_id,
181-
blocks=renderable["blocks"],
190+
blocks=renderable["blocks"] if len(renderable["blocks"]) > 0 else None,
191+
attachments=renderable.get("attachments"),
182192
text=renderable["text"],
183193
thread_ts=thread_ts,
184194
user=slack_user_id,
@@ -199,7 +209,10 @@ def update_message(
199209
channel=channel_id,
200210
ts=message_ts,
201211
text=renderable["text"],
202-
blocks=renderable["blocks"],
212+
blocks=renderable["blocks"] if len(renderable["blocks"]) > 0 else None,
213+
attachments=renderable.get("attachments"),
214+
unfurl_links=False,
215+
unfurl_media=False,
203216
)
204217
except SlackApiError as e:
205218
translate_slack_api_error(e)

src/sentry/notifications/notification_action/metric_alert_registry/handlers/sentry_app_metric_alert_handler.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,5 +54,6 @@ def send_alert(
5454
metric_issue_context=metric_issue_context,
5555
incident_serialized_response=incident_serialized_response,
5656
organization=organization,
57+
project_id=project.id,
5758
notification_uuid=notification_uuid,
5859
)

src/sentry/notifications/platform/api/endpoints/internal_registered_templates.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
from sentry.notifications.platform.email.provider import EmailRenderer
1313
from sentry.notifications.platform.msteams.provider import MSTeamsRenderable, MSTeamsRenderer
1414
from sentry.notifications.platform.registry import template_registry
15-
from sentry.notifications.platform.slack.provider import SlackRenderer
15+
from sentry.notifications.platform.slack.provider import SlackNotificationProvider
1616
from sentry.notifications.platform.types import (
1717
NotificationData,
1818
NotificationProviderKey,
@@ -92,13 +92,14 @@ def serialize_slack_preview[T: NotificationData](
9292
) -> dict[str, Any]:
9393
data = template.example_data
9494
rendered_template = template.render_example()
95-
message = SlackRenderer.render(data=data, rendered_template=rendered_template)
95+
renderer = SlackNotificationProvider.get_renderer(data=data, category=template.category)
96+
message = renderer.render(data=data, rendered_template=rendered_template)
9697

9798
serialized_blocks = []
9899
for block in message.get("blocks", []):
99100
serialized_blocks.append(block.to_dict())
100101

101-
return {"blocks": serialized_blocks}
102+
return {"blocks": serialized_blocks, "attachments": message.get("attachments")}
102103

103104

104105
def serialize_discord_preview[T: NotificationData](

src/sentry/notifications/platform/slack/provider.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from __future__ import annotations
22

33
from dataclasses import dataclass
4-
from typing import TYPE_CHECKING, NotRequired, TypedDict
4+
from typing import TYPE_CHECKING, Any, NotRequired, TypedDict
55

66
from slack_sdk.models.blocks import (
77
ActionsBlock,
@@ -58,8 +58,8 @@ class SlackProviderThreadingContext(ProviderThreadingContext):
5858

5959
class SlackRenderable(TypedDict):
6060
blocks: list[Block]
61+
attachments: NotRequired[list[dict[str, Any]]]
6162
text: str
62-
color: NotRequired[str]
6363

6464

6565
class SlackRenderer(NotificationRenderer[SlackRenderable]):

0 commit comments

Comments
 (0)