options.tsx 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261
  1. import diagramApdex from 'sentry-images/spot/alerts-wizard-apdex.svg';
  2. import diagramCLS from 'sentry-images/spot/alerts-wizard-cls.svg';
  3. import diagramCustom from 'sentry-images/spot/alerts-wizard-custom.svg';
  4. import diagramErrors from 'sentry-images/spot/alerts-wizard-errors.svg';
  5. import diagramFailureRate from 'sentry-images/spot/alerts-wizard-failure-rate.svg';
  6. import diagramFID from 'sentry-images/spot/alerts-wizard-fid.svg';
  7. import diagramIssues from 'sentry-images/spot/alerts-wizard-issues.svg';
  8. import diagramLCP from 'sentry-images/spot/alerts-wizard-lcp.svg';
  9. import diagramThroughput from 'sentry-images/spot/alerts-wizard-throughput.svg';
  10. import diagramTransactionDuration from 'sentry-images/spot/alerts-wizard-transaction-duration.svg';
  11. import diagramUsers from 'sentry-images/spot/alerts-wizard-users-experiencing-errors.svg';
  12. import {t} from 'app/locale';
  13. import {Dataset, EventTypes} from 'app/views/settings/incidentRules/types';
  14. export type AlertType =
  15. | 'issues'
  16. | 'num_errors'
  17. | 'users_experiencing_errors'
  18. | 'throughput'
  19. | 'trans_duration'
  20. | 'apdex'
  21. | 'failure_rate'
  22. | 'lcp'
  23. | 'fid'
  24. | 'cls'
  25. | 'fcp'
  26. | 'custom';
  27. export const WebVitalAlertTypes = new Set(['lcp', 'fid', 'cls', 'fcp']);
  28. export const AlertWizardAlertNames: Record<AlertType, string> = {
  29. issues: t('Issues'),
  30. num_errors: t('Number of Errors'),
  31. users_experiencing_errors: t('Users Experiencing Errors'),
  32. throughput: t('Throughput'),
  33. trans_duration: t('Transaction Duration'),
  34. apdex: t('Apdex'),
  35. failure_rate: t('Failure Rate'),
  36. lcp: t('Largest Contentful Paint'),
  37. fid: t('First Input Delay'),
  38. cls: t('Cumulative Layout Shift'),
  39. fcp: t('First Contentful Paint'),
  40. custom: t('Custom Metric'),
  41. };
  42. export const AlertWizardOptions: {
  43. categoryHeading: string;
  44. options: AlertType[];
  45. }[] = [
  46. {
  47. categoryHeading: t('Errors'),
  48. options: ['issues', 'num_errors', 'users_experiencing_errors'],
  49. },
  50. {
  51. categoryHeading: t('Performance'),
  52. options: [
  53. 'throughput',
  54. 'trans_duration',
  55. 'apdex',
  56. 'failure_rate',
  57. 'lcp',
  58. 'fid',
  59. 'cls',
  60. 'fcp',
  61. ],
  62. },
  63. {
  64. categoryHeading: t('Other'),
  65. options: ['custom'],
  66. },
  67. ];
  68. type PanelContent = {
  69. description: string;
  70. docsLink?: string;
  71. examples: string[];
  72. illustration?: string;
  73. };
  74. export const AlertWizardPanelContent: Record<AlertType, PanelContent> = {
  75. issues: {
  76. description: t(
  77. 'Issues are groups of errors that have a similar stacktrace. Set an alert for new issues, when an issue changes state, frequency of errors, or users affected by an issue.'
  78. ),
  79. examples: [
  80. t("When the triggering event's level is fatal."),
  81. t('When an issue was seen 100 times in the last 2 days.'),
  82. t(
  83. 'Create a JIRA ticket when an issue changes state from resolved to unresolved and is unassigned.'
  84. ),
  85. ],
  86. illustration: diagramIssues,
  87. },
  88. num_errors: {
  89. description: t(
  90. 'Alert when the number of errors in a project matching your filters crosses a threshold. This is useful for monitoring the overall level or errors in your project or errors occurring in specific parts of your app.'
  91. ),
  92. examples: [
  93. t('When the signup page has more than 10k errors in 5 minutes.'),
  94. t('When there are more than 500k errors in 10 minutes from a specific file.'),
  95. ],
  96. illustration: diagramErrors,
  97. },
  98. users_experiencing_errors: {
  99. description: t(
  100. 'Alert when the number of users affected by errors in your project crosses a threshold.'
  101. ),
  102. examples: [
  103. t('When 100k users experience an error in 1 hour.'),
  104. t('When 100 users experience a problem on the Checkout page.'),
  105. ],
  106. illustration: diagramUsers,
  107. },
  108. throughput: {
  109. description: t(
  110. 'Throughput is the total number of transactions in a project and you can alert when it reaches a threshold within a period of time.'
  111. ),
  112. examples: [
  113. t('When number of transactions on a key page exceeds 100k per minute.'),
  114. t('When number of transactions drops below a threshold.'),
  115. ],
  116. illustration: diagramThroughput,
  117. },
  118. trans_duration: {
  119. description: t(
  120. 'Monitor how long it takes for transactions to complete. Use flexible aggregates like percentiles, averages, and min/max.'
  121. ),
  122. examples: [
  123. t('When any transaction is slower than 3 seconds.'),
  124. t('When the 75th percentile response time is higher than 250 milliseconds.'),
  125. ],
  126. illustration: diagramTransactionDuration,
  127. },
  128. apdex: {
  129. description: t(
  130. 'Apdex is a metric used to track and measure user satisfaction based on your application response times. The Apdex score provides the ratio of satisfactory, tolerable, and frustrated requests in a specific transaction or endpoint.'
  131. ),
  132. examples: [t('When apdex is below 300.')],
  133. docsLink: 'https://docs.sentry.io/product/performance/metrics/#apdex',
  134. illustration: diagramApdex,
  135. },
  136. failure_rate: {
  137. description: t(
  138. 'Failure rate is the percentage of unsuccessful transactions. Sentry treats transactions with a status other than “ok,” “canceled,” and “unknown” as failures.'
  139. ),
  140. examples: [t('When the failure rate for an important endpoint reaches 10%.')],
  141. docsLink: 'https://docs.sentry.io/product/performance/metrics/#failure-rate',
  142. illustration: diagramFailureRate,
  143. },
  144. lcp: {
  145. description: t(
  146. 'Largest Contentful Paint (LCP) measures loading performance. It marks the point when the largest image or text block is visible within the viewport. A fast LCP helps reassure the user that the page is useful, and so we recommend an LCP of less than 2.5 seconds.'
  147. ),
  148. examples: [
  149. t('When the 75th percentile LCP of your homepage is longer than 2.5 seconds.'),
  150. ],
  151. docsLink: 'https://docs.sentry.io/product/performance/web-vitals',
  152. illustration: diagramLCP,
  153. },
  154. fid: {
  155. description: t(
  156. 'First Input Delay (FID) measures interactivity as the response time when the user tries to interact with the viewport. A low FID helps ensure that a page is useful, and we recommend a FID of less than 100 milliseconds.'
  157. ),
  158. examples: [t('When the average FID of a page is longer than 4 seconds.')],
  159. docsLink: 'https://docs.sentry.io/product/performance/web-vitals',
  160. illustration: diagramFID,
  161. },
  162. cls: {
  163. description: t(
  164. 'Cumulative Layout Shift (CLS) measures visual stability by quantifying unexpected layout shifts that occur during the entire lifespan of the page. A CLS of less than 0.1 is a good user experience, while anything greater than 0.25 is poor.'
  165. ),
  166. examples: [t('When the CLS of a page is more than 0.5.')],
  167. docsLink: 'https://docs.sentry.io/product/performance/web-vitals',
  168. illustration: diagramCLS,
  169. },
  170. fcp: {
  171. description: t(
  172. 'First Contentful Paint (FCP), like Largest Contentful Paint (LCP), measures loading performance. It marks the point when content such as text and images can first be seen on a page.'
  173. ),
  174. examples: [t('When the average FCP of a page is longer than 0.25 seconds.')],
  175. docsLink: 'https://docs.sentry.io/product/performance/web-vitals',
  176. },
  177. custom: {
  178. description: t(
  179. 'Alert on metrics which are not listed above, such as first paint (FP) and time to first byte (TTFB).'
  180. ),
  181. examples: [
  182. t('When the 95th percentile FP of a page is longer than 250 milliseconds.'),
  183. t('When the average TTFB of a page is longer than 600 millliseconds.'),
  184. ],
  185. illustration: diagramCustom,
  186. },
  187. };
  188. export type WizardRuleTemplate = {
  189. aggregate: string;
  190. dataset: Dataset;
  191. eventTypes: EventTypes;
  192. };
  193. export const AlertWizardRuleTemplates: Record<
  194. Exclude<AlertType, 'issues'>,
  195. WizardRuleTemplate
  196. > = {
  197. num_errors: {
  198. aggregate: 'count()',
  199. dataset: Dataset.ERRORS,
  200. eventTypes: EventTypes.ERROR,
  201. },
  202. users_experiencing_errors: {
  203. aggregate: 'count_unique(tags[sentry:user])',
  204. dataset: Dataset.ERRORS,
  205. eventTypes: EventTypes.ERROR,
  206. },
  207. throughput: {
  208. aggregate: 'count()',
  209. dataset: Dataset.TRANSACTIONS,
  210. eventTypes: EventTypes.TRANSACTION,
  211. },
  212. trans_duration: {
  213. aggregate: 'p95(transaction.duration)',
  214. dataset: Dataset.TRANSACTIONS,
  215. eventTypes: EventTypes.TRANSACTION,
  216. },
  217. apdex: {
  218. aggregate: 'apdex(300)',
  219. dataset: Dataset.TRANSACTIONS,
  220. eventTypes: EventTypes.TRANSACTION,
  221. },
  222. failure_rate: {
  223. aggregate: 'failure_rate()',
  224. dataset: Dataset.TRANSACTIONS,
  225. eventTypes: EventTypes.TRANSACTION,
  226. },
  227. lcp: {
  228. aggregate: 'p95(measurements.lcp)',
  229. dataset: Dataset.TRANSACTIONS,
  230. eventTypes: EventTypes.TRANSACTION,
  231. },
  232. fid: {
  233. aggregate: 'p95(measurements.fid)',
  234. dataset: Dataset.TRANSACTIONS,
  235. eventTypes: EventTypes.TRANSACTION,
  236. },
  237. cls: {
  238. aggregate: 'p95(measurements.cls)',
  239. dataset: Dataset.TRANSACTIONS,
  240. eventTypes: EventTypes.TRANSACTION,
  241. },
  242. fcp: {
  243. aggregate: 'p95(measurements.fcp)',
  244. dataset: Dataset.TRANSACTIONS,
  245. eventTypes: EventTypes.TRANSACTION,
  246. },
  247. custom: {
  248. aggregate: 'p95(measurements.fp)',
  249. dataset: Dataset.TRANSACTIONS,
  250. eventTypes: EventTypes.TRANSACTION,
  251. },
  252. };