From 51382100dfb5144f893282dd72c4d6e9014db334 Mon Sep 17 00:00:00 2001 From: William Mak Date: Wed, 14 Apr 2021 10:35:56 -0400 Subject: [PATCH] feat(sdk): Add a timeOrigin.mode tag - This is so we can track how often we're changing timeOrigin to get a better calculation --- src/sentry/static/sentry/app/bootstrap/initializeSdk.tsx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/sentry/static/sentry/app/bootstrap/initializeSdk.tsx b/src/sentry/static/sentry/app/bootstrap/initializeSdk.tsx index 60e589bcfb23fd..caa8fd3f95d6bb 100644 --- a/src/sentry/static/sentry/app/bootstrap/initializeSdk.tsx +++ b/src/sentry/static/sentry/app/bootstrap/initializeSdk.tsx @@ -3,6 +3,7 @@ import {ExtraErrorData} from '@sentry/integrations'; import * as Sentry from '@sentry/react'; import SentryRRWeb from '@sentry/rrweb'; import {Integrations} from '@sentry/tracing'; +import {_browserPerformanceTimeOriginMode} from '@sentry/utils'; import {DISABLE_RR_WEB, SPA_DSN} from 'app/constants'; import {Config} from 'app/types'; @@ -79,6 +80,13 @@ export function initializeSdk(config: Config, {routes}: {routes?: Function} = {} tracesSampleRate, }); + // Track timeOrigin Selection by the SDK to see if it improves transaction durations + Sentry.addGlobalEventProcessor((event: Sentry.Event, _hint?: Sentry.EventHint) => { + event.tags = event.tags || {}; + event.tags['timeOrigin.mode'] = _browserPerformanceTimeOriginMode; + return event; + }); + if (userIdentity) { Sentry.setUser(userIdentity); }