constants.tsx 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. import type {FilterKeySection} from 'sentry/components/searchQueryBuilder/types';
  2. import {t} from 'sentry/locale';
  3. import type {AggregationOutputType} from 'sentry/utils/discover/fields';
  4. import {type FieldDefinition, FieldKind, FieldValueType} from 'sentry/utils/fields';
  5. import {SpanFunction, SpanIndexedField} from 'sentry/views/insights/types';
  6. export const STARFISH_AGGREGATION_FIELDS: Record<
  7. SpanFunction,
  8. FieldDefinition & {defaultOutputType: AggregationOutputType}
  9. > = {
  10. [SpanFunction.SPS]: {
  11. desc: t('Spans per second'),
  12. kind: FieldKind.FUNCTION,
  13. defaultOutputType: 'number',
  14. valueType: FieldValueType.NUMBER,
  15. },
  16. [SpanFunction.SPM]: {
  17. desc: t('Spans per minute'),
  18. kind: FieldKind.FUNCTION,
  19. defaultOutputType: 'number',
  20. valueType: FieldValueType.NUMBER,
  21. },
  22. [SpanFunction.TIME_SPENT_PERCENTAGE]: {
  23. desc: t('Span time spent percentage'),
  24. defaultOutputType: 'percentage',
  25. kind: FieldKind.FUNCTION,
  26. valueType: FieldValueType.NUMBER,
  27. },
  28. [SpanFunction.HTTP_ERROR_COUNT]: {
  29. desc: t('Count of 5XX http errors'),
  30. defaultOutputType: 'integer',
  31. kind: FieldKind.FUNCTION,
  32. valueType: FieldValueType.NUMBER,
  33. },
  34. [SpanFunction.HTTP_RESPONSE_RATE]: {
  35. desc: t('Percentage of HTTP responses by code'),
  36. defaultOutputType: 'percentage',
  37. kind: FieldKind.FUNCTION,
  38. valueType: FieldValueType.NUMBER,
  39. },
  40. [SpanFunction.CACHE_HIT_RATE]: {
  41. desc: t('Percentage of cache hits'),
  42. defaultOutputType: 'percentage',
  43. kind: FieldKind.FUNCTION,
  44. valueType: FieldValueType.NUMBER,
  45. },
  46. [SpanFunction.CACHE_MISS_RATE]: {
  47. desc: t('Percentage of cache misses'),
  48. defaultOutputType: 'percentage',
  49. kind: FieldKind.FUNCTION,
  50. valueType: FieldValueType.NUMBER,
  51. },
  52. [SpanFunction.COUNT_OP]: {
  53. desc: t('Count of spans with matching operation'),
  54. defaultOutputType: 'integer',
  55. kind: FieldKind.FUNCTION,
  56. valueType: FieldValueType.NUMBER,
  57. },
  58. [SpanFunction.TRACE_STATUS_RATE]: {
  59. desc: t('Percentage of spans with matching trace status'),
  60. defaultOutputType: 'percentage',
  61. kind: FieldKind.FUNCTION,
  62. valueType: FieldValueType.NUMBER,
  63. },
  64. };
  65. const RELEASE_FILTERS: FilterKeySection = {
  66. value: 'release_filters',
  67. label: 'Release',
  68. children: [SpanIndexedField.RELEASE],
  69. };
  70. const TRANSACTION_FILTERS: FilterKeySection = {
  71. value: 'transaction_filters',
  72. label: 'Transaction',
  73. children: [
  74. SpanIndexedField.TRANSACTION_METHOD,
  75. SpanIndexedField.TRANSACTION_OP,
  76. SpanIndexedField.TRANSACTION,
  77. SpanIndexedField.TRANSACTION_ID,
  78. ],
  79. };
  80. const USER_CONTEXT_FILTERS: FilterKeySection = {
  81. value: 'user_context_filters',
  82. label: 'User',
  83. children: [
  84. SpanIndexedField.USER,
  85. SpanIndexedField.USER_ID,
  86. SpanIndexedField.USER_EMAIL,
  87. SpanIndexedField.USER_USERNAME,
  88. SpanIndexedField.USER_GEO_SUBREGION,
  89. ],
  90. };
  91. const SPAN_FILTERS: FilterKeySection = {
  92. value: 'span_filters',
  93. label: 'Span',
  94. children: [
  95. SpanIndexedField.SPAN_OP,
  96. SpanIndexedField.SPAN_DURATION,
  97. SpanIndexedField.SPAN_SELF_TIME,
  98. SpanIndexedField.SPAN_DESCRIPTION,
  99. SpanIndexedField.SPAN_STATUS,
  100. SpanIndexedField.SPAN_ACTION,
  101. SpanIndexedField.SPAN_DOMAIN,
  102. SpanIndexedField.SPAN_MODULE,
  103. ],
  104. };
  105. const EVENT_FILTERS: FilterKeySection = {
  106. value: 'event_filters',
  107. label: 'Event',
  108. children: [
  109. ...SPAN_FILTERS.children,
  110. ...TRANSACTION_FILTERS.children,
  111. ...RELEASE_FILTERS.children,
  112. ],
  113. };
  114. export const SPANS_FILTER_KEY_SECTIONS: FilterKeySection[] = [
  115. EVENT_FILTERS,
  116. USER_CONTEXT_FILTERS,
  117. ];