replayRecord.ts 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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_dead_clicks: 1,
  11. count_rage_clicks: 1,
  12. count_errors: 1,
  13. count_segments: 14,
  14. count_urls: 1,
  15. device: {
  16. name: '',
  17. brand: '',
  18. model_id: '',
  19. family: 'Other',
  20. },
  21. dist: '',
  22. duration: duration(84000),
  23. environment: 'demo',
  24. error_ids: ['5c83aaccfffb4a708ae893bad9be3a1c'],
  25. finished_at: new Date('Sep 22, 2022 5:00:03 PM UTC'),
  26. id: '761104e184c64d439ee1014b72b4d83b',
  27. is_archived: false,
  28. os: {
  29. name: 'Other',
  30. version: '',
  31. },
  32. platform: 'javascript',
  33. project_id: '6273278',
  34. releases: ['1.0.0', '2.0.0'],
  35. sdk: {
  36. name: 'sentry.javascript.browser',
  37. version: '7.1.1',
  38. },
  39. started_at: new Date('Sep 22, 2022 4:58:39 PM UTC'),
  40. trace_ids: [],
  41. urls: ['http://localhost:3000/'],
  42. user: {
  43. id: '',
  44. username: '',
  45. email: '',
  46. ip: '127.0.0.1',
  47. display_name: '127.0.0.1',
  48. },
  49. ...replayRecord,
  50. tags: {
  51. ...replayRecord.tags,
  52. 'browser.name': [replayRecord.browser?.name ?? 'Other'],
  53. 'device.family': [replayRecord.device?.family ?? 'Other'],
  54. environment: ['demo'],
  55. 'os.name': [replayRecord.os?.name ?? 'Other'],
  56. platform: [replayRecord.platform ?? 'javascript'],
  57. releases: replayRecord.releases ?? ['1.0.0', '2.0.0'],
  58. 'sdk.name': [replayRecord.sdk?.name ?? 'sentry.javascript.browser'],
  59. 'sdk.version': [replayRecord.sdk?.version ?? '7.1.1'],
  60. 'user.ip': [replayRecord.user?.ip ?? '127.0.0.1'],
  61. },
  62. };
  63. }