@sentry/browser 10.53.0 → 10.54.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/npm/cjs/dev/client.js +15 -54
- package/build/npm/cjs/dev/client.js.map +1 -1
- package/build/npm/cjs/dev/debug-build.js +0 -5
- package/build/npm/cjs/dev/debug-build.js.map +1 -1
- package/build/npm/cjs/dev/diagnose-sdk.js +15 -37
- package/build/npm/cjs/dev/diagnose-sdk.js.map +1 -1
- package/build/npm/cjs/dev/eventbuilder.js +59 -217
- package/build/npm/cjs/dev/eventbuilder.js.map +1 -1
- package/build/npm/cjs/dev/feedbackAsync.js +1 -5
- package/build/npm/cjs/dev/feedbackAsync.js.map +1 -1
- package/build/npm/cjs/dev/feedbackSync.js +1 -2
- package/build/npm/cjs/dev/feedbackSync.js.map +1 -1
- package/build/npm/cjs/dev/helpers.js +24 -102
- package/build/npm/cjs/dev/helpers.js.map +1 -1
- package/build/npm/cjs/dev/index.js +2 -0
- package/build/npm/cjs/dev/index.js.map +1 -1
- package/build/npm/cjs/dev/integrations/breadcrumbs.js +52 -134
- package/build/npm/cjs/dev/integrations/breadcrumbs.js.map +1 -1
- package/build/npm/cjs/dev/integrations/browserapierrors.js +45 -111
- package/build/npm/cjs/dev/integrations/browserapierrors.js.map +1 -1
- package/build/npm/cjs/dev/integrations/browsersession.js +7 -35
- package/build/npm/cjs/dev/integrations/browsersession.js.map +1 -1
- package/build/npm/cjs/dev/integrations/contextlines.js +9 -45
- package/build/npm/cjs/dev/integrations/contextlines.js.map +1 -1
- package/build/npm/cjs/dev/integrations/culturecontext.js +11 -36
- package/build/npm/cjs/dev/integrations/culturecontext.js.map +1 -1
- package/build/npm/cjs/dev/integrations/featureFlags/growthbook/integration.js +1 -22
- package/build/npm/cjs/dev/integrations/featureFlags/growthbook/integration.js.map +1 -1
- package/build/npm/cjs/dev/integrations/featureFlags/launchdarkly/integration.js +6 -31
- package/build/npm/cjs/dev/integrations/featureFlags/launchdarkly/integration.js.map +1 -1
- package/build/npm/cjs/dev/integrations/featureFlags/openfeature/integration.js +6 -12
- package/build/npm/cjs/dev/integrations/featureFlags/openfeature/integration.js.map +1 -1
- package/build/npm/cjs/dev/integrations/featureFlags/statsig/integration.js +5 -30
- package/build/npm/cjs/dev/integrations/featureFlags/statsig/integration.js.map +1 -1
- package/build/npm/cjs/dev/integrations/featureFlags/unleash/integration.js +10 -47
- package/build/npm/cjs/dev/integrations/featureFlags/unleash/integration.js.map +1 -1
- package/build/npm/cjs/dev/integrations/fetchStreamPerformance.js +60 -0
- package/build/npm/cjs/dev/integrations/fetchStreamPerformance.js.map +1 -0
- package/build/npm/cjs/dev/integrations/globalhandlers.js +38 -99
- package/build/npm/cjs/dev/integrations/globalhandlers.js.map +1 -1
- package/build/npm/cjs/dev/integrations/graphqlClient.js +31 -119
- package/build/npm/cjs/dev/integrations/graphqlClient.js.map +1 -1
- package/build/npm/cjs/dev/integrations/httpclient.js +43 -203
- package/build/npm/cjs/dev/integrations/httpclient.js.map +1 -1
- package/build/npm/cjs/dev/integrations/httpcontext.js +7 -17
- package/build/npm/cjs/dev/integrations/httpcontext.js.map +1 -1
- package/build/npm/cjs/dev/integrations/linkederrors.js +7 -15
- package/build/npm/cjs/dev/integrations/linkederrors.js.map +1 -1
- package/build/npm/cjs/dev/integrations/reportingobserver.js +19 -44
- package/build/npm/cjs/dev/integrations/reportingobserver.js.map +1 -1
- package/build/npm/cjs/dev/integrations/spanstreaming.js +11 -29
- package/build/npm/cjs/dev/integrations/spanstreaming.js.map +1 -1
- package/build/npm/cjs/dev/integrations/spotlight.js +17 -30
- package/build/npm/cjs/dev/integrations/spotlight.js.map +1 -1
- package/build/npm/cjs/dev/integrations/view-hierarchy.js +19 -46
- package/build/npm/cjs/dev/integrations/view-hierarchy.js.map +1 -1
- package/build/npm/cjs/dev/integrations/webWorker.js +40 -211
- package/build/npm/cjs/dev/integrations/webWorker.js.map +1 -1
- package/build/npm/cjs/dev/profiling/UIProfiler.js +87 -190
- package/build/npm/cjs/dev/profiling/UIProfiler.js.map +1 -1
- package/build/npm/cjs/dev/profiling/index.js +9 -30
- package/build/npm/cjs/dev/profiling/index.js.map +1 -1
- package/build/npm/cjs/dev/profiling/integration.js +30 -64
- package/build/npm/cjs/dev/profiling/integration.js.map +1 -1
- package/build/npm/cjs/dev/profiling/startProfileForSpan.js +28 -84
- package/build/npm/cjs/dev/profiling/startProfileForSpan.js.map +1 -1
- package/build/npm/cjs/dev/profiling/utils.js +131 -398
- package/build/npm/cjs/dev/profiling/utils.js.map +1 -1
- package/build/npm/cjs/dev/report-dialog.js +10 -25
- package/build/npm/cjs/dev/report-dialog.js.map +1 -1
- package/build/npm/cjs/dev/sdk.js +8 -76
- package/build/npm/cjs/dev/sdk.js.map +1 -1
- package/build/npm/cjs/dev/stack-parsers.js +42 -126
- package/build/npm/cjs/dev/stack-parsers.js.map +1 -1
- package/build/npm/cjs/dev/tracing/backgroundtab.js +4 -16
- package/build/npm/cjs/dev/tracing/backgroundtab.js.map +1 -1
- package/build/npm/cjs/dev/tracing/browserTracingIntegration.js +102 -291
- package/build/npm/cjs/dev/tracing/browserTracingIntegration.js.map +1 -1
- package/build/npm/cjs/dev/tracing/linkedTraces.js +25 -116
- package/build/npm/cjs/dev/tracing/linkedTraces.js.map +1 -1
- package/build/npm/cjs/dev/tracing/reportPageLoaded.js +1 -9
- package/build/npm/cjs/dev/tracing/reportPageLoaded.js.map +1 -1
- package/build/npm/cjs/dev/tracing/request.js +58 -223
- package/build/npm/cjs/dev/tracing/request.js.map +1 -1
- package/build/npm/cjs/dev/tracing/setActiveSpan.js +1 -48
- package/build/npm/cjs/dev/tracing/setActiveSpan.js.map +1 -1
- package/build/npm/cjs/dev/tracing/utils.js +4 -27
- package/build/npm/cjs/dev/tracing/utils.js.map +1 -1
- package/build/npm/cjs/dev/transports/fetch.js +10 -23
- package/build/npm/cjs/dev/transports/fetch.js.map +1 -1
- package/build/npm/cjs/dev/transports/offline.js +27 -84
- package/build/npm/cjs/dev/transports/offline.js.map +1 -1
- package/build/npm/cjs/dev/userfeedback.js +12 -22
- package/build/npm/cjs/dev/userfeedback.js.map +1 -1
- package/build/npm/cjs/dev/utils/detectBrowserExtension.js +5 -26
- package/build/npm/cjs/dev/utils/detectBrowserExtension.js.map +1 -1
- package/build/npm/cjs/dev/utils/lazyLoadIntegration.js +40 -75
- package/build/npm/cjs/dev/utils/lazyLoadIntegration.js.map +1 -1
- package/build/npm/cjs/prod/client.js +15 -54
- package/build/npm/cjs/prod/client.js.map +1 -1
- package/build/npm/cjs/prod/debug-build.js +0 -5
- package/build/npm/cjs/prod/debug-build.js.map +1 -1
- package/build/npm/cjs/prod/diagnose-sdk.js +15 -37
- package/build/npm/cjs/prod/diagnose-sdk.js.map +1 -1
- package/build/npm/cjs/prod/eventbuilder.js +59 -217
- package/build/npm/cjs/prod/eventbuilder.js.map +1 -1
- package/build/npm/cjs/prod/feedbackAsync.js +1 -5
- package/build/npm/cjs/prod/feedbackAsync.js.map +1 -1
- package/build/npm/cjs/prod/feedbackSync.js +1 -2
- package/build/npm/cjs/prod/feedbackSync.js.map +1 -1
- package/build/npm/cjs/prod/helpers.js +24 -102
- package/build/npm/cjs/prod/helpers.js.map +1 -1
- package/build/npm/cjs/prod/index.js +2 -0
- package/build/npm/cjs/prod/index.js.map +1 -1
- package/build/npm/cjs/prod/integrations/breadcrumbs.js +52 -134
- package/build/npm/cjs/prod/integrations/breadcrumbs.js.map +1 -1
- package/build/npm/cjs/prod/integrations/browserapierrors.js +45 -111
- package/build/npm/cjs/prod/integrations/browserapierrors.js.map +1 -1
- package/build/npm/cjs/prod/integrations/browsersession.js +7 -35
- package/build/npm/cjs/prod/integrations/browsersession.js.map +1 -1
- package/build/npm/cjs/prod/integrations/contextlines.js +9 -45
- package/build/npm/cjs/prod/integrations/contextlines.js.map +1 -1
- package/build/npm/cjs/prod/integrations/culturecontext.js +11 -36
- package/build/npm/cjs/prod/integrations/culturecontext.js.map +1 -1
- package/build/npm/cjs/prod/integrations/featureFlags/growthbook/integration.js +1 -22
- package/build/npm/cjs/prod/integrations/featureFlags/growthbook/integration.js.map +1 -1
- package/build/npm/cjs/prod/integrations/featureFlags/launchdarkly/integration.js +6 -31
- package/build/npm/cjs/prod/integrations/featureFlags/launchdarkly/integration.js.map +1 -1
- package/build/npm/cjs/prod/integrations/featureFlags/openfeature/integration.js +6 -12
- package/build/npm/cjs/prod/integrations/featureFlags/openfeature/integration.js.map +1 -1
- package/build/npm/cjs/prod/integrations/featureFlags/statsig/integration.js +5 -30
- package/build/npm/cjs/prod/integrations/featureFlags/statsig/integration.js.map +1 -1
- package/build/npm/cjs/prod/integrations/featureFlags/unleash/integration.js +10 -47
- package/build/npm/cjs/prod/integrations/featureFlags/unleash/integration.js.map +1 -1
- package/build/npm/cjs/prod/integrations/fetchStreamPerformance.js +60 -0
- package/build/npm/cjs/prod/integrations/fetchStreamPerformance.js.map +1 -0
- package/build/npm/cjs/prod/integrations/globalhandlers.js +38 -99
- package/build/npm/cjs/prod/integrations/globalhandlers.js.map +1 -1
- package/build/npm/cjs/prod/integrations/graphqlClient.js +31 -119
- package/build/npm/cjs/prod/integrations/graphqlClient.js.map +1 -1
- package/build/npm/cjs/prod/integrations/httpclient.js +43 -203
- package/build/npm/cjs/prod/integrations/httpclient.js.map +1 -1
- package/build/npm/cjs/prod/integrations/httpcontext.js +7 -17
- package/build/npm/cjs/prod/integrations/httpcontext.js.map +1 -1
- package/build/npm/cjs/prod/integrations/linkederrors.js +7 -15
- package/build/npm/cjs/prod/integrations/linkederrors.js.map +1 -1
- package/build/npm/cjs/prod/integrations/reportingobserver.js +19 -44
- package/build/npm/cjs/prod/integrations/reportingobserver.js.map +1 -1
- package/build/npm/cjs/prod/integrations/spanstreaming.js +11 -29
- package/build/npm/cjs/prod/integrations/spanstreaming.js.map +1 -1
- package/build/npm/cjs/prod/integrations/spotlight.js +17 -30
- package/build/npm/cjs/prod/integrations/spotlight.js.map +1 -1
- package/build/npm/cjs/prod/integrations/view-hierarchy.js +19 -46
- package/build/npm/cjs/prod/integrations/view-hierarchy.js.map +1 -1
- package/build/npm/cjs/prod/integrations/webWorker.js +40 -211
- package/build/npm/cjs/prod/integrations/webWorker.js.map +1 -1
- package/build/npm/cjs/prod/profiling/UIProfiler.js +87 -190
- package/build/npm/cjs/prod/profiling/UIProfiler.js.map +1 -1
- package/build/npm/cjs/prod/profiling/index.js +9 -30
- package/build/npm/cjs/prod/profiling/index.js.map +1 -1
- package/build/npm/cjs/prod/profiling/integration.js +30 -64
- package/build/npm/cjs/prod/profiling/integration.js.map +1 -1
- package/build/npm/cjs/prod/profiling/startProfileForSpan.js +28 -84
- package/build/npm/cjs/prod/profiling/startProfileForSpan.js.map +1 -1
- package/build/npm/cjs/prod/profiling/utils.js +131 -398
- package/build/npm/cjs/prod/profiling/utils.js.map +1 -1
- package/build/npm/cjs/prod/report-dialog.js +10 -25
- package/build/npm/cjs/prod/report-dialog.js.map +1 -1
- package/build/npm/cjs/prod/sdk.js +5 -73
- package/build/npm/cjs/prod/sdk.js.map +1 -1
- package/build/npm/cjs/prod/stack-parsers.js +42 -126
- package/build/npm/cjs/prod/stack-parsers.js.map +1 -1
- package/build/npm/cjs/prod/tracing/backgroundtab.js +4 -16
- package/build/npm/cjs/prod/tracing/backgroundtab.js.map +1 -1
- package/build/npm/cjs/prod/tracing/browserTracingIntegration.js +102 -291
- package/build/npm/cjs/prod/tracing/browserTracingIntegration.js.map +1 -1
- package/build/npm/cjs/prod/tracing/linkedTraces.js +25 -117
- package/build/npm/cjs/prod/tracing/linkedTraces.js.map +1 -1
- package/build/npm/cjs/prod/tracing/reportPageLoaded.js +1 -9
- package/build/npm/cjs/prod/tracing/reportPageLoaded.js.map +1 -1
- package/build/npm/cjs/prod/tracing/request.js +58 -223
- package/build/npm/cjs/prod/tracing/request.js.map +1 -1
- package/build/npm/cjs/prod/tracing/setActiveSpan.js +1 -48
- package/build/npm/cjs/prod/tracing/setActiveSpan.js.map +1 -1
- package/build/npm/cjs/prod/tracing/utils.js +4 -27
- package/build/npm/cjs/prod/tracing/utils.js.map +1 -1
- package/build/npm/cjs/prod/transports/fetch.js +10 -23
- package/build/npm/cjs/prod/transports/fetch.js.map +1 -1
- package/build/npm/cjs/prod/transports/offline.js +27 -84
- package/build/npm/cjs/prod/transports/offline.js.map +1 -1
- package/build/npm/cjs/prod/userfeedback.js +12 -22
- package/build/npm/cjs/prod/userfeedback.js.map +1 -1
- package/build/npm/cjs/prod/utils/detectBrowserExtension.js +5 -26
- package/build/npm/cjs/prod/utils/detectBrowserExtension.js.map +1 -1
- package/build/npm/cjs/prod/utils/lazyLoadIntegration.js +40 -75
- package/build/npm/cjs/prod/utils/lazyLoadIntegration.js.map +1 -1
- package/build/npm/esm/dev/client.js +15 -54
- package/build/npm/esm/dev/client.js.map +1 -1
- package/build/npm/esm/dev/debug-build.js +0 -5
- package/build/npm/esm/dev/debug-build.js.map +1 -1
- package/build/npm/esm/dev/diagnose-sdk.js +15 -37
- package/build/npm/esm/dev/diagnose-sdk.js.map +1 -1
- package/build/npm/esm/dev/eventbuilder.js +59 -217
- package/build/npm/esm/dev/eventbuilder.js.map +1 -1
- package/build/npm/esm/dev/feedbackAsync.js +1 -5
- package/build/npm/esm/dev/feedbackAsync.js.map +1 -1
- package/build/npm/esm/dev/feedbackSync.js +1 -2
- package/build/npm/esm/dev/feedbackSync.js.map +1 -1
- package/build/npm/esm/dev/helpers.js +24 -102
- package/build/npm/esm/dev/helpers.js.map +1 -1
- package/build/npm/esm/dev/index.js +1 -0
- package/build/npm/esm/dev/index.js.map +1 -1
- package/build/npm/esm/dev/integrations/breadcrumbs.js +52 -134
- package/build/npm/esm/dev/integrations/breadcrumbs.js.map +1 -1
- package/build/npm/esm/dev/integrations/browserapierrors.js +45 -111
- package/build/npm/esm/dev/integrations/browserapierrors.js.map +1 -1
- package/build/npm/esm/dev/integrations/browsersession.js +7 -35
- package/build/npm/esm/dev/integrations/browsersession.js.map +1 -1
- package/build/npm/esm/dev/integrations/contextlines.js +9 -45
- package/build/npm/esm/dev/integrations/contextlines.js.map +1 -1
- package/build/npm/esm/dev/integrations/culturecontext.js +11 -36
- package/build/npm/esm/dev/integrations/culturecontext.js.map +1 -1
- package/build/npm/esm/dev/integrations/featureFlags/growthbook/integration.js +1 -22
- package/build/npm/esm/dev/integrations/featureFlags/growthbook/integration.js.map +1 -1
- package/build/npm/esm/dev/integrations/featureFlags/launchdarkly/integration.js +6 -31
- package/build/npm/esm/dev/integrations/featureFlags/launchdarkly/integration.js.map +1 -1
- package/build/npm/esm/dev/integrations/featureFlags/openfeature/integration.js +6 -12
- package/build/npm/esm/dev/integrations/featureFlags/openfeature/integration.js.map +1 -1
- package/build/npm/esm/dev/integrations/featureFlags/statsig/integration.js +5 -30
- package/build/npm/esm/dev/integrations/featureFlags/statsig/integration.js.map +1 -1
- package/build/npm/esm/dev/integrations/featureFlags/unleash/integration.js +10 -47
- package/build/npm/esm/dev/integrations/featureFlags/unleash/integration.js.map +1 -1
- package/build/npm/esm/dev/integrations/fetchStreamPerformance.js +58 -0
- package/build/npm/esm/dev/integrations/fetchStreamPerformance.js.map +1 -0
- package/build/npm/esm/dev/integrations/globalhandlers.js +38 -99
- package/build/npm/esm/dev/integrations/globalhandlers.js.map +1 -1
- package/build/npm/esm/dev/integrations/graphqlClient.js +31 -119
- package/build/npm/esm/dev/integrations/graphqlClient.js.map +1 -1
- package/build/npm/esm/dev/integrations/httpclient.js +43 -203
- package/build/npm/esm/dev/integrations/httpclient.js.map +1 -1
- package/build/npm/esm/dev/integrations/httpcontext.js +7 -17
- package/build/npm/esm/dev/integrations/httpcontext.js.map +1 -1
- package/build/npm/esm/dev/integrations/linkederrors.js +7 -15
- package/build/npm/esm/dev/integrations/linkederrors.js.map +1 -1
- package/build/npm/esm/dev/integrations/reportingobserver.js +19 -44
- package/build/npm/esm/dev/integrations/reportingobserver.js.map +1 -1
- package/build/npm/esm/dev/integrations/spanstreaming.js +11 -29
- package/build/npm/esm/dev/integrations/spanstreaming.js.map +1 -1
- package/build/npm/esm/dev/integrations/spotlight.js +17 -30
- package/build/npm/esm/dev/integrations/spotlight.js.map +1 -1
- package/build/npm/esm/dev/integrations/view-hierarchy.js +19 -46
- package/build/npm/esm/dev/integrations/view-hierarchy.js.map +1 -1
- package/build/npm/esm/dev/integrations/webWorker.js +40 -211
- package/build/npm/esm/dev/integrations/webWorker.js.map +1 -1
- package/build/npm/esm/dev/package.json +1 -1
- package/build/npm/esm/dev/profiling/UIProfiler.js +87 -190
- package/build/npm/esm/dev/profiling/UIProfiler.js.map +1 -1
- package/build/npm/esm/dev/profiling/index.js +9 -30
- package/build/npm/esm/dev/profiling/index.js.map +1 -1
- package/build/npm/esm/dev/profiling/integration.js +30 -64
- package/build/npm/esm/dev/profiling/integration.js.map +1 -1
- package/build/npm/esm/dev/profiling/startProfileForSpan.js +28 -84
- package/build/npm/esm/dev/profiling/startProfileForSpan.js.map +1 -1
- package/build/npm/esm/dev/profiling/utils.js +131 -398
- package/build/npm/esm/dev/profiling/utils.js.map +1 -1
- package/build/npm/esm/dev/report-dialog.js +10 -25
- package/build/npm/esm/dev/report-dialog.js.map +1 -1
- package/build/npm/esm/dev/sdk.js +8 -76
- package/build/npm/esm/dev/sdk.js.map +1 -1
- package/build/npm/esm/dev/stack-parsers.js +42 -126
- package/build/npm/esm/dev/stack-parsers.js.map +1 -1
- package/build/npm/esm/dev/tracing/backgroundtab.js +4 -16
- package/build/npm/esm/dev/tracing/backgroundtab.js.map +1 -1
- package/build/npm/esm/dev/tracing/browserTracingIntegration.js +102 -291
- package/build/npm/esm/dev/tracing/browserTracingIntegration.js.map +1 -1
- package/build/npm/esm/dev/tracing/linkedTraces.js +25 -116
- package/build/npm/esm/dev/tracing/linkedTraces.js.map +1 -1
- package/build/npm/esm/dev/tracing/reportPageLoaded.js +1 -9
- package/build/npm/esm/dev/tracing/reportPageLoaded.js.map +1 -1
- package/build/npm/esm/dev/tracing/request.js +59 -224
- package/build/npm/esm/dev/tracing/request.js.map +1 -1
- package/build/npm/esm/dev/tracing/setActiveSpan.js +1 -48
- package/build/npm/esm/dev/tracing/setActiveSpan.js.map +1 -1
- package/build/npm/esm/dev/tracing/utils.js +4 -27
- package/build/npm/esm/dev/tracing/utils.js.map +1 -1
- package/build/npm/esm/dev/transports/fetch.js +10 -23
- package/build/npm/esm/dev/transports/fetch.js.map +1 -1
- package/build/npm/esm/dev/transports/offline.js +27 -84
- package/build/npm/esm/dev/transports/offline.js.map +1 -1
- package/build/npm/esm/dev/userfeedback.js +12 -22
- package/build/npm/esm/dev/userfeedback.js.map +1 -1
- package/build/npm/esm/dev/utils/detectBrowserExtension.js +5 -26
- package/build/npm/esm/dev/utils/detectBrowserExtension.js.map +1 -1
- package/build/npm/esm/dev/utils/lazyLoadIntegration.js +40 -75
- package/build/npm/esm/dev/utils/lazyLoadIntegration.js.map +1 -1
- package/build/npm/esm/prod/client.js +15 -54
- package/build/npm/esm/prod/client.js.map +1 -1
- package/build/npm/esm/prod/debug-build.js +0 -5
- package/build/npm/esm/prod/debug-build.js.map +1 -1
- package/build/npm/esm/prod/diagnose-sdk.js +15 -37
- package/build/npm/esm/prod/diagnose-sdk.js.map +1 -1
- package/build/npm/esm/prod/eventbuilder.js +59 -217
- package/build/npm/esm/prod/eventbuilder.js.map +1 -1
- package/build/npm/esm/prod/feedbackAsync.js +1 -5
- package/build/npm/esm/prod/feedbackAsync.js.map +1 -1
- package/build/npm/esm/prod/feedbackSync.js +1 -2
- package/build/npm/esm/prod/feedbackSync.js.map +1 -1
- package/build/npm/esm/prod/helpers.js +24 -102
- package/build/npm/esm/prod/helpers.js.map +1 -1
- package/build/npm/esm/prod/index.js +1 -0
- package/build/npm/esm/prod/index.js.map +1 -1
- package/build/npm/esm/prod/integrations/breadcrumbs.js +52 -134
- package/build/npm/esm/prod/integrations/breadcrumbs.js.map +1 -1
- package/build/npm/esm/prod/integrations/browserapierrors.js +45 -111
- package/build/npm/esm/prod/integrations/browserapierrors.js.map +1 -1
- package/build/npm/esm/prod/integrations/browsersession.js +7 -35
- package/build/npm/esm/prod/integrations/browsersession.js.map +1 -1
- package/build/npm/esm/prod/integrations/contextlines.js +9 -45
- package/build/npm/esm/prod/integrations/contextlines.js.map +1 -1
- package/build/npm/esm/prod/integrations/culturecontext.js +11 -36
- package/build/npm/esm/prod/integrations/culturecontext.js.map +1 -1
- package/build/npm/esm/prod/integrations/featureFlags/growthbook/integration.js +1 -22
- package/build/npm/esm/prod/integrations/featureFlags/growthbook/integration.js.map +1 -1
- package/build/npm/esm/prod/integrations/featureFlags/launchdarkly/integration.js +6 -31
- package/build/npm/esm/prod/integrations/featureFlags/launchdarkly/integration.js.map +1 -1
- package/build/npm/esm/prod/integrations/featureFlags/openfeature/integration.js +6 -12
- package/build/npm/esm/prod/integrations/featureFlags/openfeature/integration.js.map +1 -1
- package/build/npm/esm/prod/integrations/featureFlags/statsig/integration.js +5 -30
- package/build/npm/esm/prod/integrations/featureFlags/statsig/integration.js.map +1 -1
- package/build/npm/esm/prod/integrations/featureFlags/unleash/integration.js +10 -47
- package/build/npm/esm/prod/integrations/featureFlags/unleash/integration.js.map +1 -1
- package/build/npm/esm/prod/integrations/fetchStreamPerformance.js +58 -0
- package/build/npm/esm/prod/integrations/fetchStreamPerformance.js.map +1 -0
- package/build/npm/esm/prod/integrations/globalhandlers.js +38 -99
- package/build/npm/esm/prod/integrations/globalhandlers.js.map +1 -1
- package/build/npm/esm/prod/integrations/graphqlClient.js +31 -119
- package/build/npm/esm/prod/integrations/graphqlClient.js.map +1 -1
- package/build/npm/esm/prod/integrations/httpclient.js +43 -203
- package/build/npm/esm/prod/integrations/httpclient.js.map +1 -1
- package/build/npm/esm/prod/integrations/httpcontext.js +7 -17
- package/build/npm/esm/prod/integrations/httpcontext.js.map +1 -1
- package/build/npm/esm/prod/integrations/linkederrors.js +7 -15
- package/build/npm/esm/prod/integrations/linkederrors.js.map +1 -1
- package/build/npm/esm/prod/integrations/reportingobserver.js +19 -44
- package/build/npm/esm/prod/integrations/reportingobserver.js.map +1 -1
- package/build/npm/esm/prod/integrations/spanstreaming.js +11 -29
- package/build/npm/esm/prod/integrations/spanstreaming.js.map +1 -1
- package/build/npm/esm/prod/integrations/spotlight.js +17 -30
- package/build/npm/esm/prod/integrations/spotlight.js.map +1 -1
- package/build/npm/esm/prod/integrations/view-hierarchy.js +19 -46
- package/build/npm/esm/prod/integrations/view-hierarchy.js.map +1 -1
- package/build/npm/esm/prod/integrations/webWorker.js +40 -211
- package/build/npm/esm/prod/integrations/webWorker.js.map +1 -1
- package/build/npm/esm/prod/package.json +1 -1
- package/build/npm/esm/prod/profiling/UIProfiler.js +87 -190
- package/build/npm/esm/prod/profiling/UIProfiler.js.map +1 -1
- package/build/npm/esm/prod/profiling/index.js +9 -30
- package/build/npm/esm/prod/profiling/index.js.map +1 -1
- package/build/npm/esm/prod/profiling/integration.js +30 -64
- package/build/npm/esm/prod/profiling/integration.js.map +1 -1
- package/build/npm/esm/prod/profiling/startProfileForSpan.js +28 -84
- package/build/npm/esm/prod/profiling/startProfileForSpan.js.map +1 -1
- package/build/npm/esm/prod/profiling/utils.js +131 -398
- package/build/npm/esm/prod/profiling/utils.js.map +1 -1
- package/build/npm/esm/prod/report-dialog.js +10 -25
- package/build/npm/esm/prod/report-dialog.js.map +1 -1
- package/build/npm/esm/prod/sdk.js +5 -73
- package/build/npm/esm/prod/sdk.js.map +1 -1
- package/build/npm/esm/prod/stack-parsers.js +42 -126
- package/build/npm/esm/prod/stack-parsers.js.map +1 -1
- package/build/npm/esm/prod/tracing/backgroundtab.js +4 -16
- package/build/npm/esm/prod/tracing/backgroundtab.js.map +1 -1
- package/build/npm/esm/prod/tracing/browserTracingIntegration.js +102 -291
- package/build/npm/esm/prod/tracing/browserTracingIntegration.js.map +1 -1
- package/build/npm/esm/prod/tracing/linkedTraces.js +25 -117
- package/build/npm/esm/prod/tracing/linkedTraces.js.map +1 -1
- package/build/npm/esm/prod/tracing/reportPageLoaded.js +1 -9
- package/build/npm/esm/prod/tracing/reportPageLoaded.js.map +1 -1
- package/build/npm/esm/prod/tracing/request.js +59 -224
- package/build/npm/esm/prod/tracing/request.js.map +1 -1
- package/build/npm/esm/prod/tracing/setActiveSpan.js +1 -48
- package/build/npm/esm/prod/tracing/setActiveSpan.js.map +1 -1
- package/build/npm/esm/prod/tracing/utils.js +4 -27
- package/build/npm/esm/prod/tracing/utils.js.map +1 -1
- package/build/npm/esm/prod/transports/fetch.js +10 -23
- package/build/npm/esm/prod/transports/fetch.js.map +1 -1
- package/build/npm/esm/prod/transports/offline.js +27 -84
- package/build/npm/esm/prod/transports/offline.js.map +1 -1
- package/build/npm/esm/prod/userfeedback.js +12 -22
- package/build/npm/esm/prod/userfeedback.js.map +1 -1
- package/build/npm/esm/prod/utils/detectBrowserExtension.js +5 -26
- package/build/npm/esm/prod/utils/detectBrowserExtension.js.map +1 -1
- package/build/npm/esm/prod/utils/lazyLoadIntegration.js +40 -75
- package/build/npm/esm/prod/utils/lazyLoadIntegration.js.map +1 -1
- package/build/npm/types/eventbuilder.d.ts.map +1 -1
- package/build/npm/types/helpers.d.ts.map +1 -1
- package/build/npm/types/index.bundle.d.ts +2 -2
- package/build/npm/types/index.bundle.d.ts.map +1 -1
- package/build/npm/types/index.bundle.feedback.d.ts +2 -2
- package/build/npm/types/index.bundle.feedback.d.ts.map +1 -1
- package/build/npm/types/index.bundle.logs.metrics.d.ts +2 -2
- package/build/npm/types/index.bundle.logs.metrics.d.ts.map +1 -1
- package/build/npm/types/index.bundle.replay.d.ts +2 -2
- package/build/npm/types/index.bundle.replay.d.ts.map +1 -1
- package/build/npm/types/index.bundle.replay.feedback.d.ts +2 -2
- package/build/npm/types/index.bundle.replay.feedback.d.ts.map +1 -1
- package/build/npm/types/index.bundle.replay.logs.metrics.d.ts +2 -2
- package/build/npm/types/index.bundle.replay.logs.metrics.d.ts.map +1 -1
- package/build/npm/types/index.bundle.tracing.d.ts +1 -0
- package/build/npm/types/index.bundle.tracing.d.ts.map +1 -1
- package/build/npm/types/index.bundle.tracing.logs.metrics.d.ts +1 -0
- package/build/npm/types/index.bundle.tracing.logs.metrics.d.ts.map +1 -1
- package/build/npm/types/index.bundle.tracing.replay.d.ts +1 -0
- package/build/npm/types/index.bundle.tracing.replay.d.ts.map +1 -1
- package/build/npm/types/index.bundle.tracing.replay.feedback.d.ts +1 -0
- package/build/npm/types/index.bundle.tracing.replay.feedback.d.ts.map +1 -1
- package/build/npm/types/index.bundle.tracing.replay.feedback.logs.metrics.d.ts +1 -0
- package/build/npm/types/index.bundle.tracing.replay.feedback.logs.metrics.d.ts.map +1 -1
- package/build/npm/types/index.bundle.tracing.replay.logs.metrics.d.ts +1 -0
- package/build/npm/types/index.bundle.tracing.replay.logs.metrics.d.ts.map +1 -1
- package/build/npm/types/index.d.ts +1 -0
- package/build/npm/types/index.d.ts.map +1 -1
- package/build/npm/types/integrations/fetchStreamPerformance.d.ts +14 -0
- package/build/npm/types/integrations/fetchStreamPerformance.d.ts.map +1 -0
- package/build/npm/types/tracing/browserTracingIntegration.d.ts +3 -0
- package/build/npm/types/tracing/browserTracingIntegration.d.ts.map +1 -1
- package/build/npm/types/tracing/request.d.ts +3 -0
- package/build/npm/types/tracing/request.d.ts.map +1 -1
- package/build/npm/types-ts3.8/index.bundle.d.ts +2 -2
- package/build/npm/types-ts3.8/index.bundle.feedback.d.ts +2 -2
- package/build/npm/types-ts3.8/index.bundle.logs.metrics.d.ts +2 -2
- package/build/npm/types-ts3.8/index.bundle.replay.d.ts +2 -2
- package/build/npm/types-ts3.8/index.bundle.replay.feedback.d.ts +2 -2
- package/build/npm/types-ts3.8/index.bundle.replay.logs.metrics.d.ts +2 -2
- package/build/npm/types-ts3.8/index.bundle.tracing.d.ts +1 -0
- package/build/npm/types-ts3.8/index.bundle.tracing.logs.metrics.d.ts +1 -0
- package/build/npm/types-ts3.8/index.bundle.tracing.replay.d.ts +1 -0
- package/build/npm/types-ts3.8/index.bundle.tracing.replay.feedback.d.ts +1 -0
- package/build/npm/types-ts3.8/index.bundle.tracing.replay.feedback.logs.metrics.d.ts +1 -0
- package/build/npm/types-ts3.8/index.bundle.tracing.replay.logs.metrics.d.ts +1 -0
- package/build/npm/types-ts3.8/index.d.ts +1 -0
- package/build/npm/types-ts3.8/integrations/fetchStreamPerformance.d.ts +14 -0
- package/build/npm/types-ts3.8/tracing/browserTracingIntegration.d.ts +3 -0
- package/build/npm/types-ts3.8/tracing/request.d.ts +3 -0
- package/package.json +7 -7
|
@@ -3,262 +3,167 @@ import { DEBUG_BUILD } from '../debug-build.js';
|
|
|
3
3
|
import { WINDOW } from '../helpers.js';
|
|
4
4
|
|
|
5
5
|
const MS_TO_NS = 1e6;
|
|
6
|
-
|
|
7
|
-
// Checking if we are in Main or Worker thread: `self` (not `window`) is the `globalThis` in Web Workers and `importScripts` are only available in Web Workers
|
|
8
|
-
const isMainThread = 'window' in GLOBAL_OBJ && GLOBAL_OBJ.window === GLOBAL_OBJ && typeof importScripts === 'undefined';
|
|
9
|
-
|
|
10
|
-
// Setting ID to 0 as we cannot get an ID from Web Workers
|
|
6
|
+
const isMainThread = "window" in GLOBAL_OBJ && GLOBAL_OBJ.window === GLOBAL_OBJ && typeof importScripts === "undefined";
|
|
11
7
|
const PROFILER_THREAD_ID_STRING = String(0);
|
|
12
|
-
const PROFILER_THREAD_NAME = isMainThread ?
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
let
|
|
19
|
-
|
|
20
|
-
let OS_ARCH = '';
|
|
21
|
-
let OS_BROWSER = navigator?.userAgent || '';
|
|
22
|
-
let OS_MODEL = '';
|
|
23
|
-
const OS_LOCALE = navigator?.language || navigator?.languages?.[0] || '';
|
|
24
|
-
|
|
8
|
+
const PROFILER_THREAD_NAME = isMainThread ? "main" : "worker";
|
|
9
|
+
const navigator = WINDOW.navigator;
|
|
10
|
+
let OS_PLATFORM = "";
|
|
11
|
+
let OS_PLATFORM_VERSION = "";
|
|
12
|
+
let OS_ARCH = "";
|
|
13
|
+
let OS_BROWSER = navigator?.userAgent || "";
|
|
14
|
+
let OS_MODEL = "";
|
|
15
|
+
const OS_LOCALE = navigator?.language || navigator?.languages?.[0] || "";
|
|
25
16
|
function isUserAgentData(data) {
|
|
26
|
-
return typeof data ===
|
|
17
|
+
return typeof data === "object" && data !== null && "getHighEntropyValues" in data;
|
|
27
18
|
}
|
|
28
|
-
|
|
29
|
-
// @ts-expect-error userAgentData is not part of the navigator interface yet
|
|
30
19
|
const userAgentData = navigator?.userAgentData;
|
|
31
|
-
|
|
32
20
|
if (isUserAgentData(userAgentData)) {
|
|
33
|
-
userAgentData
|
|
34
|
-
|
|
35
|
-
.
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
const firstUa = ua.fullVersionList[ua.fullVersionList.length - 1];
|
|
44
|
-
OS_BROWSER = `${firstUa.brand} ${firstUa.version}`;
|
|
45
|
-
}
|
|
46
|
-
})
|
|
47
|
-
.catch(e => void 0);
|
|
21
|
+
userAgentData.getHighEntropyValues(["architecture", "model", "platform", "platformVersion", "fullVersionList"]).then((ua) => {
|
|
22
|
+
OS_PLATFORM = ua.platform || "";
|
|
23
|
+
OS_ARCH = ua.architecture || "";
|
|
24
|
+
OS_MODEL = ua.model || "";
|
|
25
|
+
OS_PLATFORM_VERSION = ua.platformVersion || "";
|
|
26
|
+
if (ua.fullVersionList?.length) {
|
|
27
|
+
const firstUa = ua.fullVersionList[ua.fullVersionList.length - 1];
|
|
28
|
+
OS_BROWSER = `${firstUa.brand} ${firstUa.version}`;
|
|
29
|
+
}
|
|
30
|
+
}).catch((e) => void 0);
|
|
48
31
|
}
|
|
49
|
-
|
|
50
32
|
function isProcessedJSSelfProfile(profile) {
|
|
51
|
-
return !(
|
|
33
|
+
return !("thread_metadata" in profile);
|
|
52
34
|
}
|
|
53
|
-
|
|
54
|
-
// Enriches the profile with threadId of the current thread.
|
|
55
|
-
// This is done in node as we seem to not be able to get the info from C native code.
|
|
56
|
-
/**
|
|
57
|
-
*
|
|
58
|
-
*/
|
|
59
35
|
function enrichWithThreadInformation(profile) {
|
|
60
36
|
if (!isProcessedJSSelfProfile(profile)) {
|
|
61
37
|
return profile;
|
|
62
38
|
}
|
|
63
|
-
|
|
64
39
|
return convertJSSelfProfileToSampledFormat(profile);
|
|
65
40
|
}
|
|
66
|
-
|
|
67
|
-
// Profile is marked as optional because it is deleted from the metadata
|
|
68
|
-
// by the integration before the event is processed by other integrations.
|
|
69
|
-
|
|
70
41
|
function getTraceId(event) {
|
|
71
42
|
const traceId = event.contexts?.trace?.trace_id;
|
|
72
|
-
|
|
73
|
-
// All profiles and transactions are rejected if this is the case and we want to
|
|
74
|
-
// warn users that this is happening if they enable debug flag
|
|
75
|
-
if (typeof traceId === 'string' && traceId.length !== 32) {
|
|
43
|
+
if (typeof traceId === "string" && traceId.length !== 32) {
|
|
76
44
|
if (DEBUG_BUILD) {
|
|
77
45
|
debug.log(`[Profiling] Invalid traceId: ${traceId} on profiled event`);
|
|
78
46
|
}
|
|
79
47
|
}
|
|
80
|
-
if (typeof traceId !==
|
|
81
|
-
return
|
|
48
|
+
if (typeof traceId !== "string") {
|
|
49
|
+
return "";
|
|
82
50
|
}
|
|
83
|
-
|
|
84
51
|
return traceId;
|
|
85
52
|
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
* @param event
|
|
90
|
-
* @param dsn
|
|
91
|
-
* @param metadata
|
|
92
|
-
* @param tunnel
|
|
93
|
-
* @returns {EventEnvelope | null}
|
|
94
|
-
*/
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* Creates a profiling event envelope from a Sentry event.
|
|
98
|
-
*/
|
|
99
|
-
function createProfilePayload(
|
|
100
|
-
profile_id,
|
|
101
|
-
start_timestamp,
|
|
102
|
-
processed_profile,
|
|
103
|
-
event,
|
|
104
|
-
) {
|
|
105
|
-
if (event.type !== 'transaction') {
|
|
106
|
-
// createProfilingEventEnvelope should only be called for transactions,
|
|
107
|
-
// we type guard this behavior with isProfiledTransactionEvent.
|
|
108
|
-
throw new TypeError('Profiling events may only be attached to transactions, this should never occur.');
|
|
53
|
+
function createProfilePayload(profile_id, start_timestamp, processed_profile, event) {
|
|
54
|
+
if (event.type !== "transaction") {
|
|
55
|
+
throw new TypeError("Profiling events may only be attached to transactions, this should never occur.");
|
|
109
56
|
}
|
|
110
|
-
|
|
111
|
-
if (processed_profile === undefined || processed_profile === null) {
|
|
57
|
+
if (processed_profile === void 0 || processed_profile === null) {
|
|
112
58
|
throw new TypeError(
|
|
113
|
-
`Cannot construct profiling event envelope without a valid profile. Got ${processed_profile} instead
|
|
59
|
+
`Cannot construct profiling event envelope without a valid profile. Got ${processed_profile} instead.`
|
|
114
60
|
);
|
|
115
61
|
}
|
|
116
|
-
|
|
117
62
|
const traceId = getTraceId(event);
|
|
118
63
|
const enrichedThreadProfile = enrichWithThreadInformation(processed_profile);
|
|
119
|
-
const transactionStartMs = start_timestamp
|
|
120
|
-
|
|
121
|
-
: typeof event.start_timestamp === 'number'
|
|
122
|
-
? event.start_timestamp * 1000
|
|
123
|
-
: timestampInSeconds() * 1000;
|
|
124
|
-
const transactionEndMs = typeof event.timestamp === 'number' ? event.timestamp * 1000 : timestampInSeconds() * 1000;
|
|
125
|
-
|
|
64
|
+
const transactionStartMs = start_timestamp ? start_timestamp : typeof event.start_timestamp === "number" ? event.start_timestamp * 1e3 : timestampInSeconds() * 1e3;
|
|
65
|
+
const transactionEndMs = typeof event.timestamp === "number" ? event.timestamp * 1e3 : timestampInSeconds() * 1e3;
|
|
126
66
|
const profile = {
|
|
127
67
|
event_id: profile_id,
|
|
128
68
|
timestamp: new Date(transactionStartMs).toISOString(),
|
|
129
|
-
platform:
|
|
130
|
-
version:
|
|
131
|
-
release: event.release ||
|
|
69
|
+
platform: "javascript",
|
|
70
|
+
version: "1",
|
|
71
|
+
release: event.release || "",
|
|
132
72
|
environment: event.environment || DEFAULT_ENVIRONMENT,
|
|
133
73
|
runtime: {
|
|
134
|
-
name:
|
|
135
|
-
version: WINDOW.navigator.userAgent
|
|
74
|
+
name: "javascript",
|
|
75
|
+
version: WINDOW.navigator.userAgent
|
|
136
76
|
},
|
|
137
77
|
os: {
|
|
138
78
|
name: OS_PLATFORM,
|
|
139
79
|
version: OS_PLATFORM_VERSION,
|
|
140
|
-
build_number: OS_BROWSER
|
|
80
|
+
build_number: OS_BROWSER
|
|
141
81
|
},
|
|
142
82
|
device: {
|
|
143
83
|
locale: OS_LOCALE,
|
|
144
84
|
model: OS_MODEL,
|
|
145
85
|
manufacturer: OS_BROWSER,
|
|
146
86
|
architecture: OS_ARCH,
|
|
147
|
-
is_emulator: false
|
|
87
|
+
is_emulator: false
|
|
148
88
|
},
|
|
149
89
|
debug_meta: {
|
|
150
|
-
images: applyDebugMetadata(processed_profile.resources)
|
|
90
|
+
images: applyDebugMetadata(processed_profile.resources)
|
|
151
91
|
},
|
|
152
92
|
profile: enrichedThreadProfile,
|
|
153
93
|
transactions: [
|
|
154
94
|
{
|
|
155
|
-
name: event.transaction ||
|
|
95
|
+
name: event.transaction || "",
|
|
156
96
|
id: event.event_id || uuid4(),
|
|
157
97
|
trace_id: traceId,
|
|
158
98
|
active_thread_id: PROFILER_THREAD_ID_STRING,
|
|
159
|
-
relative_start_ns:
|
|
160
|
-
relative_end_ns: ((transactionEndMs - transactionStartMs) * 1e6).toFixed(0)
|
|
161
|
-
}
|
|
162
|
-
]
|
|
99
|
+
relative_start_ns: "0",
|
|
100
|
+
relative_end_ns: ((transactionEndMs - transactionStartMs) * 1e6).toFixed(0)
|
|
101
|
+
}
|
|
102
|
+
]
|
|
163
103
|
};
|
|
164
|
-
|
|
165
104
|
return profile;
|
|
166
105
|
}
|
|
167
|
-
|
|
168
|
-
/**
|
|
169
|
-
* Create a profile chunk envelope item
|
|
170
|
-
*/
|
|
171
|
-
function createProfileChunkPayload(
|
|
172
|
-
jsSelfProfile,
|
|
173
|
-
client,
|
|
174
|
-
profilerId,
|
|
175
|
-
) {
|
|
176
|
-
// only == to catch null and undefined
|
|
106
|
+
function createProfileChunkPayload(jsSelfProfile, client, profilerId) {
|
|
177
107
|
if (jsSelfProfile == null) {
|
|
178
108
|
throw new TypeError(
|
|
179
|
-
`Cannot construct profiling event envelope without a valid profile. Got ${jsSelfProfile} instead
|
|
109
|
+
`Cannot construct profiling event envelope without a valid profile. Got ${jsSelfProfile} instead.`
|
|
180
110
|
);
|
|
181
111
|
}
|
|
182
|
-
|
|
183
112
|
const continuousProfile = convertToContinuousProfile(jsSelfProfile);
|
|
184
|
-
|
|
185
113
|
const options = client.getOptions();
|
|
186
114
|
const sdk = client.getSdkMetadata?.()?.sdk;
|
|
187
|
-
|
|
188
115
|
return {
|
|
189
116
|
chunk_id: uuid4(),
|
|
190
117
|
client_sdk: {
|
|
191
|
-
name: sdk?.name ??
|
|
192
|
-
version: sdk?.version ??
|
|
118
|
+
name: sdk?.name ?? "sentry.javascript.browser",
|
|
119
|
+
version: sdk?.version ?? "0.0.0"
|
|
193
120
|
},
|
|
194
121
|
profiler_id: profilerId || uuid4(),
|
|
195
|
-
platform:
|
|
196
|
-
version:
|
|
197
|
-
release: options.release ??
|
|
198
|
-
environment: options.environment ??
|
|
122
|
+
platform: "javascript",
|
|
123
|
+
version: "2",
|
|
124
|
+
release: options.release ?? "",
|
|
125
|
+
environment: options.environment ?? "production",
|
|
199
126
|
debug_meta: {
|
|
200
127
|
// function name obfuscation
|
|
201
|
-
images: applyDebugMetadata(jsSelfProfile.resources)
|
|
128
|
+
images: applyDebugMetadata(jsSelfProfile.resources)
|
|
202
129
|
},
|
|
203
|
-
profile: continuousProfile
|
|
130
|
+
profile: continuousProfile
|
|
204
131
|
};
|
|
205
132
|
}
|
|
206
|
-
|
|
207
|
-
/**
|
|
208
|
-
* Validate a profile chunk against the Sample Format V2 requirements.
|
|
209
|
-
* https://develop.sentry.dev/sdk/telemetry/profiles/sample-format-v2/
|
|
210
|
-
* - Presence of samples, stacks, frames
|
|
211
|
-
* - Required metadata fields
|
|
212
|
-
*/
|
|
213
133
|
function validateProfileChunk(chunk) {
|
|
214
134
|
try {
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
return { reason: 'chunk is not an object' };
|
|
135
|
+
if (!chunk || typeof chunk !== "object") {
|
|
136
|
+
return { reason: "chunk is not an object" };
|
|
218
137
|
}
|
|
219
|
-
|
|
220
|
-
// profiler_id and chunk_id must be 32 lowercase hex chars
|
|
221
|
-
const isHex32 = (val) => typeof val === 'string' && /^[a-f0-9]{32}$/.test(val);
|
|
138
|
+
const isHex32 = (val) => typeof val === "string" && /^[a-f0-9]{32}$/.test(val);
|
|
222
139
|
if (!isHex32(chunk.profiler_id)) {
|
|
223
|
-
return { reason:
|
|
140
|
+
return { reason: "missing or invalid profiler_id" };
|
|
224
141
|
}
|
|
225
142
|
if (!isHex32(chunk.chunk_id)) {
|
|
226
|
-
return { reason:
|
|
143
|
+
return { reason: "missing or invalid chunk_id" };
|
|
227
144
|
}
|
|
228
|
-
|
|
229
145
|
if (!chunk.client_sdk) {
|
|
230
|
-
return { reason:
|
|
146
|
+
return { reason: "missing client_sdk metadata" };
|
|
231
147
|
}
|
|
232
|
-
|
|
233
|
-
// Profile data must have frames, stacks, samples
|
|
234
|
-
const profile = chunk.profile ;
|
|
148
|
+
const profile = chunk.profile;
|
|
235
149
|
if (!profile) {
|
|
236
|
-
return { reason:
|
|
150
|
+
return { reason: "missing profile data" };
|
|
237
151
|
}
|
|
238
|
-
|
|
239
152
|
if (!Array.isArray(profile.frames) || !profile.frames.length) {
|
|
240
|
-
return { reason:
|
|
153
|
+
return { reason: "profile has no frames" };
|
|
241
154
|
}
|
|
242
155
|
if (!Array.isArray(profile.stacks) || !profile.stacks.length) {
|
|
243
|
-
return { reason:
|
|
156
|
+
return { reason: "profile has no stacks" };
|
|
244
157
|
}
|
|
245
158
|
if (!Array.isArray(profile.samples) || !profile.samples.length) {
|
|
246
|
-
return { reason:
|
|
159
|
+
return { reason: "profile has no samples" };
|
|
247
160
|
}
|
|
248
|
-
|
|
249
161
|
return { valid: true };
|
|
250
162
|
} catch (e) {
|
|
251
163
|
return { reason: `unknown validation error: ${e}` };
|
|
252
164
|
}
|
|
253
165
|
}
|
|
254
|
-
|
|
255
|
-
/**
|
|
256
|
-
* Convert from JSSelfProfile format to ContinuousThreadCpuProfile format.
|
|
257
|
-
*/
|
|
258
|
-
function convertToContinuousProfile(input
|
|
259
|
-
|
|
260
|
-
) {
|
|
261
|
-
// Frames map 1:1 by index; fill only when present to avoid sparse writes
|
|
166
|
+
function convertToContinuousProfile(input) {
|
|
262
167
|
const frames = [];
|
|
263
168
|
for (let i = 0; i < input.frames.length; i++) {
|
|
264
169
|
const frame = input.frames[i];
|
|
@@ -267,13 +172,11 @@ function convertToContinuousProfile(input
|
|
|
267
172
|
}
|
|
268
173
|
frames[i] = {
|
|
269
174
|
function: frame.name,
|
|
270
|
-
abs_path: typeof frame.resourceId ===
|
|
175
|
+
abs_path: typeof frame.resourceId === "number" ? input.resources[frame.resourceId] : void 0,
|
|
271
176
|
lineno: frame.line,
|
|
272
|
-
colno: frame.column
|
|
177
|
+
colno: frame.column
|
|
273
178
|
};
|
|
274
179
|
}
|
|
275
|
-
|
|
276
|
-
// Build stacks by following parent links, top->down order (root last)
|
|
277
180
|
const stacks = [];
|
|
278
181
|
for (let i = 0; i < input.stacks.length; i++) {
|
|
279
182
|
const stackHead = input.stacks[i];
|
|
@@ -284,431 +187,267 @@ function convertToContinuousProfile(input
|
|
|
284
187
|
let current = stackHead;
|
|
285
188
|
while (current) {
|
|
286
189
|
list.push(current.frameId);
|
|
287
|
-
current = current.parentId ===
|
|
190
|
+
current = current.parentId === void 0 ? void 0 : input.stacks[current.parentId];
|
|
288
191
|
}
|
|
289
192
|
stacks[i] = list;
|
|
290
193
|
}
|
|
291
|
-
|
|
292
|
-
// Align timestamps to SDK time origin to match span/event timelines
|
|
293
194
|
const perfOrigin = browserPerformanceTimeOrigin();
|
|
294
|
-
const origin = typeof performance.timeOrigin ===
|
|
195
|
+
const origin = typeof performance.timeOrigin === "number" ? performance.timeOrigin : perfOrigin || 0;
|
|
295
196
|
const adjustForOriginChange = origin - (perfOrigin || origin);
|
|
296
|
-
|
|
297
197
|
const samples = [];
|
|
298
198
|
for (let i = 0; i < input.samples.length; i++) {
|
|
299
199
|
const sample = input.samples[i];
|
|
300
200
|
if (!sample) {
|
|
301
201
|
continue;
|
|
302
202
|
}
|
|
303
|
-
|
|
304
|
-
const timestampSeconds = (origin + (sample.timestamp - adjustForOriginChange)) / 1000;
|
|
203
|
+
const timestampSeconds = (origin + (sample.timestamp - adjustForOriginChange)) / 1e3;
|
|
305
204
|
samples[i] = {
|
|
306
205
|
stack_id: sample.stackId ?? 0,
|
|
307
206
|
thread_id: PROFILER_THREAD_ID_STRING,
|
|
308
|
-
timestamp: timestampSeconds
|
|
207
|
+
timestamp: timestampSeconds
|
|
309
208
|
};
|
|
310
209
|
}
|
|
311
|
-
|
|
312
210
|
return {
|
|
313
211
|
frames,
|
|
314
212
|
stacks,
|
|
315
213
|
samples,
|
|
316
|
-
thread_metadata: { [PROFILER_THREAD_ID_STRING]: { name: PROFILER_THREAD_NAME } }
|
|
214
|
+
thread_metadata: { [PROFILER_THREAD_ID_STRING]: { name: PROFILER_THREAD_NAME } }
|
|
317
215
|
};
|
|
318
216
|
}
|
|
319
|
-
|
|
320
|
-
/*
|
|
321
|
-
See packages/browser-utils/src/browser/router.ts
|
|
322
|
-
*/
|
|
323
|
-
/**
|
|
324
|
-
*
|
|
325
|
-
*/
|
|
326
217
|
function isAutomatedPageLoadSpan(span) {
|
|
327
|
-
return spanToJSON(span).op ===
|
|
218
|
+
return spanToJSON(span).op === "pageload";
|
|
328
219
|
}
|
|
329
|
-
|
|
330
|
-
/**
|
|
331
|
-
* Converts a JSSelfProfile to a our sampled format.
|
|
332
|
-
* Does not currently perform stack indexing.
|
|
333
|
-
*/
|
|
334
220
|
function convertJSSelfProfileToSampledFormat(input) {
|
|
335
|
-
let EMPTY_STACK_ID =
|
|
221
|
+
let EMPTY_STACK_ID = void 0;
|
|
336
222
|
let STACK_ID = 0;
|
|
337
|
-
|
|
338
|
-
// Initialize the profile that we will fill with data
|
|
339
223
|
const profile = {
|
|
340
224
|
samples: [],
|
|
341
225
|
stacks: [],
|
|
342
226
|
frames: [],
|
|
343
227
|
thread_metadata: {
|
|
344
|
-
[PROFILER_THREAD_ID_STRING]: { name: PROFILER_THREAD_NAME }
|
|
345
|
-
}
|
|
228
|
+
[PROFILER_THREAD_ID_STRING]: { name: PROFILER_THREAD_NAME }
|
|
229
|
+
}
|
|
346
230
|
};
|
|
347
|
-
|
|
348
231
|
const firstSample = input.samples[0];
|
|
349
232
|
if (!firstSample) {
|
|
350
233
|
return profile;
|
|
351
234
|
}
|
|
352
|
-
|
|
353
|
-
// We assert samples.length > 0 above and timestamp should always be present
|
|
354
235
|
const start = firstSample.timestamp;
|
|
355
|
-
// The JS SDK might change it's time origin based on some heuristic (see See packages/utils/src/time.ts)
|
|
356
|
-
// when that happens, we need to ensure we are correcting the profile timings so the two timelines stay in sync.
|
|
357
|
-
// Since JS self profiling time origin is always initialized to performance.timeOrigin, we need to adjust for
|
|
358
|
-
// the drift between the SDK selected value and our profile time origin.
|
|
359
236
|
const perfOrigin = browserPerformanceTimeOrigin();
|
|
360
|
-
const origin = typeof performance.timeOrigin ===
|
|
237
|
+
const origin = typeof performance.timeOrigin === "number" ? performance.timeOrigin : perfOrigin || 0;
|
|
361
238
|
const adjustForOriginChange = origin - (perfOrigin || origin);
|
|
362
|
-
|
|
363
239
|
input.samples.forEach((jsSample, i) => {
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
if (EMPTY_STACK_ID === undefined) {
|
|
240
|
+
if (jsSample.stackId === void 0) {
|
|
241
|
+
if (EMPTY_STACK_ID === void 0) {
|
|
367
242
|
EMPTY_STACK_ID = STACK_ID;
|
|
368
243
|
profile.stacks[EMPTY_STACK_ID] = [];
|
|
369
244
|
STACK_ID++;
|
|
370
245
|
}
|
|
371
|
-
|
|
372
|
-
profile['samples'][i] = {
|
|
246
|
+
profile["samples"][i] = {
|
|
373
247
|
// convert ms timestamp to ns
|
|
374
248
|
elapsed_since_start_ns: ((jsSample.timestamp + adjustForOriginChange - start) * MS_TO_NS).toFixed(0),
|
|
375
249
|
stack_id: EMPTY_STACK_ID,
|
|
376
|
-
thread_id: PROFILER_THREAD_ID_STRING
|
|
250
|
+
thread_id: PROFILER_THREAD_ID_STRING
|
|
377
251
|
};
|
|
378
252
|
return;
|
|
379
253
|
}
|
|
380
|
-
|
|
381
254
|
let stackTop = input.stacks[jsSample.stackId];
|
|
382
|
-
|
|
383
|
-
// Functions in top->down order (root is last)
|
|
384
|
-
// We follow the stackTop.parentId trail and collect each visited frameId
|
|
385
255
|
const stack = [];
|
|
386
|
-
|
|
387
256
|
while (stackTop) {
|
|
388
257
|
stack.push(stackTop.frameId);
|
|
389
|
-
|
|
390
258
|
const frame = input.frames[stackTop.frameId];
|
|
391
|
-
|
|
392
|
-
// If our frame has not been indexed yet, index it
|
|
393
|
-
if (frame && profile.frames[stackTop.frameId] === undefined) {
|
|
259
|
+
if (frame && profile.frames[stackTop.frameId] === void 0) {
|
|
394
260
|
profile.frames[stackTop.frameId] = {
|
|
395
261
|
function: frame.name,
|
|
396
|
-
abs_path: typeof frame.resourceId ===
|
|
262
|
+
abs_path: typeof frame.resourceId === "number" ? input.resources[frame.resourceId] : void 0,
|
|
397
263
|
lineno: frame.line,
|
|
398
|
-
colno: frame.column
|
|
264
|
+
colno: frame.column
|
|
399
265
|
};
|
|
400
266
|
}
|
|
401
|
-
|
|
402
|
-
stackTop = stackTop.parentId === undefined ? undefined : input.stacks[stackTop.parentId];
|
|
267
|
+
stackTop = stackTop.parentId === void 0 ? void 0 : input.stacks[stackTop.parentId];
|
|
403
268
|
}
|
|
404
|
-
|
|
405
269
|
const sample = {
|
|
406
270
|
// convert ms timestamp to ns
|
|
407
271
|
elapsed_since_start_ns: ((jsSample.timestamp + adjustForOriginChange - start) * MS_TO_NS).toFixed(0),
|
|
408
272
|
stack_id: STACK_ID,
|
|
409
|
-
thread_id: PROFILER_THREAD_ID_STRING
|
|
273
|
+
thread_id: PROFILER_THREAD_ID_STRING
|
|
410
274
|
};
|
|
411
|
-
|
|
412
|
-
profile[
|
|
413
|
-
profile['samples'][i] = sample;
|
|
275
|
+
profile["stacks"][STACK_ID] = stack;
|
|
276
|
+
profile["samples"][i] = sample;
|
|
414
277
|
STACK_ID++;
|
|
415
278
|
});
|
|
416
|
-
|
|
417
279
|
return profile;
|
|
418
280
|
}
|
|
419
|
-
|
|
420
|
-
/**
|
|
421
|
-
* Adds items to envelope if they are not already present - mutates the envelope.
|
|
422
|
-
* @param envelope
|
|
423
|
-
*/
|
|
424
281
|
function addProfilesToEnvelope(envelope, profiles) {
|
|
425
282
|
if (!profiles.length) {
|
|
426
283
|
return envelope;
|
|
427
284
|
}
|
|
428
|
-
|
|
429
285
|
for (const profile of profiles) {
|
|
430
|
-
envelope[1].push([{ type:
|
|
286
|
+
envelope[1].push([{ type: "profile" }, profile]);
|
|
431
287
|
}
|
|
432
288
|
return envelope;
|
|
433
289
|
}
|
|
434
|
-
|
|
435
|
-
/**
|
|
436
|
-
* Finds transactions with profile_id context in the envelope
|
|
437
|
-
* @param envelope
|
|
438
|
-
* @returns
|
|
439
|
-
*/
|
|
440
290
|
function findProfiledTransactionsFromEnvelope(envelope) {
|
|
441
291
|
const events = [];
|
|
442
|
-
|
|
443
292
|
forEachEnvelopeItem(envelope, (item, type) => {
|
|
444
|
-
if (type !==
|
|
293
|
+
if (type !== "transaction") {
|
|
445
294
|
return;
|
|
446
295
|
}
|
|
447
|
-
|
|
448
296
|
for (let j = 1; j < item.length; j++) {
|
|
449
|
-
const event = item[j]
|
|
450
|
-
|
|
297
|
+
const event = item[j];
|
|
451
298
|
if (event?.contexts?.profile?.profile_id) {
|
|
452
|
-
events.push(item[j]
|
|
299
|
+
events.push(item[j]);
|
|
453
300
|
}
|
|
454
301
|
}
|
|
455
302
|
});
|
|
456
|
-
|
|
457
303
|
return events;
|
|
458
304
|
}
|
|
459
|
-
|
|
460
|
-
/**
|
|
461
|
-
* Applies debug meta data to an event from a list of paths to resources (sourcemaps)
|
|
462
|
-
*/
|
|
463
305
|
function applyDebugMetadata(resource_paths) {
|
|
464
306
|
const client = getClient();
|
|
465
307
|
const options = client?.getOptions();
|
|
466
308
|
const stackParser = options?.stackParser;
|
|
467
|
-
|
|
468
309
|
if (!stackParser) {
|
|
469
310
|
return [];
|
|
470
311
|
}
|
|
471
|
-
|
|
472
312
|
return getDebugImagesForResources(stackParser, resource_paths);
|
|
473
313
|
}
|
|
474
|
-
|
|
475
|
-
/**
|
|
476
|
-
* Checks the given sample rate to make sure it is valid type and value (a boolean, or a number between 0 and 1).
|
|
477
|
-
*/
|
|
478
314
|
function isValidSampleRate(rate) {
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
)} of type ${JSON.stringify(typeof rate)}.`,
|
|
486
|
-
);
|
|
315
|
+
if (typeof rate !== "number" && typeof rate !== "boolean" || typeof rate === "number" && isNaN(rate)) {
|
|
316
|
+
DEBUG_BUILD && debug.warn(
|
|
317
|
+
`[Profiling] Invalid sample rate. Sample rate must be a boolean or a number between 0 and 1. Got ${JSON.stringify(
|
|
318
|
+
rate
|
|
319
|
+
)} of type ${JSON.stringify(typeof rate)}.`
|
|
320
|
+
);
|
|
487
321
|
return false;
|
|
488
322
|
}
|
|
489
|
-
|
|
490
|
-
// Boolean sample rates are always valid
|
|
491
323
|
if (rate === true || rate === false) {
|
|
492
324
|
return true;
|
|
493
325
|
}
|
|
494
|
-
|
|
495
|
-
// in case sampleRate is a boolean, it will get automatically cast to 1 if it's true and 0 if it's false
|
|
496
326
|
if (rate < 0 || rate > 1) {
|
|
497
327
|
DEBUG_BUILD && debug.warn(`[Profiling] Invalid sample rate. Sample rate must be between 0 and 1. Got ${rate}.`);
|
|
498
328
|
return false;
|
|
499
329
|
}
|
|
500
330
|
return true;
|
|
501
331
|
}
|
|
502
|
-
|
|
503
332
|
function isValidProfile(profile) {
|
|
504
333
|
if (profile.samples.length < 2) {
|
|
505
334
|
if (DEBUG_BUILD) {
|
|
506
|
-
|
|
507
|
-
// they are not seeing any profiling data and we cant avoid the back and forth
|
|
508
|
-
// of asking them to provide us with a dump of the profile data.
|
|
509
|
-
debug.log('[Profiling] Discarding profile because it contains less than 2 samples');
|
|
335
|
+
debug.log("[Profiling] Discarding profile because it contains less than 2 samples");
|
|
510
336
|
}
|
|
511
337
|
return false;
|
|
512
338
|
}
|
|
513
|
-
|
|
514
339
|
if (!profile.frames.length) {
|
|
515
340
|
if (DEBUG_BUILD) {
|
|
516
|
-
debug.log(
|
|
341
|
+
debug.log("[Profiling] Discarding profile because it contains no frames");
|
|
517
342
|
}
|
|
518
343
|
return false;
|
|
519
344
|
}
|
|
520
|
-
|
|
521
345
|
return true;
|
|
522
346
|
}
|
|
523
|
-
|
|
524
|
-
// Keep a flag value to avoid re-initializing the profiler constructor. If it fails
|
|
525
|
-
// once, it will always fail and this allows us to early return.
|
|
526
347
|
let PROFILING_CONSTRUCTOR_FAILED = false;
|
|
527
|
-
const MAX_PROFILE_DURATION_MS =
|
|
528
|
-
|
|
529
|
-
/**
|
|
530
|
-
* Check if profiler constructor is available.
|
|
531
|
-
* @param maybeProfiler
|
|
532
|
-
*/
|
|
348
|
+
const MAX_PROFILE_DURATION_MS = 3e4;
|
|
533
349
|
function isJSProfilerSupported(maybeProfiler) {
|
|
534
|
-
return typeof maybeProfiler ===
|
|
350
|
+
return typeof maybeProfiler === "function";
|
|
535
351
|
}
|
|
536
|
-
|
|
537
|
-
/**
|
|
538
|
-
* Starts the profiler and returns the profiler instance.
|
|
539
|
-
*/
|
|
540
352
|
function startJSSelfProfile() {
|
|
541
|
-
// Feature support check first
|
|
542
353
|
const JSProfilerConstructor = WINDOW.Profiler;
|
|
543
|
-
|
|
544
354
|
if (!isJSProfilerSupported(JSProfilerConstructor)) {
|
|
545
355
|
if (DEBUG_BUILD) {
|
|
546
|
-
debug.log(
|
|
356
|
+
debug.log("[Profiling] Profiling is not supported by this browser, Profiler interface missing on window object.");
|
|
547
357
|
}
|
|
548
358
|
return;
|
|
549
359
|
}
|
|
550
|
-
|
|
551
|
-
// From initial testing, it seems that the minimum value for sampleInterval is 10ms.
|
|
552
360
|
const samplingIntervalMS = 10;
|
|
553
|
-
// Start the profiler
|
|
554
361
|
const maxSamples = Math.floor(MAX_PROFILE_DURATION_MS / samplingIntervalMS);
|
|
555
|
-
|
|
556
|
-
// Attempt to initialize the profiler constructor, if it fails, we disable profiling for the current user session.
|
|
557
|
-
// This is likely due to a missing 'Document-Policy': 'js-profiling' header. We do not want to throw an error if this happens
|
|
558
|
-
// as we risk breaking the user's application, so just disable profiling and log an error.
|
|
559
362
|
try {
|
|
560
363
|
return new JSProfilerConstructor({ sampleInterval: samplingIntervalMS, maxBufferSize: maxSamples });
|
|
561
364
|
} catch (_e) {
|
|
562
365
|
if (DEBUG_BUILD) {
|
|
563
366
|
debug.log(
|
|
564
|
-
"[Profiling] Failed to initialize the Profiling constructor, this is likely due to a missing 'Document-Policy': 'js-profiling' header."
|
|
367
|
+
"[Profiling] Failed to initialize the Profiling constructor, this is likely due to a missing 'Document-Policy': 'js-profiling' header."
|
|
565
368
|
);
|
|
566
|
-
debug.log(
|
|
369
|
+
debug.log("[Profiling] Disabling profiling for current user session.");
|
|
567
370
|
}
|
|
568
371
|
PROFILING_CONSTRUCTOR_FAILED = true;
|
|
569
372
|
}
|
|
570
|
-
|
|
571
373
|
return;
|
|
572
374
|
}
|
|
573
|
-
|
|
574
|
-
/**
|
|
575
|
-
* Determine if a profile should be profiled.
|
|
576
|
-
*/
|
|
577
375
|
function shouldProfileSpanLegacy(span) {
|
|
578
|
-
// If constructor failed once, it will always fail, so we can early return.
|
|
579
376
|
if (PROFILING_CONSTRUCTOR_FAILED) {
|
|
580
377
|
if (DEBUG_BUILD) {
|
|
581
|
-
debug.log(
|
|
378
|
+
debug.log("[Profiling] Profiling has been disabled for the duration of the current user session.");
|
|
582
379
|
}
|
|
583
380
|
return false;
|
|
584
381
|
}
|
|
585
|
-
|
|
586
382
|
if (!span.isRecording()) {
|
|
587
|
-
DEBUG_BUILD && debug.log(
|
|
383
|
+
DEBUG_BUILD && debug.log("[Profiling] Discarding profile because root span was not sampled.");
|
|
588
384
|
return false;
|
|
589
385
|
}
|
|
590
|
-
|
|
591
386
|
const client = getClient();
|
|
592
387
|
const options = client?.getOptions();
|
|
593
388
|
if (!options) {
|
|
594
|
-
DEBUG_BUILD && debug.log(
|
|
389
|
+
DEBUG_BUILD && debug.log("[Profiling] Profiling disabled, no options found.");
|
|
595
390
|
return false;
|
|
596
391
|
}
|
|
597
|
-
|
|
598
|
-
// eslint-disable-next-line deprecation/deprecation
|
|
599
|
-
const profilesSampleRate = (options ).profilesSampleRate
|
|
600
|
-
|
|
601
|
-
;
|
|
602
|
-
|
|
603
|
-
// Since this is coming from the user (or from a function provided by the user), who knows what we might get. (The
|
|
604
|
-
// only valid values are booleans or numbers between 0 and 1.)
|
|
392
|
+
const profilesSampleRate = options.profilesSampleRate;
|
|
605
393
|
if (!isValidSampleRate(profilesSampleRate)) {
|
|
606
|
-
DEBUG_BUILD && debug.warn(
|
|
394
|
+
DEBUG_BUILD && debug.warn("[Profiling] Discarding profile because of invalid sample rate.");
|
|
607
395
|
return false;
|
|
608
396
|
}
|
|
609
|
-
|
|
610
|
-
// if the function returned 0 (or false), or if `profileSampleRate` is 0, it's a sign the profile should be dropped
|
|
611
397
|
if (!profilesSampleRate) {
|
|
612
|
-
DEBUG_BUILD &&
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
);
|
|
398
|
+
DEBUG_BUILD && debug.log(
|
|
399
|
+
"[Profiling] Discarding profile because a negative sampling decision was inherited or profileSampleRate is set to 0"
|
|
400
|
+
);
|
|
616
401
|
return false;
|
|
617
402
|
}
|
|
618
|
-
|
|
619
|
-
// Now we roll the dice. Math.random is inclusive of 0, but not of 1, so strict < is safe here. In case sampleRate is
|
|
620
|
-
// a boolean, the < comparison will cause it to be automatically cast to 1 if it's true and 0 if it's false.
|
|
621
403
|
const sampled = profilesSampleRate === true ? true : Math.random() < profilesSampleRate;
|
|
622
|
-
// Check if we should sample this profile
|
|
623
404
|
if (!sampled) {
|
|
624
|
-
DEBUG_BUILD &&
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
);
|
|
405
|
+
DEBUG_BUILD && debug.log(
|
|
406
|
+
`[Profiling] Discarding profile because it's not included in the random sample (sampling rate = ${Number(
|
|
407
|
+
profilesSampleRate
|
|
408
|
+
)})`
|
|
409
|
+
);
|
|
630
410
|
return false;
|
|
631
411
|
}
|
|
632
|
-
|
|
633
412
|
return true;
|
|
634
413
|
}
|
|
635
|
-
|
|
636
|
-
/**
|
|
637
|
-
* Determine if a profile should be created for the current session.
|
|
638
|
-
*/
|
|
639
414
|
function shouldProfileSession(options) {
|
|
640
|
-
// If constructor failed once, it will always fail, so we can early return.
|
|
641
415
|
if (PROFILING_CONSTRUCTOR_FAILED) {
|
|
642
416
|
if (DEBUG_BUILD) {
|
|
643
417
|
debug.log(
|
|
644
|
-
|
|
418
|
+
"[Profiling] Profiling has been disabled for the duration of the current user session as the JS Profiler could not be started."
|
|
645
419
|
);
|
|
646
420
|
}
|
|
647
421
|
return false;
|
|
648
422
|
}
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
DEBUG_BUILD && debug.warn('[Profiling] Session not sampled. Invalid `profileLifecycle` option.');
|
|
423
|
+
if (options.profileLifecycle !== "trace" && options.profileLifecycle !== "manual") {
|
|
424
|
+
DEBUG_BUILD && debug.warn("[Profiling] Session not sampled. Invalid `profileLifecycle` option.");
|
|
652
425
|
return false;
|
|
653
426
|
}
|
|
654
|
-
|
|
655
|
-
// Session sampling: profileSessionSampleRate gates whether profiling is enabled for this session
|
|
656
427
|
const profileSessionSampleRate = options.profileSessionSampleRate;
|
|
657
|
-
|
|
658
428
|
if (!isValidSampleRate(profileSessionSampleRate)) {
|
|
659
|
-
DEBUG_BUILD && debug.warn(
|
|
429
|
+
DEBUG_BUILD && debug.warn("[Profiling] Discarding profile because of invalid profileSessionSampleRate.");
|
|
660
430
|
return false;
|
|
661
431
|
}
|
|
662
|
-
|
|
663
432
|
if (!profileSessionSampleRate) {
|
|
664
|
-
DEBUG_BUILD &&
|
|
665
|
-
debug.log('[Profiling] Discarding profile because profileSessionSampleRate is not defined or set to 0');
|
|
433
|
+
DEBUG_BUILD && debug.log("[Profiling] Discarding profile because profileSessionSampleRate is not defined or set to 0");
|
|
666
434
|
return false;
|
|
667
435
|
}
|
|
668
|
-
|
|
669
436
|
return Math.random() <= profileSessionSampleRate;
|
|
670
437
|
}
|
|
671
|
-
|
|
672
|
-
/**
|
|
673
|
-
* Checks if legacy profiling is configured.
|
|
674
|
-
*/
|
|
675
438
|
function hasLegacyProfiling(options) {
|
|
676
|
-
|
|
677
|
-
return typeof options.profilesSampleRate !== 'undefined';
|
|
439
|
+
return typeof options.profilesSampleRate !== "undefined";
|
|
678
440
|
}
|
|
679
|
-
|
|
680
|
-
/**
|
|
681
|
-
* Creates a profiling envelope item, if the profile does not pass validation, returns null.
|
|
682
|
-
* @param event
|
|
683
|
-
* @returns {Profile | null}
|
|
684
|
-
*/
|
|
685
|
-
function createProfilingEvent(
|
|
686
|
-
profile_id,
|
|
687
|
-
start_timestamp,
|
|
688
|
-
profile,
|
|
689
|
-
event,
|
|
690
|
-
) {
|
|
441
|
+
function createProfilingEvent(profile_id, start_timestamp, profile, event) {
|
|
691
442
|
if (!isValidProfile(profile)) {
|
|
692
443
|
return null;
|
|
693
444
|
}
|
|
694
|
-
|
|
695
445
|
return createProfilePayload(profile_id, start_timestamp, profile, event);
|
|
696
446
|
}
|
|
697
|
-
|
|
698
|
-
// TODO (v8): We need to obtain profile ids in @sentry-internal/tracing,
|
|
699
|
-
// but we don't have access to this map because importing this map would
|
|
700
|
-
// cause a circular dependency. We need to resolve this in v8.
|
|
701
|
-
const PROFILE_MAP = new Map();
|
|
702
|
-
/**
|
|
703
|
-
*
|
|
704
|
-
*/
|
|
447
|
+
const PROFILE_MAP = /* @__PURE__ */ new Map();
|
|
705
448
|
function getActiveProfilesCount() {
|
|
706
449
|
return PROFILE_MAP.size;
|
|
707
450
|
}
|
|
708
|
-
|
|
709
|
-
/**
|
|
710
|
-
* Retrieves profile from global cache and removes it.
|
|
711
|
-
*/
|
|
712
451
|
function takeProfileFromGlobalCache(profile_id) {
|
|
713
452
|
const profile = PROFILE_MAP.get(profile_id);
|
|
714
453
|
if (profile) {
|
|
@@ -716,25 +455,19 @@ function takeProfileFromGlobalCache(profile_id) {
|
|
|
716
455
|
}
|
|
717
456
|
return profile;
|
|
718
457
|
}
|
|
719
|
-
/**
|
|
720
|
-
* Adds profile to global cache and evicts the oldest profile if the cache is full.
|
|
721
|
-
*/
|
|
722
458
|
function addProfileToGlobalCache(profile_id, profile) {
|
|
723
459
|
PROFILE_MAP.set(profile_id, profile);
|
|
724
|
-
|
|
725
460
|
if (PROFILE_MAP.size > 30) {
|
|
726
461
|
const last = PROFILE_MAP.keys().next().value;
|
|
727
|
-
if (last !==
|
|
462
|
+
if (last !== void 0) {
|
|
728
463
|
PROFILE_MAP.delete(last);
|
|
729
464
|
}
|
|
730
465
|
}
|
|
731
466
|
}
|
|
732
|
-
|
|
733
|
-
const PROFILED_ROOT_SPANS = new WeakSet();
|
|
734
|
-
|
|
467
|
+
const PROFILED_ROOT_SPANS = /* @__PURE__ */ new WeakSet();
|
|
735
468
|
function setThreadAttributes(span) {
|
|
736
|
-
span.setAttribute(
|
|
737
|
-
span.setAttribute(
|
|
469
|
+
span.setAttribute("thread.id", PROFILER_THREAD_ID_STRING);
|
|
470
|
+
span.setAttribute("thread.name", PROFILER_THREAD_NAME);
|
|
738
471
|
}
|
|
739
472
|
|
|
740
473
|
export { MAX_PROFILE_DURATION_MS, PROFILED_ROOT_SPANS, PROFILER_THREAD_ID_STRING, PROFILER_THREAD_NAME, addProfileToGlobalCache, addProfilesToEnvelope, applyDebugMetadata, convertJSSelfProfileToSampledFormat, createProfileChunkPayload, createProfilePayload, createProfilingEvent, enrichWithThreadInformation, findProfiledTransactionsFromEnvelope, getActiveProfilesCount, hasLegacyProfiling, isAutomatedPageLoadSpan, isValidSampleRate, setThreadAttributes, shouldProfileSession, shouldProfileSpanLegacy, startJSSelfProfile, takeProfileFromGlobalCache, validateProfileChunk };
|