replayRecord.ts 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. import {duration} from 'moment-timezone';
  2. import type {ReplayRecord} from 'sentry/views/replays/types';
  3. export function ReplayRecordFixture(
  4. replayRecord: Partial<ReplayRecord> = {}
  5. ): ReplayRecord {
  6. return {
  7. activity: 0,
  8. browser: {
  9. name: 'Other',
  10. version: '',
  11. },
  12. count_dead_clicks: 1,
  13. count_rage_clicks: 1,
  14. count_errors: 1,
  15. count_segments: 14,
  16. count_urls: 1,
  17. device: {
  18. name: '',
  19. brand: '',
  20. model_id: '',
  21. family: 'Other',
  22. },
  23. dist: '',
  24. duration: duration(84000),
  25. environment: 'demo',
  26. error_ids: ['5c83aaccfffb4a708ae893bad9be3a1c'],
  27. finished_at: new Date('Sep 22, 2022 5:00:03 PM UTC'),
  28. has_viewed: false,
  29. id: '761104e184c64d439ee1014b72b4d83b',
  30. is_archived: false,
  31. os: {
  32. name: 'Other',
  33. version: '',
  34. },
  35. platform: 'javascript',
  36. project_id: '6273278',
  37. releases: ['1.0.0', '2.0.0'],
  38. sdk: {
  39. name: 'sentry.javascript.browser',
  40. version: '7.1.1',
  41. },
  42. started_at: new Date('Sep 22, 2022 4:58:39 PM UTC'),
  43. trace_ids: [],
  44. urls: ['http://localhost:3000/'],
  45. user: {
  46. id: '',
  47. username: '',
  48. email: '',
  49. ip: '127.0.0.1',
  50. display_name: '127.0.0.1',
  51. },
  52. ...replayRecord,
  53. tags: {
  54. ...replayRecord.tags,
  55. 'browser.name': [replayRecord.browser?.name ?? 'Other'],
  56. 'device.family': [replayRecord.device?.family ?? 'Other'],
  57. environment: ['demo'],
  58. 'os.name': [replayRecord.os?.name ?? 'Other'],
  59. platform: [replayRecord.platform ?? 'javascript'],
  60. releases: replayRecord.releases ?? ['1.0.0', '2.0.0'],
  61. 'sdk.name': [replayRecord.sdk?.name ?? 'sentry.javascript.browser'],
  62. 'sdk.version': [replayRecord.sdk?.version ?? '7.1.1'],
  63. 'user.ip': [replayRecord.user?.ip ?? '127.0.0.1'],
  64. },
  65. };
  66. }