dynamicSamplingConfig.js 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. import {
  2. SamplingConditionOperator,
  3. SamplingInnerName,
  4. SamplingInnerOperator,
  5. SamplingRuleType,
  6. } from 'sentry/types/sampling';
  7. export function DynamicSamplingConfig(params = {}) {
  8. return {
  9. uniformRule: {
  10. sampleRate: 0.5,
  11. type: SamplingRuleType.TRACE,
  12. active: true,
  13. condition: {
  14. op: SamplingConditionOperator.AND,
  15. inner: [],
  16. },
  17. id: 1,
  18. },
  19. specificRule: {
  20. sampleRate: 0.6,
  21. active: false,
  22. type: SamplingRuleType.TRACE,
  23. condition: {
  24. op: SamplingConditionOperator.AND,
  25. inner: [
  26. {
  27. op: SamplingInnerOperator.GLOB_MATCH,
  28. name: SamplingInnerName.TRACE_RELEASE,
  29. value: ['1.2.2'],
  30. },
  31. ],
  32. },
  33. id: 2,
  34. },
  35. samplingSdkVersions: [
  36. {
  37. project: 'javascript',
  38. latestSDKVersion: '1.0.3',
  39. latestSDKName: 'sentry.javascript.react',
  40. isSendingSampleRate: true,
  41. isSendingSource: true,
  42. isSupportedPlatform: true,
  43. },
  44. {
  45. project: 'sentry',
  46. latestSDKVersion: '1.0.2',
  47. latestSDKName: 'sentry.python',
  48. isSendingSampleRate: false,
  49. isSendingSource: false,
  50. isSupportedPlatform: true,
  51. },
  52. {
  53. project: 'java',
  54. latestSDKVersion: '1.0.2',
  55. latestSDKName: 'sentry.java',
  56. isSendingSampleRate: true,
  57. isSendingSource: false,
  58. isSupportedPlatform: true,
  59. },
  60. {
  61. project: 'angular',
  62. latestSDKVersion: '1.0.2',
  63. latestSDKName: 'sentry.javascript.angular',
  64. isSendingSampleRate: false,
  65. isSendingSource: false,
  66. isSupportedPlatform: false,
  67. },
  68. ],
  69. samplingDistribution: {
  70. projectBreakdown: [
  71. {
  72. project: 'javascript',
  73. projectId: 1,
  74. 'count()': 888,
  75. },
  76. {
  77. project: 'sentry',
  78. projectId: 2,
  79. 'count()': 100,
  80. },
  81. ],
  82. parentProjectBreakdown: [
  83. {
  84. percentage: 10,
  85. project: 'parent-project',
  86. projectId: 10,
  87. },
  88. ],
  89. sampleSize: 100,
  90. startTimestamp: '2017-08-04T07:52:11Z',
  91. endTimestamp: '2017-08-05T07:52:11Z',
  92. },
  93. projects: [
  94. TestStubs.Project({
  95. name: 'javascript',
  96. slug: 'javascript',
  97. id: 1,
  98. }),
  99. TestStubs.Project({
  100. name: 'sentry',
  101. slug: 'sentry',
  102. platform: 'python',
  103. id: 2,
  104. }),
  105. TestStubs.Project({
  106. id: 4,
  107. dynamicSampling: {
  108. rules: [
  109. {
  110. sampleRate: 1,
  111. type: 'trace',
  112. active: false,
  113. condition: {
  114. op: 'and',
  115. inner: [],
  116. },
  117. id: 1,
  118. },
  119. ],
  120. },
  121. }),
  122. ],
  123. recommendedSdkUpgrades: [
  124. {
  125. project: TestStubs.Project({
  126. name: 'sentry',
  127. slug: 'sentry',
  128. platform: 'python',
  129. id: 2,
  130. }),
  131. latestSDKVersion: '1.0.2',
  132. latestSDKName: 'sentry.python',
  133. },
  134. ],
  135. ...params,
  136. };
  137. }