replayRecord.ts 1.7 KB

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