projectIssueGrouping.tsx 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. import {Fragment} from 'react';
  2. import styled from '@emotion/styled';
  3. import type {Field} from 'sentry/components/forms/types';
  4. import ExternalLink from 'sentry/components/links/externalLink';
  5. import {t, tct} from 'sentry/locale';
  6. import {space} from 'sentry/styles/space';
  7. // Export route to make these forms searchable by label/help
  8. export const route = '/settings/:orgId/projects/:projectId/issue-grouping/';
  9. export const fields: Record<string, Field> = {
  10. fingerprintingRules: {
  11. name: 'fingerprintingRules',
  12. type: 'string',
  13. label: t('Fingerprint Rules'),
  14. hideLabel: true,
  15. placeholder: t(
  16. 'error.type:MyException -> fingerprint-value\nstack.function:some_panic_function -> fingerprint-value'
  17. ),
  18. multiline: true,
  19. monospace: true,
  20. autosize: true,
  21. inline: false,
  22. maxRows: 20,
  23. saveOnBlur: false,
  24. saveMessageAlertType: 'info',
  25. saveMessage: t(
  26. 'Changing fingerprint rules will apply to future events only (can take up to a minute).'
  27. ),
  28. formatMessageValue: false,
  29. help: () => (
  30. <Fragment>
  31. <RuleDescription>
  32. {tct(
  33. `This can be used to modify the fingerprint rules on the server with custom rules.
  34. Rules follow the pattern [pattern]. To learn more about fingerprint rules, [docs:read the docs].`,
  35. {
  36. pattern: <code>matcher:glob -&gt; fingerprint, values</code>,
  37. docs: (
  38. <ExternalLink href="https://docs.sentry.io/product/data-management-settings/event-grouping/fingerprint-rules/" />
  39. ),
  40. }
  41. )}
  42. </RuleDescription>
  43. <RuleExample>
  44. {`# force all errors of the same type to have the same fingerprint
  45. error.type:DatabaseUnavailable -> system-down
  46. # force all memory allocation errors to be grouped together
  47. stack.function:malloc -> memory-allocation-error`}
  48. </RuleExample>
  49. </Fragment>
  50. ),
  51. visible: true,
  52. },
  53. groupingEnhancements: {
  54. name: 'groupingEnhancements',
  55. type: 'string',
  56. label: t('Stack Trace Rules'),
  57. hideLabel: true,
  58. placeholder: t(
  59. 'stack.function:raise_an_exception ^-group\nstack.function:namespace::* +app'
  60. ),
  61. multiline: true,
  62. monospace: true,
  63. autosize: true,
  64. inline: false,
  65. maxRows: 20,
  66. saveOnBlur: false,
  67. saveMessageAlertType: 'info',
  68. saveMessage: t(
  69. 'Changing stack trace rules will apply to future events only (can take up to a minute).'
  70. ),
  71. formatMessageValue: false,
  72. help: () => (
  73. <Fragment>
  74. <RuleDescription>
  75. {tct(
  76. `This can be used to enhance the grouping algorithm with custom rules.
  77. Rules follow the pattern [pattern]. To learn more about stack trace rules, [docs:read the docs].`,
  78. {
  79. pattern: <code>matcher:glob [v^]?[+-]flag</code>,
  80. docs: (
  81. <ExternalLink href="https://docs.sentry.io/product/data-management-settings/event-grouping/stack-trace-rules/" />
  82. ),
  83. }
  84. )}
  85. </RuleDescription>
  86. <RuleExample>
  87. {`# remove all frames above a certain function from grouping
  88. stack.function:panic_handler ^-group
  89. # mark all functions following a prefix in-app
  90. stack.function:mylibrary_* +app`}
  91. </RuleExample>
  92. </Fragment>
  93. ),
  94. validate: () => [],
  95. visible: true,
  96. },
  97. };
  98. const RuleDescription = styled('div')`
  99. margin-bottom: ${space(1)};
  100. margin-top: -${space(1)};
  101. `;
  102. const RuleExample = styled('pre')`
  103. margin-bottom: ${space(1)};
  104. `;