projectAlertRuleConfiguration.js 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278
  1. export function ProjectAlertRuleConfiguration(params = {}) {
  2. return {
  3. actions: [
  4. {
  5. id: 'sentry.mail.actions.NotifyEmailAction',
  6. label: 'Send a notification to {targetType}',
  7. enabled: true,
  8. prompt: 'Send a notification',
  9. formFields: {
  10. targetType: {
  11. type: 'mailAction',
  12. choices: [
  13. ['IssueOwners', 'Issue Owners'],
  14. ['Team', 'Team'],
  15. ['Member', 'Member'],
  16. ],
  17. },
  18. },
  19. },
  20. {
  21. id: 'sentry.rules.actions.notify_event.NotifyEventAction',
  22. label: 'Send a notification (for all legacy integrations)',
  23. enabled: true,
  24. prompt: 'Send a notification to all legacy integrations',
  25. },
  26. {
  27. id: 'sentry.integrations.slack.notify_action.SlackNotifyServiceAction',
  28. label:
  29. 'Send a notification to the {workspace} Slack workspace to {channel} (optionally, an ID: {channel_id}) and show tags {tags} in notification',
  30. enabled: true,
  31. prompt: 'Send a Slack notification',
  32. formFields: {
  33. workspace: {type: 'choice', choices: [[123, 'Sentry']]},
  34. channel: {type: 'string', placeholder: 'i.e #critical, Jane Schmidt'},
  35. channel_id: {type: 'string', placeholder: 'i.e. CA2FRA079 or UA1J9RTE1'},
  36. tags: {type: 'string', placeholder: 'i.e environment,user,my_tag'},
  37. },
  38. },
  39. {
  40. id: 'sentry.integrations.pagerduty.notify_action.PagerDutyNotifyServiceAction',
  41. label: 'Send a notification to PagerDuty account {account} and service {service}',
  42. enabled: true,
  43. prompt: 'Send a PagerDuty notification',
  44. formFields: {
  45. account: {type: 'choice', choices: []},
  46. service: {type: 'choice', choices: []},
  47. },
  48. },
  49. ],
  50. conditions: [
  51. {
  52. id: 'sentry.rules.conditions.every_event.EveryEventCondition',
  53. label: 'The event occurs',
  54. enabled: false,
  55. },
  56. {
  57. id: 'sentry.rules.conditions.first_seen_event.FirstSeenEventCondition',
  58. label: 'A new issue is created',
  59. enabled: true,
  60. },
  61. {
  62. id: 'sentry.rules.conditions.regression_event.RegressionEventCondition',
  63. label: 'The issue changes state from resolved to unresolved',
  64. enabled: true,
  65. },
  66. {
  67. id: 'sentry.rules.conditions.reappeared_event.ReappearedEventCondition',
  68. label: 'The issue changes state from ignored to unresolved',
  69. enabled: true,
  70. },
  71. {
  72. id: 'sentry.rules.conditions.event_frequency.EventFrequencyCondition',
  73. label: 'The issue is seen more than {value} times in {interval}',
  74. enabled: true,
  75. formFields: {
  76. value: {type: 'number', placeholder: 100},
  77. interval: {
  78. type: 'choice',
  79. choices: [
  80. ['1m', 'one minute'],
  81. ['5m', '5 minutes'],
  82. ['15m', '15 minutes'],
  83. ['1h', 'one hour'],
  84. ['1d', 'one day'],
  85. ['1w', 'one week'],
  86. ['30d', '30 days'],
  87. ],
  88. },
  89. },
  90. },
  91. {
  92. id: 'sentry.rules.conditions.event_frequency.EventUniqueUserFrequencyCondition',
  93. label: 'The issue is seen by more than {value} users in {interval}',
  94. enabled: true,
  95. formFields: {
  96. value: {type: 'number', placeholder: 100},
  97. interval: {
  98. type: 'choice',
  99. choices: [
  100. ['1m', 'one minute'],
  101. ['5m', '5 minutes'],
  102. ['15m', '15 minutes'],
  103. ['1h', 'one hour'],
  104. ['1d', 'one day'],
  105. ['1w', 'one week'],
  106. ['30d', '30 days'],
  107. ],
  108. },
  109. },
  110. },
  111. {
  112. id: 'sentry.rules.conditions.event_frequency.EventFrequencyPercentCondition',
  113. label: 'The issue affects more than {value} percent of sessions in {interval}',
  114. enabled: true,
  115. formFields: {
  116. value: {type: 'number', placeholder: 100},
  117. interval: {
  118. type: 'choice',
  119. choices: [
  120. ['5m', '5 minutes'],
  121. ['10m', '10 minutes'],
  122. ['30m', '30 minutes'],
  123. ['1h', '1 hour'],
  124. ],
  125. },
  126. },
  127. },
  128. ],
  129. filters: [
  130. {
  131. id: 'sentry.rules.filters.age_comparison.AgeComparisonFilter',
  132. label: 'The issue is {comparison_type} than {value} {time}',
  133. enabled: true,
  134. prompt: 'The issue is older or newer than...',
  135. formFields: {
  136. comparison_type: {
  137. type: 'choice',
  138. choices: [
  139. ['older', 'older'],
  140. ['newer', 'newer'],
  141. ],
  142. },
  143. value: {type: 'number', placeholder: 10},
  144. time: {
  145. type: 'choice',
  146. choices: [
  147. ['minute', 'minute(s)'],
  148. ['hour', 'hour(s)'],
  149. ['day', 'day(s)'],
  150. ['week', 'week(s)'],
  151. ],
  152. },
  153. },
  154. },
  155. {
  156. id: 'sentry.rules.filters.issue_occurrences.IssueOccurrencesFilter',
  157. label: 'The issue has happened at least {value} times',
  158. enabled: true,
  159. prompt: 'The issue has happened at least {x} times (Note: this is approximate)',
  160. formFields: {value: {type: 'number', placeholder: 10}},
  161. },
  162. {
  163. id: 'sentry.rules.filters.assigned_to.AssignedToFilter',
  164. label: 'The issue is assigned to {targetType}',
  165. enabled: true,
  166. prompt: 'The issue is assigned to {no one/team/member}',
  167. formFields: {
  168. targetType: {
  169. type: 'assignee',
  170. choices: [
  171. ['Unassigned', 'Unassigned'],
  172. ['Team', 'Team'],
  173. ['Member', 'Member'],
  174. ],
  175. },
  176. },
  177. },
  178. {
  179. id: 'sentry.rules.filters.event_attribute.EventAttributeFilter',
  180. label: "The event's {attribute} value {match} {value}",
  181. enabled: true,
  182. formFields: {
  183. attribute: {
  184. type: 'choice',
  185. placeholder: 'i.e. exception.type',
  186. choices: [
  187. ['message', 'message'],
  188. ['platform', 'platform'],
  189. ['environment', 'environment'],
  190. ['type', 'type'],
  191. ['exception.type', 'exception.type'],
  192. ['exception.value', 'exception.value'],
  193. ['user.id', 'user.id'],
  194. ['user.email', 'user.email'],
  195. ['user.username', 'user.username'],
  196. ['user.ip_address', 'user.ip_address'],
  197. ['http.method', 'http.method'],
  198. ['http.url', 'http.url'],
  199. ['sdk.name', 'sdk.name'],
  200. ['stacktrace.code', 'stacktrace.code'],
  201. ['stacktrace.module', 'stacktrace.module'],
  202. ['stacktrace.filename', 'stacktrace.filename'],
  203. ['stacktrace.abs_path', 'stacktrace.abs_path'],
  204. ['stacktrace.package', 'stacktrace.package'],
  205. ],
  206. },
  207. match: {
  208. type: 'choice',
  209. choices: [
  210. ['co', 'contains'],
  211. ['ew', 'ends with'],
  212. ['eq', 'equals'],
  213. ['is', 'is set'],
  214. ['nc', 'does not contain'],
  215. ['new', 'does not end with'],
  216. ['ne', 'does not equal'],
  217. ['ns', 'is not set'],
  218. ['nsw', 'does not start with'],
  219. ['sw', 'starts with'],
  220. ],
  221. },
  222. value: {type: 'string', placeholder: 'value'},
  223. },
  224. },
  225. {
  226. id: 'sentry.rules.filters.tagged_event.TaggedEventFilter',
  227. label: "The event's tags match {key} {match} {value}",
  228. enabled: true,
  229. formFields: {
  230. key: {type: 'string', placeholder: 'key'},
  231. match: {
  232. type: 'choice',
  233. choices: [
  234. ['co', 'contains'],
  235. ['ew', 'ends with'],
  236. ['eq', 'equals'],
  237. ['is', 'is set'],
  238. ['nc', 'does not contain'],
  239. ['new', 'does not end with'],
  240. ['ne', 'does not equal'],
  241. ['ns', 'is not set'],
  242. ['nsw', 'does not start with'],
  243. ['sw', 'starts with'],
  244. ],
  245. },
  246. value: {type: 'string', placeholder: 'value'},
  247. },
  248. },
  249. {
  250. id: 'sentry.rules.filters.level.LevelFilter',
  251. label: "The event's level is {match} {level}",
  252. enabled: true,
  253. formFields: {
  254. level: {
  255. type: 'choice',
  256. choices: [
  257. ['50', 'fatal'],
  258. ['40', 'error'],
  259. ['30', 'warning'],
  260. ['20', 'info'],
  261. ['10', 'debug'],
  262. ['0', 'sample'],
  263. ],
  264. },
  265. match: {
  266. type: 'choice',
  267. choices: [
  268. ['eq', 'equal to'],
  269. ['gte', 'greater than or equal to'],
  270. ['lte', 'less than or equal to'],
  271. ],
  272. },
  273. },
  274. },
  275. ],
  276. ...params,
  277. };
  278. }