dynamicSampling.tsx 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. export enum DynamicSamplingRuleType {
  2. /**
  3. * The rule applies to traces (transaction events considered in the context of a trace)
  4. */
  5. TRACE = 'trace',
  6. /**
  7. * The rule applies to transaction events considered independently
  8. */
  9. TRANSACTION = 'transaction',
  10. /**
  11. * The rule applies to error events (not transaction events)
  12. */
  13. ERROR = 'error',
  14. }
  15. export enum DynamicSamplingConditionOperator {
  16. /**
  17. * The not combinator has a similar structure with the only difference that "inner" is not an array
  18. * and contains directly the negated condition
  19. */
  20. NOT = 'not',
  21. /**
  22. * Combine multiple sub-conditions with the operator 'or'
  23. */
  24. OR = 'or',
  25. /**
  26. * Combine multiple sub-conditions with the operator 'and'
  27. */
  28. AND = 'and',
  29. }
  30. export enum DynamicSamplingInnerOperator {
  31. /**
  32. * It uses glob matches for checking (e.g. releases use glob matching "1.1.*" will match release 1.1.1 and 1.1.2)
  33. */
  34. GLOB_MATCH = 'glob',
  35. /**
  36. * It uses simple equality for checking
  37. */
  38. EQUAL = 'eq',
  39. /**
  40. * Custom Operation
  41. */
  42. CUSTOM = 'custom',
  43. }
  44. export enum DynamicSamplingInnerName {
  45. TRACE_RELEASE = 'trace.release',
  46. TRACE_ENVIRONMENT = 'trace.environment',
  47. TRACE_USER_ID = 'trace.user.id',
  48. TRACE_USER_SEGMENT = 'trace.user.segment',
  49. TRACE_TRANSACTION = 'trace.transaction',
  50. EVENT_RELEASE = 'event.release',
  51. EVENT_ENVIRONMENT = 'event.environment',
  52. EVENT_USER_ID = 'event.user.id',
  53. EVENT_USER_SEGMENT = 'event.user.segment',
  54. EVENT_LOCALHOST = 'event.is_local_ip',
  55. EVENT_WEB_CRAWLERS = 'event.web_crawlers',
  56. EVENT_BROWSER_EXTENSIONS = 'event.has_bad_browser_extensions',
  57. EVENT_TRANSACTION = 'event.transaction',
  58. // Custom operators
  59. EVENT_IP_ADDRESSES = 'event.client_ip',
  60. EVENT_LEGACY_BROWSER = 'event.legacy_browser',
  61. EVENT_ERROR_MESSAGES = 'event.error_messages',
  62. EVENT_CSP = 'event.csp',
  63. }
  64. export enum LegacyBrowser {
  65. IE_PRE_9 = 'ie_pre_9',
  66. IE9 = 'ie9',
  67. IE10 = 'ie10',
  68. IE11 = 'ie11',
  69. SAFARI_PRE_6 = 'safari_pre_6',
  70. OPERA_PRE_15 = 'opera_pre_15',
  71. OPERA_MINI_PRE_8 = 'opera_mini_pre_8',
  72. ANDROID_PRE_4 = 'android_pre_4',
  73. }
  74. type DynamicSamplingConditionLogicalInnerGlob = {
  75. op: DynamicSamplingInnerOperator.GLOB_MATCH;
  76. name:
  77. | DynamicSamplingInnerName.EVENT_RELEASE
  78. | DynamicSamplingInnerName.TRACE_RELEASE
  79. | DynamicSamplingInnerName.EVENT_TRANSACTION
  80. | DynamicSamplingInnerName.TRACE_TRANSACTION;
  81. value: Array<string>;
  82. };
  83. type DynamicSamplingConditionLogicalInnerEq = {
  84. op: DynamicSamplingInnerOperator.EQUAL;
  85. name:
  86. | DynamicSamplingInnerName.EVENT_ENVIRONMENT
  87. | DynamicSamplingInnerName.TRACE_ENVIRONMENT
  88. | DynamicSamplingInnerName.EVENT_USER_ID
  89. | DynamicSamplingInnerName.TRACE_USER_ID
  90. | DynamicSamplingInnerName.EVENT_USER_SEGMENT
  91. | DynamicSamplingInnerName.TRACE_USER_SEGMENT;
  92. value: Array<string>;
  93. options: {
  94. ignoreCase: boolean;
  95. };
  96. };
  97. type DynamicSamplingConditionLogicalInnerEqBoolean = {
  98. op: DynamicSamplingInnerOperator.EQUAL;
  99. name:
  100. | DynamicSamplingInnerName.EVENT_BROWSER_EXTENSIONS
  101. | DynamicSamplingInnerName.EVENT_LOCALHOST
  102. | DynamicSamplingInnerName.EVENT_WEB_CRAWLERS;
  103. value: boolean;
  104. };
  105. type DynamicSamplingConditionLogicalInnerCustom = {
  106. op: DynamicSamplingInnerOperator.CUSTOM;
  107. name:
  108. | DynamicSamplingInnerName.EVENT_CSP
  109. | DynamicSamplingInnerName.EVENT_ERROR_MESSAGES
  110. | DynamicSamplingInnerName.EVENT_IP_ADDRESSES;
  111. value: Array<string>;
  112. };
  113. type DynamicSamplingConditionLogicalInnerCustomLegacyBrowser = {
  114. op: DynamicSamplingInnerOperator.CUSTOM;
  115. name: DynamicSamplingInnerName.EVENT_LEGACY_BROWSER;
  116. value: Array<LegacyBrowser>;
  117. };
  118. export type DynamicSamplingConditionLogicalInner =
  119. | DynamicSamplingConditionLogicalInnerGlob
  120. | DynamicSamplingConditionLogicalInnerEq
  121. | DynamicSamplingConditionLogicalInnerEqBoolean
  122. | DynamicSamplingConditionLogicalInnerCustom
  123. | DynamicSamplingConditionLogicalInnerCustomLegacyBrowser;
  124. export type DynamicSamplingCondition = {
  125. op: DynamicSamplingConditionOperator.AND;
  126. inner: Array<DynamicSamplingConditionLogicalInner>;
  127. };
  128. export type DynamicSamplingRule = {
  129. /**
  130. * This is a unique number within a project
  131. */
  132. id: number;
  133. /**
  134. * Describes the type of rule
  135. */
  136. type: DynamicSamplingRuleType;
  137. /**
  138. * It is a possibly empty list of conditions to which the rule applies.
  139. * The conditions are combined using the and operator (so all the conditions must be satisfied for the rule to apply).
  140. * If the conditions field is an empty list the rule applies for all events that satisfy the projectIds and the ty fields.
  141. */
  142. condition: DynamicSamplingCondition;
  143. /**
  144. * It is the sampling rate that will be applied if the rule is selected
  145. */
  146. sampleRate: number;
  147. };
  148. export type DynamicSamplingRules = Array<DynamicSamplingRule>;