data.tsx 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. import {t} from 'sentry/locale';
  2. import type {NewQuery} from 'sentry/types/organization';
  3. import {SavedQueryDatasets} from 'sentry/utils/discover/types';
  4. export const DEFAULT_EVENT_VIEW: Readonly<NewQuery> = {
  5. id: undefined,
  6. name: t('All Events'),
  7. query: '',
  8. projects: [],
  9. fields: ['title', 'event.type', 'project', 'user.display', 'timestamp'],
  10. orderby: '-timestamp',
  11. version: 2,
  12. range: '24h',
  13. queryDataset: SavedQueryDatasets.DISCOVER,
  14. };
  15. const DEFAULT_TRANSACTION_VIEW: Readonly<NewQuery> = {
  16. id: undefined,
  17. name: t('All Transactions'),
  18. query: 'event.type:transaction',
  19. projects: [],
  20. fields: ['title', 'project', 'user.display', 'timestamp'],
  21. orderby: '-timestamp',
  22. version: 2,
  23. range: '24h',
  24. queryDataset: SavedQueryDatasets.TRANSACTIONS,
  25. };
  26. const DEFAULT_ERROR_VIEW: Readonly<NewQuery> = {
  27. id: undefined,
  28. name: t('All Errors'),
  29. query: 'event.type:error', // what about csp events etc
  30. projects: [],
  31. fields: ['title', 'project', 'user.display', 'timestamp'],
  32. orderby: '-timestamp',
  33. version: 2,
  34. range: '24h',
  35. queryDataset: SavedQueryDatasets.ERRORS,
  36. };
  37. export const DEFAULT_EVENT_VIEW_MAP: Record<SavedQueryDatasets, Readonly<NewQuery>> = {
  38. [SavedQueryDatasets.DISCOVER]: DEFAULT_EVENT_VIEW,
  39. [SavedQueryDatasets.ERRORS]: DEFAULT_ERROR_VIEW,
  40. [SavedQueryDatasets.TRANSACTIONS]: DEFAULT_TRANSACTION_VIEW,
  41. };
  42. export const TRANSACTION_VIEWS: Readonly<Array<NewQuery>> = [
  43. {
  44. id: undefined,
  45. name: t('Transactions by Volume'),
  46. fields: [
  47. 'transaction',
  48. 'project',
  49. 'count()',
  50. 'avg(transaction.duration)',
  51. 'p75()',
  52. 'p95()',
  53. ],
  54. orderby: '-count',
  55. query: 'event.type:transaction',
  56. projects: [],
  57. version: 2,
  58. range: '24h',
  59. queryDataset: SavedQueryDatasets.DISCOVER,
  60. },
  61. ];
  62. export const WEB_VITALS_VIEWS: Readonly<Array<NewQuery>> = [
  63. {
  64. id: undefined,
  65. name: t('Web Vitals'),
  66. fields: [
  67. 'transaction',
  68. 'epm()',
  69. 'p75(measurements.fp)',
  70. 'p75(measurements.fcp)',
  71. 'p75(measurements.lcp)',
  72. 'p75(measurements.fid)',
  73. 'p75(measurements.cls)',
  74. ],
  75. orderby: '-epm',
  76. query: 'event.type:transaction transaction.op:pageload',
  77. projects: [],
  78. version: 2,
  79. range: '24h',
  80. yAxis: ['epm()'],
  81. queryDataset: SavedQueryDatasets.DISCOVER,
  82. },
  83. ];
  84. export const ALL_VIEWS: Readonly<Array<NewQuery>> = [
  85. DEFAULT_EVENT_VIEW,
  86. {
  87. id: undefined,
  88. name: t('Errors by Title'),
  89. fields: ['title', 'count()', 'count_unique(user)', 'project'],
  90. orderby: '-count',
  91. query: 'event.type:error',
  92. projects: [],
  93. version: 2,
  94. range: '24h',
  95. display: 'top5',
  96. queryDataset: SavedQueryDatasets.DISCOVER,
  97. },
  98. {
  99. id: undefined,
  100. name: t('Errors by URL'),
  101. fields: ['url', 'count()', 'count_unique(issue)'],
  102. orderby: '-count',
  103. query: 'event.type:error has:url',
  104. projects: [],
  105. version: 2,
  106. range: '24h',
  107. display: 'top5',
  108. queryDataset: SavedQueryDatasets.DISCOVER,
  109. },
  110. ];