dynamicSampling.tsx 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  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. EVENT_RELEASE = 'event.release',
  50. EVENT_ENVIRONMENT = 'event.environment',
  51. EVENT_USER_ID = 'event.user.id',
  52. EVENT_USER_SEGMENT = 'event.user.segment',
  53. EVENT_LOCALHOST = 'event.is_local_ip',
  54. EVENT_WEB_CRAWLERS = 'event.web_crawlers',
  55. EVENT_BROWSER_EXTENSIONS = 'event.has_bad_browser_extensions',
  56. // Custom operators
  57. EVENT_IP_ADDRESSES = 'event.client_ip',
  58. EVENT_LEGACY_BROWSER = 'event.legacy_browser',
  59. EVENT_ERROR_MESSAGES = 'event.error_messages',
  60. EVENT_CSP = 'event.csp',
  61. }
  62. export enum LegacyBrowser {
  63. IE_PRE_9 = 'ie_pre_9',
  64. IE9 = 'ie9',
  65. IE10 = 'ie10',
  66. IE11 = 'ie11',
  67. SAFARI_PRE_6 = 'safari_pre_6',
  68. OPERA_PRE_15 = 'opera_pre_15',
  69. OPERA_MINI_PRE_8 = 'opera_mini_pre_8',
  70. ANDROID_PRE_4 = 'android_pre_4',
  71. }
  72. type DynamicSamplingConditionLogicalInnerGlob = {
  73. op: DynamicSamplingInnerOperator.GLOB_MATCH;
  74. name: DynamicSamplingInnerName.EVENT_RELEASE | DynamicSamplingInnerName.TRACE_RELEASE;
  75. value: Array<string>;
  76. };
  77. type DynamicSamplingConditionLogicalInnerEq = {
  78. op: DynamicSamplingInnerOperator.EQUAL;
  79. name:
  80. | DynamicSamplingInnerName.EVENT_ENVIRONMENT
  81. | DynamicSamplingInnerName.TRACE_ENVIRONMENT
  82. | DynamicSamplingInnerName.EVENT_USER_ID
  83. | DynamicSamplingInnerName.TRACE_USER_ID
  84. | DynamicSamplingInnerName.EVENT_USER_SEGMENT
  85. | DynamicSamplingInnerName.TRACE_USER_SEGMENT;
  86. value: Array<string>;
  87. options: {
  88. ignoreCase: boolean;
  89. };
  90. };
  91. type DynamicSamplingConditionLogicalInnerEqBoolean = {
  92. op: DynamicSamplingInnerOperator.EQUAL;
  93. name:
  94. | DynamicSamplingInnerName.EVENT_BROWSER_EXTENSIONS
  95. | DynamicSamplingInnerName.EVENT_LOCALHOST
  96. | DynamicSamplingInnerName.EVENT_WEB_CRAWLERS;
  97. value: boolean;
  98. };
  99. type DynamicSamplingConditionLogicalInnerCustom = {
  100. op: DynamicSamplingInnerOperator.CUSTOM;
  101. name:
  102. | DynamicSamplingInnerName.EVENT_CSP
  103. | DynamicSamplingInnerName.EVENT_ERROR_MESSAGES
  104. | DynamicSamplingInnerName.EVENT_IP_ADDRESSES;
  105. value: Array<string>;
  106. };
  107. type DynamicSamplingConditionLogicalInnerCustomLegacyBrowser = {
  108. op: DynamicSamplingInnerOperator.CUSTOM;
  109. name: DynamicSamplingInnerName.EVENT_LEGACY_BROWSER;
  110. value: Array<LegacyBrowser>;
  111. };
  112. export type DynamicSamplingConditionLogicalInner =
  113. | DynamicSamplingConditionLogicalInnerGlob
  114. | DynamicSamplingConditionLogicalInnerEq
  115. | DynamicSamplingConditionLogicalInnerEqBoolean
  116. | DynamicSamplingConditionLogicalInnerCustom
  117. | DynamicSamplingConditionLogicalInnerCustomLegacyBrowser;
  118. export type DynamicSamplingCondition = {
  119. op: DynamicSamplingConditionOperator.AND;
  120. inner: Array<DynamicSamplingConditionLogicalInner>;
  121. };
  122. export type DynamicSamplingRule = {
  123. /**
  124. * This is a unique number within a project
  125. */
  126. id: number;
  127. /**
  128. * Describes the type of rule
  129. */
  130. type: DynamicSamplingRuleType;
  131. /**
  132. * It is a possibly empty list of conditions to which the rule applies.
  133. * The conditions are combined using the and operator (so all the conditions must be satisfied for the rule to apply).
  134. * If the conditions field is an empty list the rule applies for all events that satisfy the projectIds and the ty fields.
  135. */
  136. condition: DynamicSamplingCondition;
  137. /**
  138. * It is the sampling rate that will be applied if the rule is selected
  139. */
  140. sampleRate: number;
  141. };
  142. export type DynamicSamplingRules = Array<DynamicSamplingRule>;