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