Skip to content

Commit a5ff039

Browse files
author
David Wang
authored
feat(uptime): Add uptime option to wizard (#77799)
<img width="1080" alt="image" src="https://github.com/user-attachments/assets/793ea578-3015-4a7c-8341-9bccb09d729c"> Maybe marketing/design can help us get a nice graphic in, and some better copy
1 parent d160151 commit a5ff039

File tree

4 files changed

+45
-3
lines changed

4 files changed

+45
-3
lines changed

static/app/views/alerts/wizard/index.spec.tsx

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,4 +103,30 @@ describe('AlertWizard', () => {
103103
const alertGroups = screen.getAllByRole('radiogroup');
104104
expect(alertGroups.length).toEqual(1);
105105
});
106+
107+
it('shows uptime alert according to feature flag', () => {
108+
const {organization, project, routerProps, router} = initializeOrg({
109+
organization: {
110+
features: [
111+
'alert-crash-free-metrics',
112+
'incidents',
113+
'performance-view',
114+
'crash-rate-alerts',
115+
'uptime-api-create-update',
116+
],
117+
access: ['org:write', 'alerts:write'],
118+
},
119+
});
120+
121+
render(
122+
<AlertWizard
123+
organization={organization}
124+
projectId={project.slug}
125+
{...routerProps}
126+
/>,
127+
{router, organization}
128+
);
129+
130+
expect(screen.getByText('Uptime Monitor')).toBeInTheDocument();
131+
});
106132
});

static/app/views/alerts/wizard/index.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,11 @@ function AlertWizard({organization, params, location, projectId}: AlertWizardPro
116116
priority="primary"
117117
to={{
118118
pathname: `/organizations/${organization.slug}/alerts/new/${
119-
isMetricAlert ? AlertRuleType.METRIC : AlertRuleType.ISSUE
119+
isMetricAlert
120+
? AlertRuleType.METRIC
121+
: alertOption === 'uptime_monitor'
122+
? AlertRuleType.UPTIME
123+
: AlertRuleType.ISSUE
120124
}/`,
121125
query: {
122126
...(metricRuleTemplate ? metricRuleTemplate : {}),

static/app/views/alerts/wizard/options.tsx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ export type AlertType =
4646
| 'custom_metrics'
4747
| 'llm_tokens'
4848
| 'llm_cost'
49-
| 'insights_metrics';
49+
| 'insights_metrics'
50+
| 'uptime_monitor';
5051

5152
export enum MEPAlertsQueryType {
5253
ERROR = 0,
@@ -60,7 +61,7 @@ export enum MEPAlertsDataset {
6061
METRICS_ENHANCED = 'metricsEnhanced',
6162
}
6263

63-
export type MetricAlertType = Exclude<AlertType, 'issues'>;
64+
export type MetricAlertType = Exclude<AlertType, 'issues' | 'uptime_monitor'>;
6465

6566
export const DatasetMEPAlertQueryTypes: Record<
6667
Exclude<Dataset, 'search_issues' | Dataset.SESSIONS>, // IssuePlatform (search_issues) is not used in alerts, so we can exclude it here
@@ -90,6 +91,7 @@ export const AlertWizardAlertNames: Record<AlertType, string> = {
9091
llm_cost: t('LLM cost'),
9192
llm_tokens: t('LLM token usage'),
9293
insights_metrics: t('Insights Metric'),
94+
uptime_monitor: t('Uptime Monitor'),
9395
};
9496

9597
type AlertWizardCategory = {
@@ -131,6 +133,12 @@ export const getAlertWizardCategories = (org: Organization) => {
131133
options: ['llm_tokens', 'llm_cost'],
132134
});
133135
}
136+
if (org.features.includes('uptime-api-create-update')) {
137+
result.push({
138+
categoryHeading: t('Uptime'),
139+
options: ['uptime_monitor'],
140+
});
141+
}
134142
result.push({
135143
categoryHeading: hasCustomMetrics(org) ? t('Metrics') : t('Custom'),
136144
options: [hasCustomMetrics(org) ? 'custom_metrics' : 'custom_transactions'],

static/app/views/alerts/wizard/panelContent.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,4 +182,8 @@ export const AlertWizardPanelContent: Record<AlertType, PanelContent> = {
182182
],
183183
illustration: diagramCrashFreeUsers,
184184
},
185+
uptime_monitor: {
186+
description: t('Monitor the availability and reliability of your web services.'),
187+
examples: [t('When a URL is detected to be down, create an issue.')],
188+
},
185189
};

0 commit comments

Comments
 (0)