replayRecord.ts 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. import {duration} from 'moment';
  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. id: '761104e184c64d439ee1014b72b4d83b',
  29. is_archived: false,
  30. os: {
  31. name: 'Other',
  32. version: '',
  33. },
  34. platform: 'javascript',
  35. project_id: '6273278',
  36. releases: ['1.0.0', '2.0.0'],
  37. sdk: {
  38. name: 'sentry.javascript.browser',
  39. version: '7.1.1',
  40. },
  41. started_at: new Date('Sep 22, 2022 4:58:39 PM UTC'),
  42. trace_ids: [],
  43. urls: ['http://localhost:3000/'],
  44. user: {
  45. id: '',
  46. username: '',
  47. email: '',
  48. ip: '127.0.0.1',
  49. display_name: '127.0.0.1',
  50. },
  51. ...replayRecord,
  52. tags: {
  53. ...replayRecord.tags,
  54. 'browser.name': [replayRecord.browser?.name ?? 'Other'],
  55. 'device.family': [replayRecord.device?.family ?? 'Other'],
  56. environment: ['demo'],
  57. 'os.name': [replayRecord.os?.name ?? 'Other'],
  58. platform: [replayRecord.platform ?? 'javascript'],
  59. releases: replayRecord.releases ?? ['1.0.0', '2.0.0'],
  60. 'sdk.name': [replayRecord.sdk?.name ?? 'sentry.javascript.browser'],
  61. 'sdk.version': [replayRecord.sdk?.version ?? '7.1.1'],
  62. 'user.ip': [replayRecord.user?.ip ?? '127.0.0.1'],
  63. },
  64. };
  65. }