Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix creating crash free session alerts #74750

Merged
merged 1 commit into from
Jul 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions static/app/views/alerts/wizard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,8 @@ function AlertWizard({organization, params, location, projectId}: AlertWizardPro
const isMetricAlert = !!metricRuleTemplate;
const isTransactionDataset = metricRuleTemplate?.dataset === Dataset.TRANSACTIONS;

if (
organization.features.includes('alert-crash-free-metrics') &&
metricRuleTemplate?.dataset === Dataset.SESSIONS
) {
// If theres anything using the legacy sessions dataset, we need to convert it to metrics
if (metricRuleTemplate?.dataset === Dataset.SESSIONS) {
metricRuleTemplate = {...metricRuleTemplate, dataset: Dataset.METRICS};
}

Expand Down
9 changes: 3 additions & 6 deletions static/app/views/alerts/wizard/options.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,13 @@ export enum MEPAlertsDataset {
export type MetricAlertType = Exclude<AlertType, 'issues'>;

export const DatasetMEPAlertQueryTypes: Record<
Exclude<Dataset, 'search_issues'>, // IssuePlatform (search_issues) is not used in alerts, so we can exclude it here
Exclude<Dataset, 'search_issues' | Dataset.SESSIONS>, // IssuePlatform (search_issues) is not used in alerts, so we can exclude it here
MEPAlertsQueryType
> = {
[Dataset.ERRORS]: MEPAlertsQueryType.ERROR,
[Dataset.TRANSACTIONS]: MEPAlertsQueryType.PERFORMANCE,
[Dataset.GENERIC_METRICS]: MEPAlertsQueryType.PERFORMANCE,
[Dataset.METRICS]: MEPAlertsQueryType.CRASH_RATE,
[Dataset.SESSIONS]: MEPAlertsQueryType.CRASH_RATE,
};

export const AlertWizardAlertNames: Record<AlertType, string> = {
Expand Down Expand Up @@ -227,14 +226,12 @@ export const AlertWizardRuleTemplates: Record<
},
crash_free_sessions: {
aggregate: SessionsAggregate.CRASH_FREE_SESSIONS,
// TODO(scttcper): Use Dataset.Metric on GA of alert-crash-free-metrics
dataset: Dataset.SESSIONS,
dataset: Dataset.METRICS,
eventTypes: EventTypes.SESSION,
},
crash_free_users: {
aggregate: SessionsAggregate.CRASH_FREE_USERS,
// TODO(scttcper): Use Dataset.Metric on GA of alert-crash-free-metrics
dataset: Dataset.SESSIONS,
dataset: Dataset.METRICS,
eventTypes: EventTypes.USER,
},
};
Expand Down
4 changes: 2 additions & 2 deletions static/app/views/alerts/wizard/utils.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ describe('Wizard utils', function () {
expect(
getAlertTypeFromAggregateDataset({
aggregate: SessionsAggregate.CRASH_FREE_SESSIONS,
dataset: Dataset.SESSIONS,
dataset: Dataset.METRICS,
})
).toEqual('crash_free_sessions');
});
Expand All @@ -84,7 +84,7 @@ describe('Wizard utils', function () {
expect(
getAlertTypeFromAggregateDataset({
aggregate: SessionsAggregate.CRASH_FREE_USERS,
dataset: Dataset.SESSIONS,
dataset: Dataset.METRICS,
})
).toEqual('crash_free_users');
});
Expand Down
Loading