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

feat(ui): Add new session category to the alert wizard #28590

Merged
merged 22 commits into from
Sep 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
e59c8d2
feat(ui): Add new session category to the alert wizard
matejminar Sep 14, 2021
baef20b
rename alertWizardCategories, refactor away splice
matejminar Sep 16, 2021
c4a6b84
Merge branch 'master' into feat/session-alert-categories
matejminar Sep 16, 2021
0eec9a3
ref: rename Styledh2 to CategoryTitle
matejminar Sep 17, 2021
2598523
Apply suggestions from code review
matejminar Sep 17, 2021
848068d
fix: Type error (#28628)
loewenheim Sep 16, 2021
63b86a3
feat(symbolication): Add symbolication status to project details (NAT…
Sep 16, 2021
733d1a4
feat: Add option for low priority metrics submission rate [NATIVE-185…
loewenheim Sep 16, 2021
bb78b7a
chore(performance): Remove legacy key transactions endpoint (#28383)
Zylphrex Sep 16, 2021
6b014b3
feat(chart-unfurl): Add multi y-axis for chart unfurl (#28604)
shruthilayaj Sep 16, 2021
8eedb13
feat(growth): Add default business for all experiment (#28633)
Neo-Zhixing Sep 16, 2021
3abfcb1
fix(semver): Fix autocomplete tag functionality to use string prefixe…
wedamija Sep 16, 2021
7a4f048
ref(ui): Add performance event view hook (#28572)
k-fish Sep 16, 2021
f5f70af
audit log related stuff for project quotas (#28620)
maxiuyuan Sep 16, 2021
c003e27
chore: upgrade grpcio (#28623)
joshuarli Sep 16, 2021
0fd46fd
fix(deletions) Handle organizations with orphaned commits (#28636)
markstory Sep 16, 2021
805894e
ref(deletion) Consolidate group deletion and improve logging (#28475)
markstory Sep 16, 2021
1362c70
ref(select): Choices -> options AppStoreConnect (#28616)
davidenwang Sep 16, 2021
d0699c7
feat(alert-rule): Created an alert rule mediator (#28639)
AniketDas-Tekky Sep 16, 2021
f540453
ref(teams): Update teamSelect to use useTeams hook (#28615)
evanpurkhiser Sep 16, 2021
a9f32e9
feat(store): Projects util now updates render-props projects when sto…
davidenwang Sep 16, 2021
d4d29a3
Merge branch 'master' into feat/session-alert-categories
matejminar Sep 17, 2021
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
34 changes: 18 additions & 16 deletions static/app/views/alerts/wizard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ import {Dataset} from 'app/views/alerts/incidentRules/types';
import {
AlertType,
AlertWizardAlertNames,
AlertWizardOptions,
AlertWizardPanelContent,
AlertWizardRuleTemplates,
getAlertWizardCategories,
} from './options';
import RadioPanelGroup from './radioPanelGroup';

Expand Down Expand Up @@ -179,20 +179,22 @@ class AlertWizard extends Component<Props, State> {
<Layout.Main fullWidth>
<WizardBody>
<WizardOptions>
<Styledh2>{t('Errors')}</Styledh2>
{AlertWizardOptions.map(({categoryHeading, options}, i) => (
<OptionsWrapper key={categoryHeading}>
{i > 0 && <Styledh2>{categoryHeading}</Styledh2>}
<RadioPanelGroup
choices={options.map(alertType => {
return [alertType, AlertWizardAlertNames[alertType]];
})}
onChange={this.handleChangeAlertOption}
value={alertOption}
label="alert-option"
/>
</OptionsWrapper>
))}
<CategoryTitle>{t('Errors')}</CategoryTitle>
{getAlertWizardCategories(organization).map(
({categoryHeading, options}, i) => (
<OptionsWrapper key={categoryHeading}>
{i > 0 && <CategoryTitle>{categoryHeading}</CategoryTitle>}
<RadioPanelGroup
choices={options.map(alertType => {
return [alertType, AlertWizardAlertNames[alertType]];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: should this const have the first letter lower case?

Suggested change
return [alertType, AlertWizardAlertNames[alertType]];
return [alertType, alertWizardAlertNames[alertType]];

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there are lots of constants like this in that file, I didn't want to go on a refactoring spree because this PR would get messy

})}
onChange={this.handleChangeAlertOption}
value={alertOption}
label="alert-option"
/>
</OptionsWrapper>
)
)}
</WizardOptions>
<WizardPanel visible={!!panelContent && !!alertOption}>
<WizardPanelBody>
Expand Down Expand Up @@ -235,7 +237,7 @@ const StyledHeaderContent = styled(Layout.HeaderContent)`
overflow: visible;
`;

const Styledh2 = styled('h2')`
const CategoryTitle = styled('h2')`
font-weight: normal;
font-size: ${p => p.theme.fontSizeExtraLarge};
margin-bottom: ${space(1)} !important;
Expand Down
43 changes: 37 additions & 6 deletions static/app/views/alerts/wizard/options.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import diagramApdex from 'sentry-images/spot/alerts-wizard-apdex.svg';
import diagramCLS from 'sentry-images/spot/alerts-wizard-cls.svg';
import diagramCrashFreeSessions from 'sentry-images/spot/alerts-wizard-crash-free-sessions.svg';
import diagramCrashFreeUsers from 'sentry-images/spot/alerts-wizard-crash-free-users.svg';
import diagramCustom from 'sentry-images/spot/alerts-wizard-custom.svg';
import diagramErrors from 'sentry-images/spot/alerts-wizard-errors.svg';
import diagramFailureRate from 'sentry-images/spot/alerts-wizard-failure-rate.svg';
Expand All @@ -11,6 +13,7 @@ import diagramTransactionDuration from 'sentry-images/spot/alerts-wizard-transac
import diagramUsers from 'sentry-images/spot/alerts-wizard-users-experiencing-errors.svg';

import {t} from 'app/locale';
import {Organization} from 'app/types';
import {Dataset, EventTypes} from 'app/views/alerts/incidentRules/types';

export type AlertType =
Expand All @@ -24,7 +27,9 @@ export type AlertType =
| 'lcp'
| 'fid'
| 'cls'
| 'custom';
| 'custom'
| 'crash_free_sessions'
| 'crash_free_users';

export const WebVitalAlertTypes = new Set(['lcp', 'fid', 'cls', 'fcp']);

Expand All @@ -40,16 +45,24 @@ export const AlertWizardAlertNames: Record<AlertType, string> = {
fid: t('First Input Delay'),
cls: t('Cumulative Layout Shift'),
custom: t('Custom Metric'),
crash_free_sessions: t('Crash Free Session Rate'),
crash_free_users: t('Crash Free User Rate'),
};

export const AlertWizardOptions: {
categoryHeading: string;
options: AlertType[];
}[] = [
type AlertWizardCategory = {categoryHeading: string; options: AlertType[]};
export const getAlertWizardCategories = (org: Organization): AlertWizardCategory[] => [
{
categoryHeading: t('Errors'),
options: ['issues', 'num_errors', 'users_experiencing_errors'],
},
...(org.features.includes('crash-rate-alerts')
? [
{
categoryHeading: t('Sessions'),
options: ['crash_free_sessions', 'crash_free_users'] as AlertType[],
},
]
: []),
{
categoryHeading: t('Performance'),
options: [
Expand Down Expand Up @@ -181,6 +194,24 @@ export const AlertWizardPanelContent: Record<AlertType, PanelContent> = {
],
illustration: diagramCustom,
},
crash_free_sessions: {
description: t(
'A session begins when a user starts the application and ends when it’s closed or sent to the background. A crash is when a session ends due to an error and this type of alert lets you monitor when those crashed sessions exceed a threshold. This lets you get a better picture of the health of your app.'
),
examples: [
t('When the Crash Free Rate is below 98%, send a Slack notification to the team.'),
],
illustration: diagramCrashFreeSessions,
},
crash_free_users: {
description: t(
'Crash Free Users is the percentage of distinct users that haven’t experienced a crash and so this type of alert tells you when the overall user experience dips below a certain unacceptable threshold.'
),
examples: [
t('When the Crash Free Rate is below 97%, send an email notification to yourself.'),
],
illustration: diagramCrashFreeUsers,
},
};

export type WizardRuleTemplate = {
Expand All @@ -190,7 +221,7 @@ export type WizardRuleTemplate = {
};

export const AlertWizardRuleTemplates: Record<
Exclude<AlertType, 'issues'>,
Exclude<AlertType, 'issues' | 'crash_free_sessions' | 'crash_free_users'>,
WizardRuleTemplate
> = {
num_errors: {
Expand Down
Loading