utils.tsx 553 B

12345678910111213141516171819
  1. import type {EventTransaction} from 'sentry/types/event';
  2. export function getProfileMeta(event: EventTransaction | null) {
  3. const profileId = event?.contexts?.profile?.profile_id;
  4. if (profileId) {
  5. return profileId;
  6. }
  7. const profilerId = event?.contexts?.profile?.profiler_id;
  8. if (profilerId) {
  9. const start = new Date(event.startTimestamp * 1000);
  10. const end = new Date(event.endTimestamp * 1000);
  11. return {
  12. profiler_id: profilerId,
  13. start: start.toISOString(),
  14. end: end.toISOString(),
  15. };
  16. }
  17. return null;
  18. }