Skip to content

Commit 7bd57c5

Browse files
Merge branch 'master' into crl/gh-mo-business-gate
2 parents e043866 + 312b3cb commit 7bd57c5

Some content is hidden

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

49 files changed

+2036
-452
lines changed

.github/CODEOWNERS

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -368,8 +368,6 @@ tests/sentry/api/endpoints/test_organization_dashboard_widget_details.py @ge
368368
/src/sentry/toolbar/ @getsentry/replay-frontend @getsentry/replay-backend
369369
/tests/sentry/toolbar/ @getsentry/replay-frontend @getsentry/replay-backend
370370
/static/app/components/devtoolbar/ @getsentry/replay-frontend
371-
/src/sentry/middleware/devtoolbar.py @getsentry/replay-backend
372-
/tests/sentry/middleware/test_devtoolbar.py @getsentry/replay-backend
373371
## End of DevToolbar
374372

375373
## Codecov Merge UX

migrations_lockfile.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@ remote_subscriptions: 0003_drop_remote_subscription
2121

2222
replays: 0005_drop_replay_index
2323

24-
sentry: 0899_organization_slug_upper_idx
24+
sentry: 0902_detection_type_match_size
2525

2626
social_auth: 0002_default_auto_field
2727

2828
tempest: 0002_make_message_type_nullable
2929

3030
uptime: 0042_extra_uptime_indexes
3131

32-
workflow_engine: 0061_backfill_metric_alert_resolution_action_filters
32+
workflow_engine: 0062_workflow_engine_missing_indexes

requirements-dev-frozen.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ sortedcontainers==2.4.0
203203
soupsieve==2.3.2.post1
204204
sqlparse==0.5.0
205205
statsd==3.3.0
206-
stripe==5.5.0
206+
stripe==6.7.0
207207
structlog==22.1.0
208208
supervisor==4.2.5
209209
symbolic==12.14.1

requirements-frozen.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ snuba-sdk==3.0.43
140140
soupsieve==2.3.2.post1
141141
sqlparse==0.5.0
142142
statsd==3.3.0
143-
stripe==5.5.0
143+
stripe==6.7.0
144144
structlog==22.1.0
145145
symbolic==12.14.1
146146
tiktoken==0.8.0

requirements-getsentry.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ iso3166
1111
pycountry==17.5.14
1212
pyvat==1.3.15
1313
reportlab==4.4.0
14-
stripe==5.5.0
14+
stripe==6.7.0

src/sentry/api/endpoints/group_ai_autofix.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ class GroupAutofixEndpoint(GroupAiEndpoint):
3535
enforce_rate_limit = True
3636
rate_limits = {
3737
"POST": {
38-
RateLimitCategory.IP: RateLimit(limit=10, window=60),
39-
RateLimitCategory.USER: RateLimit(limit=10, window=60),
40-
RateLimitCategory.ORGANIZATION: RateLimit(limit=10, window=60),
38+
RateLimitCategory.IP: RateLimit(limit=5, window=60),
39+
RateLimitCategory.USER: RateLimit(limit=5, window=60),
40+
RateLimitCategory.ORGANIZATION: RateLimit(limit=20, window=60 * 60), # 1 hour
4141
},
4242
"GET": {
4343
RateLimitCategory.IP: RateLimit(limit=256, window=60),

src/sentry/features/temporary.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -502,6 +502,8 @@ def register_temporary_features(manager: FeatureManager):
502502
manager.add("organizations:jira-paginated-projects", OrganizationFeature, FeatureHandlerStrategy.FLAGPOLE, api_expose=False)
503503
# Enable single trace summary
504504
manager.add("organizations:single-trace-summary", OrganizationFeature, FeatureHandlerStrategy.FLAGPOLE, api_expose=True)
505+
# Enable users to connect many Sentry orgs to a single Github org
506+
manager.add("organizations:github-multi-org", OrganizationFeature, FeatureHandlerStrategy.FLAGPOLE, api_expose=False)
505507
# Enable Relay extracting logs from breadcrumbs for a project.
506508
manager.add("projects:ourlogs-breadcrumb-extraction", ProjectFeature, FeatureHandlerStrategy.FLAGPOLE, api_expose=False)
507509

@@ -529,8 +531,6 @@ def register_temporary_features(manager: FeatureManager):
529531
manager.add("projects:use-eap-spans-for-metrics-explorer", ProjectFeature, FeatureHandlerStrategy.FLAGPOLE, api_expose=False)
530532
# Enable tagging span with whether or not we should ingest it in the EAP
531533
manager.add("projects:ingest-spans-in-eap", ProjectFeature, FeatureHandlerStrategy.FLAGPOLE, api_expose=False)
532-
# Enables automatically triggering issue summary on alerts
533-
manager.add("projects:trigger-issue-summary-on-alerts", ProjectFeature, FeatureHandlerStrategy.FLAGPOLE, api_expose=False)
534534
# Enable num events in an issue debugging
535535
manager.add("projects:num-events-issue-debugging", ProjectFeature, FeatureHandlerStrategy.FLAGPOLE, api_expose=False)
536536

src/sentry/incidents/models/alert_rule.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,7 @@ class AlertRule(Model):
220220
)
221221
description = models.CharField(max_length=1000, null=True)
222222
detection_type = models.CharField(
223+
max_length=32,
223224
default=AlertRuleDetectionType.STATIC,
224225
db_default=AlertRuleDetectionType.STATIC,
225226
choices=AlertRuleDetectionType.choices,

src/sentry/incidents/subscription_processor.py

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -314,18 +314,21 @@ def process_update(self, subscription_update: QuerySubscriptionUpdate) -> None:
314314
)
315315
comparison_delta = None
316316

317-
if has_metric_alert_processing:
317+
if (
318+
has_metric_alert_processing
319+
and not self.alert_rule.detection_type == AlertRuleDetectionType.DYNAMIC
320+
):
318321
try:
319322
detector = Detector.objects.get(
320323
data_sources__source_id=str(self.subscription.id),
321324
data_sources__type=DATA_SOURCE_SNUBA_QUERY_SUBSCRIPTION,
322325
)
326+
comparison_delta = detector.config.get("comparison_delta")
323327
except Detector.DoesNotExist:
324328
logger.exception(
325329
"Detector not found", extra={"subscription_id": self.subscription.id}
326330
)
327331

328-
comparison_delta = detector.config.get("comparison_delta")
329332
else:
330333
comparison_delta = self.alert_rule.comparison_delta
331334

@@ -361,6 +364,16 @@ def process_update(self, subscription_update: QuerySubscriptionUpdate) -> None:
361364
"organizations:anomaly-detection-alerts", organization
362365
) and features.has("organizations:anomaly-detection-rollout", organization)
363366

367+
alert_triggered_tags = {
368+
"detection_type": self.alert_rule.detection_type,
369+
"organization_id": None,
370+
}
371+
if features.has(
372+
"organizations:workflow-engine-metric-alert-dual-processing-logs",
373+
self.subscription.project.organization,
374+
):
375+
alert_triggered_tags["organization_id"] = self.alert_rule.organization_id
376+
364377
potential_anomalies = None
365378
if (
366379
has_anomaly_detection
@@ -423,7 +436,7 @@ def process_update(self, subscription_update: QuerySubscriptionUpdate) -> None:
423436
) and not self.check_trigger_matches_status(trigger, TriggerStatus.ACTIVE):
424437
metrics.incr(
425438
"incidents.alert_rules.threshold.alert",
426-
tags={"detection_type": self.alert_rule.detection_type},
439+
tags=alert_triggered_tags,
427440
)
428441
incident_trigger = self.trigger_alert_threshold(
429442
trigger, aggregation_value
@@ -440,7 +453,7 @@ def process_update(self, subscription_update: QuerySubscriptionUpdate) -> None:
440453
):
441454
metrics.incr(
442455
"incidents.alert_rules.threshold.resolve",
443-
tags={"detection_type": self.alert_rule.detection_type},
456+
tags=alert_triggered_tags,
444457
)
445458
incident_trigger = self.trigger_resolve_threshold(
446459
trigger, aggregation_value
@@ -462,7 +475,7 @@ def process_update(self, subscription_update: QuerySubscriptionUpdate) -> None:
462475
# And the trigger is not yet active
463476
metrics.incr(
464477
"incidents.alert_rules.threshold.alert",
465-
tags={"detection_type": self.alert_rule.detection_type},
478+
tags=alert_triggered_tags,
466479
)
467480
# triggering a threshold will create an incident and set the status to active
468481
incident_trigger = self.trigger_alert_threshold(trigger, aggregation_value)
@@ -480,7 +493,7 @@ def process_update(self, subscription_update: QuerySubscriptionUpdate) -> None:
480493
):
481494
metrics.incr(
482495
"incidents.alert_rules.threshold.resolve",
483-
tags={"detection_type": self.alert_rule.detection_type},
496+
tags=alert_triggered_tags,
484497
)
485498
incident_trigger = self.trigger_resolve_threshold(
486499
trigger, aggregation_value

src/sentry/integrations/github/client.py

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,13 +86,32 @@ def authorize_request(self, prepared_request: PreparedRequest) -> PreparedReques
8686

8787
def get_installation_info(self, installation_id: int | str) -> dict[str, Any]:
8888
"""
89-
https://docs.github.com/en/rest/apps/apps?apiVersion=2022-11-28#get-an-installation-for-the-authenticated-app
89+
Authentication: JWT
90+
Docs: https://docs.github.com/en/rest/apps/apps?apiVersion=2022-11-28#get-an-installation-for-the-authenticated-app
9091
"""
9192
return self.get(f"/app/installations/{installation_id}")
9293

9394
def get_user_info(self) -> dict[str, Any]:
95+
"""
96+
Authentication: Access Token
97+
Docs: https://docs.github.com/en/rest/users/users?apiVersion=2022-11-28#get-the-authenticated-user
98+
"""
9499
return self.get("/user")
95100

101+
def get_user_info_installations(self):
102+
"""
103+
Authentication: Access Token
104+
Docs: https://docs.github.com/en/rest/apps/installations?apiVersion=2022-11-28#list-app-installations-accessible-to-the-user-access-token
105+
"""
106+
return self.get("/user/installations")
107+
108+
def get_organization_memberships_for_user(self):
109+
"""
110+
Authentication: Access Token
111+
Docs: https://docs.github.com/en/rest/orgs/members?apiVersion=2022-11-28#get-an-organization-membership-for-the-authenticated-user
112+
"""
113+
return self.get("/user/memberships/orgs")
114+
96115

97116
class GithubProxyClient(IntegrationProxyClient):
98117
integration: Integration | RpcIntegration # late init

0 commit comments

Comments
 (0)