Skip to content

Commit 51b8fba

Browse files
authored
ref(integration-platform): Add ALERTS feature (#22614)
* ref(integration-platform): Add ALERTS feature * the migration
1 parent 58398b3 commit 51b8fba

File tree

3 files changed

+45
-1
lines changed

3 files changed

+45
-1
lines changed

migrations_lockfile.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ auth: 0008_alter_user_username_max_length
1010
contenttypes: 0002_remove_content_type_name
1111
jira_ac: 0001_initial
1212
nodestore: 0001_initial
13-
sentry: 0142_add_dashboard_tombstone
13+
sentry: 0143_add_alerts_integrationfeature
1414
sessions: 0001_initial
1515
sites: 0002_alter_domain_unique
1616
social_auth: 0001_initial
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# -*- coding: utf-8 -*-
2+
# Generated by Django 1.11.29 on 2020-12-10 23:55
3+
from __future__ import unicode_literals
4+
5+
from django.db import migrations
6+
import sentry.db.models.fields.bounded
7+
8+
9+
class Migration(migrations.Migration):
10+
# This flag is used to mark that a migration shouldn't be automatically run in
11+
# production. We set this to True for operations that we think are risky and want
12+
# someone from ops to run manually and monitor.
13+
# General advice is that if in doubt, mark your migration as `is_dangerous`.
14+
# Some things you should always mark as dangerous:
15+
# - Large data migrations. Typically we want these to be run manually by ops so that
16+
# they can be monitored. Since data migrations will now hold a transaction open
17+
# this is even more important.
18+
# - Adding columns to highly active tables, even ones that are NULL.
19+
is_dangerous = False
20+
21+
# This flag is used to decide whether to run this migration in a transaction or not.
22+
# By default we prefer to run in a transaction, but for migrations where you want
23+
# to `CREATE INDEX CONCURRENTLY` this needs to be set to False. Typically you'll
24+
# want to create an index concurrently when adding one to an existing table.
25+
atomic = True
26+
27+
28+
dependencies = [
29+
('sentry', '0142_add_dashboard_tombstone'),
30+
]
31+
32+
operations = [
33+
migrations.AlterField(
34+
model_name='integrationfeature',
35+
name='feature',
36+
field=sentry.db.models.fields.bounded.BoundedPositiveIntegerField(choices=[(0, 'integrations-api'), (1, 'integrations-issue-link'), (2, 'integrations-stacktrace-link'), (3, 'integrations-event-hooks'), (4, 'integrations-project-management'), (5, 'integrations-incident-management'), (6, 'integrations-feature-flag'), (7, 'integrations-alerts')], default=0),
37+
),
38+
]

src/sentry/models/integrationfeature.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ class Feature(object):
1414
PROJECT_MANAGEMENT = 4
1515
INCIDENT_MANAGEMENT = 5
1616
FEATURE_FLAG = 6
17+
ALERTS = 7
1718

1819
@classmethod
1920
def as_choices(cls):
@@ -25,6 +26,7 @@ def as_choices(cls):
2526
(cls.PROJECT_MANAGEMENT, u"integrations-project-management"),
2627
(cls.INCIDENT_MANAGEMENT, u"integrations-incident-management"),
2728
(cls.FEATURE_FLAG, u"integrations-feature-flag"),
29+
(cls.ALERTS, u"integrations-alerts"),
2830
)
2931

3032
@classmethod
@@ -41,6 +43,8 @@ def as_str(cls, feature):
4143
return "integrations-incident-management"
4244
if feature == cls.FEATURE_FLAG:
4345
return "integrations-feature-flag"
46+
if feature == cls.ALERTS:
47+
return "integrations-alerts"
4448
return "integrations-api"
4549

4650
@classmethod
@@ -57,6 +61,8 @@ def description(cls, feature, name):
5761
return "Organizations can **open a line to Sentry's stack trace** in another service."
5862
if feature == cls.EVENT_HOOKS:
5963
return "%s allows organizations to **forward events to another service**." % name
64+
if feature == cls.ALERTS:
65+
return "Configure Sentry alerts to trigger notifications in %s." % name
6066
# default
6167
return (
6268
"%s can **utilize the Sentry API** to pull data or update resources in Sentry (with permissions granted, of course)."

0 commit comments

Comments
 (0)