replayReaderParams.js 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. import {duration} from 'moment';
  2. const defaultRRWebEvents = [
  3. {
  4. type: 0,
  5. data: {},
  6. timestamp: 1663865919000,
  7. delay: -198487,
  8. },
  9. {
  10. type: 1,
  11. data: {},
  12. timestamp: 1663865920587,
  13. delay: -135199,
  14. },
  15. {
  16. type: 4,
  17. data: {
  18. href: 'http://localhost:3000/',
  19. width: 1536,
  20. height: 722,
  21. },
  22. timestamp: 1663865920587,
  23. delay: -135199,
  24. },
  25. ];
  26. const defaultBreadcrumbs = [
  27. {
  28. timestamp: 1663865920851,
  29. type: 5,
  30. data: {
  31. payload: {
  32. timestamp: 1663865920.851,
  33. type: 'default',
  34. level: 'info',
  35. category: 'ui.focus',
  36. },
  37. },
  38. },
  39. {
  40. timestamp: 1663865922024,
  41. type: 5,
  42. data: {
  43. payload: {
  44. timestamp: 1663865922.024,
  45. type: 'default',
  46. level: 'info',
  47. category: 'ui.click',
  48. message:
  49. 'input.form-control[type="text"][name="url"][title="Fully qualified URL prefixed with http or https"]',
  50. data: {
  51. nodeId: 37,
  52. },
  53. },
  54. },
  55. },
  56. ];
  57. export function ReplayReaderParams({
  58. attachments = [...defaultRRWebEvents, ...defaultBreadcrumbs],
  59. replayRecord = {},
  60. errors = [],
  61. } = {}) {
  62. return {
  63. replayRecord: {
  64. activity: 0,
  65. browser: {
  66. name: 'Other',
  67. version: '',
  68. },
  69. count_errors: 1,
  70. count_segments: 14,
  71. count_urls: 1,
  72. device: {
  73. name: '',
  74. brand: '',
  75. model_id: '',
  76. family: 'Other',
  77. },
  78. dist: '',
  79. duration: duration(84000),
  80. environment: 'demo',
  81. error_ids: ['5c83aaccfffb4a708ae893bad9be3a1c'],
  82. finished_at: new Date('Sep 22, 2022 5:00:03 PM UTC'),
  83. id: '761104e184c64d439ee1014b72b4d83b',
  84. longest_transaction: 0,
  85. os: {
  86. name: 'Other',
  87. version: '',
  88. },
  89. platform: 'javascript',
  90. project_id: '6273278',
  91. releases: ['1.0.0', '2.0.0'],
  92. sdk: {
  93. name: 'sentry.javascript.browser',
  94. version: '7.1.1',
  95. },
  96. started_at: new Date('Sep 22, 2022 4:58:39 PM UTC'),
  97. tags: {
  98. 'browser.name': ['Other'],
  99. 'device.family': ['Other'],
  100. 'os.name': ['Other'],
  101. platform: ['javascript'],
  102. releases: ['1.0.0', '2.0.0'],
  103. 'sdk.name': ['sentry.javascript.browser'],
  104. 'sdk.version': ['7.1.1'],
  105. 'user.ip': ['127.0.0.1'],
  106. },
  107. trace_ids: [],
  108. urls: ['http://localhost:3000/'],
  109. user: {
  110. id: '',
  111. name: '',
  112. email: '',
  113. ip: '127.0.0.1',
  114. display_name: '127.0.0.1',
  115. },
  116. ...replayRecord,
  117. },
  118. attachments,
  119. errors,
  120. };
  121. }