replayReaderParams.js 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. const defaultRRWebEvents = [
  2. {
  3. type: 0,
  4. data: {},
  5. timestamp: 1663865919000,
  6. delay: -198487,
  7. },
  8. {
  9. type: 1,
  10. data: {},
  11. timestamp: 1663865920587,
  12. delay: -135199,
  13. },
  14. {
  15. type: 4,
  16. data: {
  17. href: 'http://localhost:3000/',
  18. width: 1536,
  19. height: 722,
  20. },
  21. timestamp: 1663865920587,
  22. delay: -135199,
  23. },
  24. ];
  25. const defaultBreadcrumbs = [
  26. {
  27. timestamp: 1663865920.851,
  28. type: 'default',
  29. level: 'info',
  30. category: 'ui.focus',
  31. },
  32. {
  33. timestamp: 1663865922.024,
  34. type: 'default',
  35. level: 'info',
  36. category: 'ui.click',
  37. message:
  38. 'input.form-control[type="text"][name="url"][title="Fully qualified URL prefixed with http or https"]',
  39. data: {
  40. nodeId: 37,
  41. },
  42. },
  43. ];
  44. export function ReplayReaderParams({
  45. replayRecord = {},
  46. rrwebEvents = defaultRRWebEvents,
  47. breadcrumbs = defaultBreadcrumbs,
  48. spans = [],
  49. errors = [],
  50. } = {}) {
  51. return {
  52. replayRecord: {
  53. userAgent:
  54. 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.114 Safari/537.36',
  55. title: '',
  56. projectId: '6273278',
  57. platform: 'javascript',
  58. releases: ['1.0.0', '2.0.0'],
  59. dist: '',
  60. traceIds: [],
  61. errorIds: ['5c83aaccfffb4a708ae893bad9be3a1c'],
  62. startedAt: new Date('Sep 22, 2022 4:58:39 PM UTC'),
  63. finishedAt: new Date('Sep 22, 2022 5:00:03 PM UTC'),
  64. duration: 84,
  65. countSegments: 14,
  66. countErrors: 1,
  67. id: '761104e184c64d439ee1014b72b4d83b',
  68. longestTransaction: 0,
  69. environment: 'demo',
  70. tags: {},
  71. user: {
  72. id: '',
  73. name: '',
  74. email: '',
  75. ip_address: '127.0.0.1',
  76. displayName: '127.0.0.1',
  77. },
  78. sdk: {
  79. name: 'sentry.javascript.browser',
  80. version: '7.1.1',
  81. },
  82. os: {
  83. name: 'Other',
  84. version: '',
  85. },
  86. browser: {
  87. name: 'Other',
  88. version: '',
  89. },
  90. device: {
  91. name: '',
  92. brand: '',
  93. model: '',
  94. family: 'Other',
  95. },
  96. urls: ['http://localhost:3000/'],
  97. countUrls: 1,
  98. ...replayRecord,
  99. },
  100. rrwebEvents,
  101. breadcrumbs,
  102. spans,
  103. errors,
  104. };
  105. }