123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312 |
- import type {IssueAlertConfiguration} from 'sentry/types/alerts';
- export function ProjectAlertRuleConfigurationFixture(
- params: Partial<IssueAlertConfiguration> = {}
- ): IssueAlertConfiguration {
- return {
- actions: [
- {
- id: 'sentry.mail.actions.NotifyEmailAction',
- label: 'Send a notification to {targetType}',
- enabled: true,
- prompt: 'Send a notification',
- formFields: {
- targetType: {
- type: 'choice',
- placeholder: 'mailAction',
- choices: [
- ['IssueOwners', 'Issue Owners'],
- ['Team', 'Team'],
- ['Member', 'Member'],
- ],
- },
- },
- },
- {
- id: 'sentry.rules.actions.notify_event.NotifyEventAction',
- label: 'Send a notification (for all legacy integrations)',
- enabled: true,
- prompt: 'Send a notification to all legacy integrations',
- },
- {
- id: 'sentry.integrations.slack.notify_action.SlackNotifyServiceAction',
- label:
- 'Send a notification to the {workspace} Slack workspace to {channel} (optionally, an ID: {channel_id}) and show tags {tags} in notification',
- enabled: true,
- prompt: 'Send a Slack notification',
- formFields: {
- workspace: {type: 'choice', choices: [['123', 'Sentry']]},
- channel: {type: 'string', placeholder: 'i.e #critical, Jane Schmidt'},
- channel_id: {type: 'string', placeholder: 'i.e. CA2FRA079 or UA1J9RTE1'},
- tags: {type: 'string', placeholder: 'i.e environment,user,my_tag'},
- },
- },
- {
- id: 'sentry.integrations.pagerduty.notify_action.PagerDutyNotifyServiceAction',
- label: 'Send a notification to PagerDuty account {account} and service {service}',
- enabled: true,
- prompt: 'Send a PagerDuty notification',
- formFields: {
- account: {type: 'choice', choices: []},
- service: {type: 'choice', choices: []},
- },
- },
- ],
- conditions: [
- {
- id: 'sentry.rules.conditions.every_event.EveryEventCondition',
- label: 'The event occurs',
- enabled: false,
- },
- {
- id: 'sentry.rules.conditions.first_seen_event.FirstSeenEventCondition',
- label: 'A new issue is created',
- enabled: true,
- },
- {
- id: 'sentry.rules.conditions.regression_event.RegressionEventCondition',
- label: 'The issue changes state from resolved to unresolved',
- enabled: true,
- },
- {
- id: 'sentry.rules.conditions.reappeared_event.ReappearedEventCondition',
- label: 'The issue changes state from ignored to unresolved',
- enabled: true,
- },
- {
- id: 'sentry.rules.conditions.event_frequency.EventFrequencyCondition',
- label: 'The issue is seen more than {value} times in {interval}',
- enabled: true,
- formFields: {
- value: {type: 'number', placeholder: 100},
- interval: {
- type: 'choice',
- choices: [
- ['1m', 'one minute'],
- ['5m', '5 minutes'],
- ['15m', '15 minutes'],
- ['1h', 'one hour'],
- ['1d', 'one day'],
- ['1w', 'one week'],
- ['30d', '30 days'],
- ],
- },
- },
- },
- {
- id: 'sentry.rules.conditions.event_frequency.EventUniqueUserFrequencyCondition',
- label: 'The issue is seen by more than {value} users in {interval}',
- enabled: true,
- formFields: {
- value: {type: 'number', placeholder: 100},
- interval: {
- type: 'choice',
- choices: [
- ['1m', 'one minute'],
- ['5m', '5 minutes'],
- ['15m', '15 minutes'],
- ['1h', 'one hour'],
- ['1d', 'one day'],
- ['1w', 'one week'],
- ['30d', '30 days'],
- ],
- },
- },
- },
- {
- id: 'sentry.rules.conditions.event_frequency.EventFrequencyPercentCondition',
- label: 'The issue affects more than {value} percent of sessions in {interval}',
- enabled: true,
- formFields: {
- value: {type: 'number', placeholder: 100},
- interval: {
- type: 'choice',
- choices: [
- ['5m', '5 minutes'],
- ['10m', '10 minutes'],
- ['30m', '30 minutes'],
- ['1h', '1 hour'],
- ],
- },
- },
- },
- ],
- filters: [
- {
- id: 'sentry.rules.filters.age_comparison.AgeComparisonFilter',
- label: 'The issue is {comparison_type} than {value} {time}',
- enabled: true,
- prompt: 'The issue is older or newer than...',
- formFields: {
- comparison_type: {
- type: 'choice',
- choices: [
- ['older', 'older'],
- ['newer', 'newer'],
- ],
- },
- value: {type: 'number', placeholder: 10},
- time: {
- type: 'choice',
- choices: [
- ['minute', 'minute(s)'],
- ['hour', 'hour(s)'],
- ['day', 'day(s)'],
- ['week', 'week(s)'],
- ],
- },
- },
- },
- {
- id: 'sentry.rules.filters.issue_occurrences.IssueOccurrencesFilter',
- label: 'The issue has happened at least {value} times',
- enabled: true,
- prompt: 'The issue has happened at least {x} times (Note: this is approximate)',
- formFields: {value: {type: 'number', placeholder: 10}},
- },
- {
- id: 'sentry.rules.filters.assigned_to.AssignedToFilter',
- label: 'The issue is assigned to {targetType}',
- enabled: true,
- prompt: 'The issue is assigned to {no one/team/member}',
- formFields: {
- targetType: {
- type: 'choice',
- placeholder: 'assignee',
- choices: [
- ['Unassigned', 'Unassigned'],
- ['Team', 'Team'],
- ['Member', 'Member'],
- ],
- },
- },
- },
- {
- id: 'sentry.rules.filters.latest_adopted_release_filter.LatestAdoptedReleaseFilter',
- label:
- "The {oldest_or_newest} adopted release associated with the event's issue is {older_or_newer} than the latest adopted release in {environment}",
- enabled: true,
- formFields: {
- oldest_or_newest: {
- type: 'choice',
- choices: [
- ['oldest', 'oldest'],
- ['newest', 'newest'],
- ],
- },
- older_or_newer: {
- type: 'choice',
- choices: [
- ['older', 'older'],
- ['newer', 'newer'],
- ],
- },
- environment: {
- type: 'string',
- placeholder: 'value',
- },
- },
- },
- {
- id: 'sentry.rules.filters.event_attribute.EventAttributeFilter',
- label: "The event's {attribute} value {match} {value}",
- enabled: true,
- formFields: {
- attribute: {
- type: 'choice',
- placeholder: 'i.e. exception.type',
- choices: [
- ['message', 'message'],
- ['platform', 'platform'],
- ['environment', 'environment'],
- ['type', 'type'],
- ['exception.type', 'exception.type'],
- ['exception.value', 'exception.value'],
- ['user.id', 'user.id'],
- ['user.email', 'user.email'],
- ['user.username', 'user.username'],
- ['user.ip_address', 'user.ip_address'],
- ['http.method', 'http.method'],
- ['http.url', 'http.url'],
- ['sdk.name', 'sdk.name'],
- ['stacktrace.code', 'stacktrace.code'],
- ['stacktrace.module', 'stacktrace.module'],
- ['stacktrace.filename', 'stacktrace.filename'],
- ['stacktrace.abs_path', 'stacktrace.abs_path'],
- ['stacktrace.package', 'stacktrace.package'],
- ],
- },
- match: {
- type: 'choice',
- choices: [
- ['co', 'contains'],
- ['ew', 'ends with'],
- ['eq', 'equals'],
- ['is', 'is set'],
- ['nc', 'does not contain'],
- ['new', 'does not end with'],
- ['ne', 'does not equal'],
- ['ns', 'is not set'],
- ['nsw', 'does not start with'],
- ['sw', 'starts with'],
- ['in', 'is in (comma separated)'],
- ],
- },
- value: {type: 'string', placeholder: 'value'},
- },
- },
- {
- id: 'sentry.rules.filters.tagged_event.TaggedEventFilter',
- label: "The event's tags match {key} {match} {value}",
- enabled: true,
- formFields: {
- key: {type: 'string', placeholder: 'key'},
- match: {
- type: 'choice',
- choices: [
- ['co', 'contains'],
- ['ew', 'ends with'],
- ['eq', 'equals'],
- ['is', 'is set'],
- ['nc', 'does not contain'],
- ['new', 'does not end with'],
- ['ne', 'does not equal'],
- ['ns', 'is not set'],
- ['nsw', 'does not start with'],
- ['sw', 'starts with'],
- ['in', 'is in (comma separated)'],
- ],
- },
- value: {type: 'string', placeholder: 'value'},
- },
- },
- {
- id: 'sentry.rules.filters.level.LevelFilter',
- label: "The event's level is {match} {level}",
- enabled: true,
- formFields: {
- level: {
- type: 'choice',
- choices: [
- ['50', 'fatal'],
- ['40', 'error'],
- ['30', 'warning'],
- ['20', 'info'],
- ['10', 'debug'],
- ['0', 'sample'],
- ],
- },
- match: {
- type: 'choice',
- choices: [
- ['eq', 'equal to'],
- ['gte', 'greater than or equal to'],
- ['lte', 'less than or equal to'],
- ],
- },
- },
- },
- ],
- ...params,
- };
- }
|