@sentry/browser 10.51.0 → 10.53.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 +7 -7
- package/build/npm/cjs/dev/client.js.map +1 -1
- package/build/npm/cjs/dev/diagnose-sdk.js +3 -3
- package/build/npm/cjs/dev/diagnose-sdk.js.map +1 -1
- package/build/npm/cjs/dev/eventbuilder.js +23 -23
- package/build/npm/cjs/dev/eventbuilder.js.map +1 -1
- package/build/npm/cjs/dev/feedbackAsync.js.map +1 -1
- package/build/npm/cjs/dev/feedbackSync.js.map +1 -1
- package/build/npm/cjs/dev/helpers.js +10 -10
- package/build/npm/cjs/dev/helpers.js.map +1 -1
- package/build/npm/cjs/dev/index.js +84 -84
- package/build/npm/cjs/dev/integrations/breadcrumbs.js +29 -29
- package/build/npm/cjs/dev/integrations/breadcrumbs.js.map +1 -1
- package/build/npm/cjs/dev/integrations/browserapierrors.js +16 -16
- package/build/npm/cjs/dev/integrations/browserapierrors.js.map +1 -1
- package/build/npm/cjs/dev/integrations/browsersession.js +9 -9
- package/build/npm/cjs/dev/integrations/browsersession.js.map +1 -1
- package/build/npm/cjs/dev/integrations/contextlines.js +5 -5
- package/build/npm/cjs/dev/integrations/contextlines.js.map +1 -1
- package/build/npm/cjs/dev/integrations/culturecontext.js +3 -3
- package/build/npm/cjs/dev/integrations/culturecontext.js.map +1 -1
- package/build/npm/cjs/dev/integrations/featureFlags/growthbook/integration.js +2 -2
- package/build/npm/cjs/dev/integrations/featureFlags/growthbook/integration.js.map +1 -1
- package/build/npm/cjs/dev/integrations/featureFlags/launchdarkly/integration.js +5 -5
- package/build/npm/cjs/dev/integrations/featureFlags/launchdarkly/integration.js.map +1 -1
- package/build/npm/cjs/dev/integrations/featureFlags/openfeature/integration.js +7 -7
- package/build/npm/cjs/dev/integrations/featureFlags/openfeature/integration.js.map +1 -1
- package/build/npm/cjs/dev/integrations/featureFlags/statsig/integration.js +5 -5
- package/build/npm/cjs/dev/integrations/featureFlags/statsig/integration.js.map +1 -1
- package/build/npm/cjs/dev/integrations/featureFlags/unleash/integration.js +7 -7
- package/build/npm/cjs/dev/integrations/featureFlags/unleash/integration.js.map +1 -1
- package/build/npm/cjs/dev/integrations/globalhandlers.js +16 -16
- package/build/npm/cjs/dev/integrations/globalhandlers.js.map +1 -1
- package/build/npm/cjs/dev/integrations/graphqlClient.js +9 -9
- package/build/npm/cjs/dev/integrations/graphqlClient.js.map +1 -1
- package/build/npm/cjs/dev/integrations/httpclient.js +14 -14
- package/build/npm/cjs/dev/integrations/httpclient.js.map +1 -1
- package/build/npm/cjs/dev/integrations/httpcontext.js +3 -3
- package/build/npm/cjs/dev/integrations/httpcontext.js.map +1 -1
- package/build/npm/cjs/dev/integrations/linkederrors.js +3 -3
- package/build/npm/cjs/dev/integrations/linkederrors.js.map +1 -1
- package/build/npm/cjs/dev/integrations/reportingobserver.js +7 -7
- package/build/npm/cjs/dev/integrations/reportingobserver.js.map +1 -1
- package/build/npm/cjs/dev/integrations/spanstreaming.js +10 -10
- package/build/npm/cjs/dev/integrations/spanstreaming.js.map +1 -1
- package/build/npm/cjs/dev/integrations/spotlight.js +13 -24
- package/build/npm/cjs/dev/integrations/spotlight.js.map +1 -1
- package/build/npm/cjs/dev/integrations/view-hierarchy.js +3 -3
- package/build/npm/cjs/dev/integrations/view-hierarchy.js.map +1 -1
- package/build/npm/cjs/dev/integrations/webWorker.js +18 -18
- package/build/npm/cjs/dev/integrations/webWorker.js.map +1 -1
- package/build/npm/cjs/dev/profiling/UIProfiler.js +43 -33
- package/build/npm/cjs/dev/profiling/UIProfiler.js.map +1 -1
- package/build/npm/cjs/dev/profiling/index.js +7 -7
- package/build/npm/cjs/dev/profiling/index.js.map +1 -1
- package/build/npm/cjs/dev/profiling/integration.js +20 -18
- package/build/npm/cjs/dev/profiling/integration.js.map +1 -1
- package/build/npm/cjs/dev/profiling/startProfileForSpan.js +14 -11
- package/build/npm/cjs/dev/profiling/startProfileForSpan.js.map +1 -1
- package/build/npm/cjs/dev/profiling/utils.js +39 -68
- package/build/npm/cjs/dev/profiling/utils.js.map +1 -1
- package/build/npm/cjs/dev/report-dialog.js +7 -7
- package/build/npm/cjs/dev/report-dialog.js.map +1 -1
- package/build/npm/cjs/dev/sdk.js +8 -8
- package/build/npm/cjs/dev/sdk.js.map +1 -1
- package/build/npm/cjs/dev/stack-parsers.js +10 -10
- package/build/npm/cjs/dev/stack-parsers.js.map +1 -1
- package/build/npm/cjs/dev/tracing/backgroundtab.js +7 -7
- package/build/npm/cjs/dev/tracing/backgroundtab.js.map +1 -1
- package/build/npm/cjs/dev/tracing/browserTracingIntegration.js +52 -52
- package/build/npm/cjs/dev/tracing/browserTracingIntegration.js.map +1 -1
- package/build/npm/cjs/dev/tracing/linkedTraces.js +11 -11
- package/build/npm/cjs/dev/tracing/linkedTraces.js.map +1 -1
- package/build/npm/cjs/dev/tracing/reportPageLoaded.js +2 -2
- package/build/npm/cjs/dev/tracing/reportPageLoaded.js.map +1 -1
- package/build/npm/cjs/dev/tracing/request.js +31 -29
- package/build/npm/cjs/dev/tracing/request.js.map +1 -1
- package/build/npm/cjs/dev/tracing/setActiveSpan.js +5 -5
- package/build/npm/cjs/dev/tracing/setActiveSpan.js.map +1 -1
- package/build/npm/cjs/dev/transports/fetch.js +3 -3
- package/build/npm/cjs/dev/transports/fetch.js.map +1 -1
- package/build/npm/cjs/dev/transports/offline.js +5 -5
- package/build/npm/cjs/dev/transports/offline.js.map +1 -1
- package/build/npm/cjs/dev/userfeedback.js +3 -3
- package/build/npm/cjs/dev/userfeedback.js.map +1 -1
- package/build/npm/cjs/dev/utils/detectBrowserExtension.js +3 -3
- package/build/npm/cjs/dev/utils/detectBrowserExtension.js.map +1 -1
- package/build/npm/cjs/dev/utils/lazyLoadIntegration.js +3 -3
- package/build/npm/cjs/dev/utils/lazyLoadIntegration.js.map +1 -1
- package/build/npm/cjs/prod/client.js +7 -7
- package/build/npm/cjs/prod/client.js.map +1 -1
- package/build/npm/cjs/prod/diagnose-sdk.js +3 -3
- package/build/npm/cjs/prod/diagnose-sdk.js.map +1 -1
- package/build/npm/cjs/prod/eventbuilder.js +23 -23
- package/build/npm/cjs/prod/eventbuilder.js.map +1 -1
- package/build/npm/cjs/prod/feedbackAsync.js.map +1 -1
- package/build/npm/cjs/prod/feedbackSync.js.map +1 -1
- package/build/npm/cjs/prod/helpers.js +10 -10
- package/build/npm/cjs/prod/helpers.js.map +1 -1
- package/build/npm/cjs/prod/index.js +84 -84
- package/build/npm/cjs/prod/integrations/breadcrumbs.js +29 -29
- package/build/npm/cjs/prod/integrations/breadcrumbs.js.map +1 -1
- package/build/npm/cjs/prod/integrations/browserapierrors.js +16 -16
- package/build/npm/cjs/prod/integrations/browserapierrors.js.map +1 -1
- package/build/npm/cjs/prod/integrations/browsersession.js +9 -9
- package/build/npm/cjs/prod/integrations/browsersession.js.map +1 -1
- package/build/npm/cjs/prod/integrations/contextlines.js +5 -5
- package/build/npm/cjs/prod/integrations/contextlines.js.map +1 -1
- package/build/npm/cjs/prod/integrations/culturecontext.js +3 -3
- package/build/npm/cjs/prod/integrations/culturecontext.js.map +1 -1
- package/build/npm/cjs/prod/integrations/featureFlags/growthbook/integration.js +2 -2
- package/build/npm/cjs/prod/integrations/featureFlags/growthbook/integration.js.map +1 -1
- package/build/npm/cjs/prod/integrations/featureFlags/launchdarkly/integration.js +5 -5
- package/build/npm/cjs/prod/integrations/featureFlags/launchdarkly/integration.js.map +1 -1
- package/build/npm/cjs/prod/integrations/featureFlags/openfeature/integration.js +7 -7
- package/build/npm/cjs/prod/integrations/featureFlags/openfeature/integration.js.map +1 -1
- package/build/npm/cjs/prod/integrations/featureFlags/statsig/integration.js +5 -5
- package/build/npm/cjs/prod/integrations/featureFlags/statsig/integration.js.map +1 -1
- package/build/npm/cjs/prod/integrations/featureFlags/unleash/integration.js +7 -7
- package/build/npm/cjs/prod/integrations/featureFlags/unleash/integration.js.map +1 -1
- package/build/npm/cjs/prod/integrations/globalhandlers.js +16 -16
- package/build/npm/cjs/prod/integrations/globalhandlers.js.map +1 -1
- package/build/npm/cjs/prod/integrations/graphqlClient.js +9 -9
- package/build/npm/cjs/prod/integrations/graphqlClient.js.map +1 -1
- package/build/npm/cjs/prod/integrations/httpclient.js +14 -14
- package/build/npm/cjs/prod/integrations/httpclient.js.map +1 -1
- package/build/npm/cjs/prod/integrations/httpcontext.js +3 -3
- package/build/npm/cjs/prod/integrations/httpcontext.js.map +1 -1
- package/build/npm/cjs/prod/integrations/linkederrors.js +3 -3
- package/build/npm/cjs/prod/integrations/linkederrors.js.map +1 -1
- package/build/npm/cjs/prod/integrations/reportingobserver.js +7 -7
- package/build/npm/cjs/prod/integrations/reportingobserver.js.map +1 -1
- package/build/npm/cjs/prod/integrations/spanstreaming.js +10 -10
- package/build/npm/cjs/prod/integrations/spanstreaming.js.map +1 -1
- package/build/npm/cjs/prod/integrations/spotlight.js +13 -24
- package/build/npm/cjs/prod/integrations/spotlight.js.map +1 -1
- package/build/npm/cjs/prod/integrations/view-hierarchy.js +3 -3
- package/build/npm/cjs/prod/integrations/view-hierarchy.js.map +1 -1
- package/build/npm/cjs/prod/integrations/webWorker.js +18 -18
- package/build/npm/cjs/prod/integrations/webWorker.js.map +1 -1
- package/build/npm/cjs/prod/profiling/UIProfiler.js +43 -33
- package/build/npm/cjs/prod/profiling/UIProfiler.js.map +1 -1
- package/build/npm/cjs/prod/profiling/index.js +7 -7
- package/build/npm/cjs/prod/profiling/index.js.map +1 -1
- package/build/npm/cjs/prod/profiling/integration.js +20 -18
- package/build/npm/cjs/prod/profiling/integration.js.map +1 -1
- package/build/npm/cjs/prod/profiling/startProfileForSpan.js +14 -11
- package/build/npm/cjs/prod/profiling/startProfileForSpan.js.map +1 -1
- package/build/npm/cjs/prod/profiling/utils.js +39 -68
- package/build/npm/cjs/prod/profiling/utils.js.map +1 -1
- package/build/npm/cjs/prod/report-dialog.js +7 -7
- package/build/npm/cjs/prod/report-dialog.js.map +1 -1
- package/build/npm/cjs/prod/sdk.js +8 -8
- package/build/npm/cjs/prod/sdk.js.map +1 -1
- package/build/npm/cjs/prod/stack-parsers.js +10 -10
- package/build/npm/cjs/prod/stack-parsers.js.map +1 -1
- package/build/npm/cjs/prod/tracing/backgroundtab.js +7 -7
- package/build/npm/cjs/prod/tracing/backgroundtab.js.map +1 -1
- package/build/npm/cjs/prod/tracing/browserTracingIntegration.js +52 -52
- package/build/npm/cjs/prod/tracing/browserTracingIntegration.js.map +1 -1
- package/build/npm/cjs/prod/tracing/linkedTraces.js +11 -11
- package/build/npm/cjs/prod/tracing/linkedTraces.js.map +1 -1
- package/build/npm/cjs/prod/tracing/reportPageLoaded.js +2 -2
- package/build/npm/cjs/prod/tracing/reportPageLoaded.js.map +1 -1
- package/build/npm/cjs/prod/tracing/request.js +31 -29
- package/build/npm/cjs/prod/tracing/request.js.map +1 -1
- package/build/npm/cjs/prod/tracing/setActiveSpan.js +5 -5
- package/build/npm/cjs/prod/tracing/setActiveSpan.js.map +1 -1
- package/build/npm/cjs/prod/transports/fetch.js +3 -3
- package/build/npm/cjs/prod/transports/fetch.js.map +1 -1
- package/build/npm/cjs/prod/transports/offline.js +5 -5
- package/build/npm/cjs/prod/transports/offline.js.map +1 -1
- package/build/npm/cjs/prod/userfeedback.js +3 -3
- package/build/npm/cjs/prod/userfeedback.js.map +1 -1
- package/build/npm/cjs/prod/utils/detectBrowserExtension.js +3 -3
- package/build/npm/cjs/prod/utils/detectBrowserExtension.js.map +1 -1
- package/build/npm/cjs/prod/utils/lazyLoadIntegration.js +3 -3
- package/build/npm/cjs/prod/utils/lazyLoadIntegration.js.map +1 -1
- package/build/npm/esm/dev/client.js +1 -1
- package/build/npm/esm/dev/client.js.map +1 -1
- package/build/npm/esm/dev/diagnose-sdk.js +1 -1
- package/build/npm/esm/dev/diagnose-sdk.js.map +1 -1
- package/build/npm/esm/dev/eventbuilder.js +1 -1
- package/build/npm/esm/dev/eventbuilder.js.map +1 -1
- package/build/npm/esm/dev/feedbackAsync.js.map +1 -1
- package/build/npm/esm/dev/feedbackSync.js.map +1 -1
- package/build/npm/esm/dev/helpers.js +1 -1
- package/build/npm/esm/dev/helpers.js.map +1 -1
- package/build/npm/esm/dev/index.js +1 -1
- package/build/npm/esm/dev/integrations/breadcrumbs.js +1 -1
- package/build/npm/esm/dev/integrations/breadcrumbs.js.map +1 -1
- package/build/npm/esm/dev/integrations/browserapierrors.js +1 -1
- package/build/npm/esm/dev/integrations/browserapierrors.js.map +1 -1
- package/build/npm/esm/dev/integrations/browsersession.js +1 -1
- package/build/npm/esm/dev/integrations/browsersession.js.map +1 -1
- package/build/npm/esm/dev/integrations/contextlines.js +1 -1
- package/build/npm/esm/dev/integrations/contextlines.js.map +1 -1
- package/build/npm/esm/dev/integrations/culturecontext.js +1 -1
- package/build/npm/esm/dev/integrations/culturecontext.js.map +1 -1
- package/build/npm/esm/dev/integrations/featureFlags/growthbook/integration.js +1 -1
- package/build/npm/esm/dev/integrations/featureFlags/growthbook/integration.js.map +1 -1
- package/build/npm/esm/dev/integrations/featureFlags/launchdarkly/integration.js +1 -1
- package/build/npm/esm/dev/integrations/featureFlags/launchdarkly/integration.js.map +1 -1
- package/build/npm/esm/dev/integrations/featureFlags/openfeature/integration.js +1 -1
- package/build/npm/esm/dev/integrations/featureFlags/openfeature/integration.js.map +1 -1
- package/build/npm/esm/dev/integrations/featureFlags/statsig/integration.js +1 -1
- package/build/npm/esm/dev/integrations/featureFlags/statsig/integration.js.map +1 -1
- package/build/npm/esm/dev/integrations/featureFlags/unleash/integration.js +1 -1
- package/build/npm/esm/dev/integrations/featureFlags/unleash/integration.js.map +1 -1
- package/build/npm/esm/dev/integrations/globalhandlers.js +1 -1
- package/build/npm/esm/dev/integrations/globalhandlers.js.map +1 -1
- package/build/npm/esm/dev/integrations/graphqlClient.js +1 -1
- package/build/npm/esm/dev/integrations/graphqlClient.js.map +1 -1
- package/build/npm/esm/dev/integrations/httpclient.js +1 -1
- package/build/npm/esm/dev/integrations/httpclient.js.map +1 -1
- package/build/npm/esm/dev/integrations/httpcontext.js +1 -1
- package/build/npm/esm/dev/integrations/httpcontext.js.map +1 -1
- package/build/npm/esm/dev/integrations/linkederrors.js +1 -1
- package/build/npm/esm/dev/integrations/linkederrors.js.map +1 -1
- package/build/npm/esm/dev/integrations/reportingobserver.js +1 -1
- package/build/npm/esm/dev/integrations/reportingobserver.js.map +1 -1
- package/build/npm/esm/dev/integrations/spanstreaming.js +1 -1
- package/build/npm/esm/dev/integrations/spanstreaming.js.map +1 -1
- package/build/npm/esm/dev/integrations/spotlight.js +8 -19
- package/build/npm/esm/dev/integrations/spotlight.js.map +1 -1
- package/build/npm/esm/dev/integrations/view-hierarchy.js +1 -1
- package/build/npm/esm/dev/integrations/view-hierarchy.js.map +1 -1
- package/build/npm/esm/dev/integrations/webWorker.js +1 -1
- 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 +12 -2
- package/build/npm/esm/dev/profiling/UIProfiler.js.map +1 -1
- package/build/npm/esm/dev/profiling/index.js +1 -1
- package/build/npm/esm/dev/profiling/index.js.map +1 -1
- package/build/npm/esm/dev/profiling/integration.js +9 -7
- package/build/npm/esm/dev/profiling/integration.js.map +1 -1
- package/build/npm/esm/dev/profiling/startProfileForSpan.js +5 -2
- package/build/npm/esm/dev/profiling/startProfileForSpan.js.map +1 -1
- package/build/npm/esm/dev/profiling/utils.js +6 -36
- package/build/npm/esm/dev/profiling/utils.js.map +1 -1
- package/build/npm/esm/dev/report-dialog.js +1 -1
- package/build/npm/esm/dev/report-dialog.js.map +1 -1
- package/build/npm/esm/dev/sdk.js +1 -1
- package/build/npm/esm/dev/sdk.js.map +1 -1
- package/build/npm/esm/dev/stack-parsers.js +1 -1
- package/build/npm/esm/dev/stack-parsers.js.map +1 -1
- package/build/npm/esm/dev/tracing/backgroundtab.js +1 -1
- package/build/npm/esm/dev/tracing/backgroundtab.js.map +1 -1
- package/build/npm/esm/dev/tracing/browserTracingIntegration.js +1 -1
- package/build/npm/esm/dev/tracing/browserTracingIntegration.js.map +1 -1
- package/build/npm/esm/dev/tracing/linkedTraces.js +2 -2
- package/build/npm/esm/dev/tracing/linkedTraces.js.map +1 -1
- package/build/npm/esm/dev/tracing/reportPageLoaded.js +1 -1
- package/build/npm/esm/dev/tracing/reportPageLoaded.js.map +1 -1
- package/build/npm/esm/dev/tracing/request.js +6 -4
- package/build/npm/esm/dev/tracing/request.js.map +1 -1
- package/build/npm/esm/dev/tracing/setActiveSpan.js +1 -1
- package/build/npm/esm/dev/tracing/setActiveSpan.js.map +1 -1
- package/build/npm/esm/dev/transports/fetch.js +1 -1
- package/build/npm/esm/dev/transports/fetch.js.map +1 -1
- package/build/npm/esm/dev/transports/offline.js +1 -1
- package/build/npm/esm/dev/transports/offline.js.map +1 -1
- package/build/npm/esm/dev/userfeedback.js +1 -1
- package/build/npm/esm/dev/userfeedback.js.map +1 -1
- package/build/npm/esm/dev/utils/detectBrowserExtension.js +1 -1
- package/build/npm/esm/dev/utils/detectBrowserExtension.js.map +1 -1
- package/build/npm/esm/dev/utils/lazyLoadIntegration.js +1 -1
- package/build/npm/esm/dev/utils/lazyLoadIntegration.js.map +1 -1
- package/build/npm/esm/prod/client.js +1 -1
- package/build/npm/esm/prod/client.js.map +1 -1
- package/build/npm/esm/prod/diagnose-sdk.js +1 -1
- package/build/npm/esm/prod/diagnose-sdk.js.map +1 -1
- package/build/npm/esm/prod/eventbuilder.js +1 -1
- package/build/npm/esm/prod/eventbuilder.js.map +1 -1
- package/build/npm/esm/prod/feedbackAsync.js.map +1 -1
- package/build/npm/esm/prod/feedbackSync.js.map +1 -1
- package/build/npm/esm/prod/helpers.js +1 -1
- package/build/npm/esm/prod/helpers.js.map +1 -1
- package/build/npm/esm/prod/index.js +1 -1
- package/build/npm/esm/prod/integrations/breadcrumbs.js +1 -1
- package/build/npm/esm/prod/integrations/breadcrumbs.js.map +1 -1
- package/build/npm/esm/prod/integrations/browserapierrors.js +1 -1
- package/build/npm/esm/prod/integrations/browserapierrors.js.map +1 -1
- package/build/npm/esm/prod/integrations/browsersession.js +1 -1
- package/build/npm/esm/prod/integrations/browsersession.js.map +1 -1
- package/build/npm/esm/prod/integrations/contextlines.js +1 -1
- package/build/npm/esm/prod/integrations/contextlines.js.map +1 -1
- package/build/npm/esm/prod/integrations/culturecontext.js +1 -1
- package/build/npm/esm/prod/integrations/culturecontext.js.map +1 -1
- package/build/npm/esm/prod/integrations/featureFlags/growthbook/integration.js +1 -1
- package/build/npm/esm/prod/integrations/featureFlags/growthbook/integration.js.map +1 -1
- package/build/npm/esm/prod/integrations/featureFlags/launchdarkly/integration.js +1 -1
- package/build/npm/esm/prod/integrations/featureFlags/launchdarkly/integration.js.map +1 -1
- package/build/npm/esm/prod/integrations/featureFlags/openfeature/integration.js +1 -1
- package/build/npm/esm/prod/integrations/featureFlags/openfeature/integration.js.map +1 -1
- package/build/npm/esm/prod/integrations/featureFlags/statsig/integration.js +1 -1
- package/build/npm/esm/prod/integrations/featureFlags/statsig/integration.js.map +1 -1
- package/build/npm/esm/prod/integrations/featureFlags/unleash/integration.js +1 -1
- package/build/npm/esm/prod/integrations/featureFlags/unleash/integration.js.map +1 -1
- package/build/npm/esm/prod/integrations/globalhandlers.js +1 -1
- package/build/npm/esm/prod/integrations/globalhandlers.js.map +1 -1
- package/build/npm/esm/prod/integrations/graphqlClient.js +1 -1
- package/build/npm/esm/prod/integrations/graphqlClient.js.map +1 -1
- package/build/npm/esm/prod/integrations/httpclient.js +1 -1
- package/build/npm/esm/prod/integrations/httpclient.js.map +1 -1
- package/build/npm/esm/prod/integrations/httpcontext.js +1 -1
- package/build/npm/esm/prod/integrations/httpcontext.js.map +1 -1
- package/build/npm/esm/prod/integrations/linkederrors.js +1 -1
- package/build/npm/esm/prod/integrations/linkederrors.js.map +1 -1
- package/build/npm/esm/prod/integrations/reportingobserver.js +1 -1
- package/build/npm/esm/prod/integrations/reportingobserver.js.map +1 -1
- package/build/npm/esm/prod/integrations/spanstreaming.js +1 -1
- package/build/npm/esm/prod/integrations/spanstreaming.js.map +1 -1
- package/build/npm/esm/prod/integrations/spotlight.js +8 -19
- package/build/npm/esm/prod/integrations/spotlight.js.map +1 -1
- package/build/npm/esm/prod/integrations/view-hierarchy.js +1 -1
- package/build/npm/esm/prod/integrations/view-hierarchy.js.map +1 -1
- package/build/npm/esm/prod/integrations/webWorker.js +1 -1
- 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 +12 -2
- package/build/npm/esm/prod/profiling/UIProfiler.js.map +1 -1
- package/build/npm/esm/prod/profiling/index.js +1 -1
- package/build/npm/esm/prod/profiling/index.js.map +1 -1
- package/build/npm/esm/prod/profiling/integration.js +9 -7
- package/build/npm/esm/prod/profiling/integration.js.map +1 -1
- package/build/npm/esm/prod/profiling/startProfileForSpan.js +5 -2
- package/build/npm/esm/prod/profiling/startProfileForSpan.js.map +1 -1
- package/build/npm/esm/prod/profiling/utils.js +6 -36
- package/build/npm/esm/prod/profiling/utils.js.map +1 -1
- package/build/npm/esm/prod/report-dialog.js +1 -1
- package/build/npm/esm/prod/report-dialog.js.map +1 -1
- package/build/npm/esm/prod/sdk.js +1 -1
- package/build/npm/esm/prod/sdk.js.map +1 -1
- package/build/npm/esm/prod/stack-parsers.js +1 -1
- package/build/npm/esm/prod/stack-parsers.js.map +1 -1
- package/build/npm/esm/prod/tracing/backgroundtab.js +1 -1
- package/build/npm/esm/prod/tracing/backgroundtab.js.map +1 -1
- package/build/npm/esm/prod/tracing/browserTracingIntegration.js +1 -1
- package/build/npm/esm/prod/tracing/browserTracingIntegration.js.map +1 -1
- package/build/npm/esm/prod/tracing/linkedTraces.js +2 -2
- package/build/npm/esm/prod/tracing/linkedTraces.js.map +1 -1
- package/build/npm/esm/prod/tracing/reportPageLoaded.js +1 -1
- package/build/npm/esm/prod/tracing/reportPageLoaded.js.map +1 -1
- package/build/npm/esm/prod/tracing/request.js +6 -4
- package/build/npm/esm/prod/tracing/request.js.map +1 -1
- package/build/npm/esm/prod/tracing/setActiveSpan.js +1 -1
- package/build/npm/esm/prod/tracing/setActiveSpan.js.map +1 -1
- package/build/npm/esm/prod/transports/fetch.js +1 -1
- package/build/npm/esm/prod/transports/fetch.js.map +1 -1
- package/build/npm/esm/prod/transports/offline.js +1 -1
- package/build/npm/esm/prod/transports/offline.js.map +1 -1
- package/build/npm/esm/prod/userfeedback.js +1 -1
- package/build/npm/esm/prod/userfeedback.js.map +1 -1
- package/build/npm/esm/prod/utils/detectBrowserExtension.js +1 -1
- package/build/npm/esm/prod/utils/detectBrowserExtension.js.map +1 -1
- package/build/npm/esm/prod/utils/lazyLoadIntegration.js +1 -1
- package/build/npm/esm/prod/utils/lazyLoadIntegration.js.map +1 -1
- package/build/npm/types/client.d.ts +2 -2
- package/build/npm/types/client.d.ts.map +1 -1
- package/build/npm/types/eventbuilder.d.ts +1 -1
- package/build/npm/types/eventbuilder.d.ts.map +1 -1
- package/build/npm/types/exports.d.ts +3 -3
- package/build/npm/types/exports.d.ts.map +1 -1
- package/build/npm/types/feedbackAsync.d.ts +2 -7
- package/build/npm/types/feedbackAsync.d.ts.map +1 -1
- package/build/npm/types/feedbackSync.d.ts +2 -7
- package/build/npm/types/feedbackSync.d.ts.map +1 -1
- package/build/npm/types/helpers.d.ts +2 -2
- package/build/npm/types/helpers.d.ts.map +1 -1
- package/build/npm/types/index.bundle.logs.metrics.d.ts +1 -1
- package/build/npm/types/index.bundle.logs.metrics.d.ts.map +1 -1
- package/build/npm/types/index.bundle.replay.logs.metrics.d.ts +1 -1
- package/build/npm/types/index.bundle.replay.logs.metrics.d.ts.map +1 -1
- package/build/npm/types/index.bundle.tracing.d.ts +1 -1
- package/build/npm/types/index.bundle.tracing.d.ts.map +1 -1
- package/build/npm/types/index.bundle.tracing.logs.metrics.d.ts +2 -2
- 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 -1
- 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 -1
- 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 -1
- 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 +2 -2
- package/build/npm/types/index.bundle.tracing.replay.logs.metrics.d.ts.map +1 -1
- package/build/npm/types/index.d.ts +3 -3
- package/build/npm/types/index.d.ts.map +1 -1
- package/build/npm/types/integrations/contextlines.d.ts +1 -1
- package/build/npm/types/integrations/contextlines.d.ts.map +1 -1
- package/build/npm/types/integrations/globalhandlers.d.ts +1 -1
- package/build/npm/types/integrations/globalhandlers.d.ts.map +1 -1
- package/build/npm/types/integrations/spotlight.d.ts +4 -5
- package/build/npm/types/integrations/spotlight.d.ts.map +1 -1
- package/build/npm/types/integrations/view-hierarchy.d.ts +1 -1
- package/build/npm/types/integrations/view-hierarchy.d.ts.map +1 -1
- package/build/npm/types/integrations/webWorker.d.ts +1 -1
- package/build/npm/types/integrations/webWorker.d.ts.map +1 -1
- package/build/npm/types/integrations-bundle/index.captureconsole.d.ts +1 -1
- package/build/npm/types/integrations-bundle/index.captureconsole.d.ts.map +1 -1
- package/build/npm/types/integrations-bundle/index.createlangchaincallbackhandler.d.ts +1 -1
- package/build/npm/types/integrations-bundle/index.createlangchaincallbackhandler.d.ts.map +1 -1
- package/build/npm/types/integrations-bundle/index.dedupe.d.ts +1 -1
- package/build/npm/types/integrations-bundle/index.dedupe.d.ts.map +1 -1
- package/build/npm/types/integrations-bundle/index.extraerrordata.d.ts +1 -1
- package/build/npm/types/integrations-bundle/index.extraerrordata.d.ts.map +1 -1
- package/build/npm/types/integrations-bundle/index.feedback.d.ts +1 -1
- package/build/npm/types/integrations-bundle/index.feedback.d.ts.map +1 -1
- package/build/npm/types/integrations-bundle/index.instrumentanthropicaiclient.d.ts +1 -1
- package/build/npm/types/integrations-bundle/index.instrumentanthropicaiclient.d.ts.map +1 -1
- package/build/npm/types/integrations-bundle/index.instrumentgooglegenaiclient.d.ts +1 -1
- package/build/npm/types/integrations-bundle/index.instrumentgooglegenaiclient.d.ts.map +1 -1
- package/build/npm/types/integrations-bundle/index.instrumentlangchainembeddings.d.ts +1 -1
- package/build/npm/types/integrations-bundle/index.instrumentlangchainembeddings.d.ts.map +1 -1
- package/build/npm/types/integrations-bundle/index.instrumentlanggraph.d.ts +1 -1
- package/build/npm/types/integrations-bundle/index.instrumentlanggraph.d.ts.map +1 -1
- package/build/npm/types/integrations-bundle/index.instrumentopenaiclient.d.ts +1 -1
- package/build/npm/types/integrations-bundle/index.instrumentopenaiclient.d.ts.map +1 -1
- package/build/npm/types/integrations-bundle/index.modulemetadata.d.ts +1 -1
- package/build/npm/types/integrations-bundle/index.modulemetadata.d.ts.map +1 -1
- package/build/npm/types/integrations-bundle/index.rewriteframes.d.ts +1 -1
- package/build/npm/types/integrations-bundle/index.rewriteframes.d.ts.map +1 -1
- package/build/npm/types/pluggable-exports-bundle/index.multiplexedtransport.d.ts +1 -1
- package/build/npm/types/pluggable-exports-bundle/index.multiplexedtransport.d.ts.map +1 -1
- package/build/npm/types/profiling/UIProfiler.d.ts +1 -1
- package/build/npm/types/profiling/UIProfiler.d.ts.map +1 -1
- package/build/npm/types/profiling/index.d.ts +1 -1
- package/build/npm/types/profiling/index.d.ts.map +1 -1
- package/build/npm/types/profiling/integration.d.ts.map +1 -1
- package/build/npm/types/profiling/startProfileForSpan.d.ts +1 -1
- package/build/npm/types/profiling/startProfileForSpan.d.ts.map +1 -1
- package/build/npm/types/profiling/utils.d.ts +3 -5
- package/build/npm/types/profiling/utils.d.ts.map +1 -1
- package/build/npm/types/report-dialog.d.ts +1 -1
- package/build/npm/types/report-dialog.d.ts.map +1 -1
- package/build/npm/types/sdk.d.ts +1 -1
- package/build/npm/types/sdk.d.ts.map +1 -1
- package/build/npm/types/stack-parsers.d.ts +1 -1
- package/build/npm/types/stack-parsers.d.ts.map +1 -1
- package/build/npm/types/tracing/browserTracingIntegration.d.ts +1 -1
- package/build/npm/types/tracing/browserTracingIntegration.d.ts.map +1 -1
- package/build/npm/types/tracing/linkedTraces.d.ts +2 -2
- package/build/npm/types/tracing/linkedTraces.d.ts.map +1 -1
- package/build/npm/types/tracing/reportPageLoaded.d.ts +1 -1
- package/build/npm/types/tracing/reportPageLoaded.d.ts.map +1 -1
- package/build/npm/types/tracing/request.d.ts +1 -1
- package/build/npm/types/tracing/request.d.ts.map +1 -1
- package/build/npm/types/tracing/setActiveSpan.d.ts +1 -1
- package/build/npm/types/tracing/setActiveSpan.d.ts.map +1 -1
- package/build/npm/types/transports/fetch.d.ts +1 -1
- package/build/npm/types/transports/fetch.d.ts.map +1 -1
- package/build/npm/types/transports/offline.d.ts +1 -1
- package/build/npm/types/transports/offline.d.ts.map +1 -1
- package/build/npm/types/transports/types.d.ts +1 -1
- package/build/npm/types/transports/types.d.ts.map +1 -1
- package/build/npm/types/userfeedback.d.ts +1 -1
- package/build/npm/types/userfeedback.d.ts.map +1 -1
- package/build/npm/types/utils/lazyLoadIntegration.d.ts +1 -1
- package/build/npm/types/utils/lazyLoadIntegration.d.ts.map +1 -1
- package/build/npm/types-ts3.8/client.d.ts +2 -2
- package/build/npm/types-ts3.8/eventbuilder.d.ts +1 -1
- package/build/npm/types-ts3.8/exports.d.ts +3 -3
- package/build/npm/types-ts3.8/feedbackAsync.d.ts +2 -7
- package/build/npm/types-ts3.8/feedbackSync.d.ts +2 -7
- package/build/npm/types-ts3.8/helpers.d.ts +2 -2
- package/build/npm/types-ts3.8/index.bundle.logs.metrics.d.ts +1 -1
- package/build/npm/types-ts3.8/index.bundle.replay.logs.metrics.d.ts +1 -1
- package/build/npm/types-ts3.8/index.bundle.tracing.d.ts +1 -1
- package/build/npm/types-ts3.8/index.bundle.tracing.logs.metrics.d.ts +2 -2
- package/build/npm/types-ts3.8/index.bundle.tracing.replay.d.ts +1 -1
- package/build/npm/types-ts3.8/index.bundle.tracing.replay.feedback.d.ts +1 -1
- package/build/npm/types-ts3.8/index.bundle.tracing.replay.feedback.logs.metrics.d.ts +1 -1
- package/build/npm/types-ts3.8/index.bundle.tracing.replay.logs.metrics.d.ts +2 -2
- package/build/npm/types-ts3.8/index.d.ts +3 -3
- package/build/npm/types-ts3.8/integrations/contextlines.d.ts +1 -1
- package/build/npm/types-ts3.8/integrations/globalhandlers.d.ts +1 -1
- package/build/npm/types-ts3.8/integrations/spotlight.d.ts +4 -5
- package/build/npm/types-ts3.8/integrations/view-hierarchy.d.ts +1 -1
- package/build/npm/types-ts3.8/integrations/webWorker.d.ts +1 -1
- package/build/npm/types-ts3.8/integrations-bundle/index.captureconsole.d.ts +1 -1
- package/build/npm/types-ts3.8/integrations-bundle/index.createlangchaincallbackhandler.d.ts +1 -1
- package/build/npm/types-ts3.8/integrations-bundle/index.dedupe.d.ts +1 -1
- package/build/npm/types-ts3.8/integrations-bundle/index.extraerrordata.d.ts +1 -1
- package/build/npm/types-ts3.8/integrations-bundle/index.feedback.d.ts +1 -1
- package/build/npm/types-ts3.8/integrations-bundle/index.instrumentanthropicaiclient.d.ts +1 -1
- package/build/npm/types-ts3.8/integrations-bundle/index.instrumentgooglegenaiclient.d.ts +1 -1
- package/build/npm/types-ts3.8/integrations-bundle/index.instrumentlangchainembeddings.d.ts +1 -1
- package/build/npm/types-ts3.8/integrations-bundle/index.instrumentlanggraph.d.ts +1 -1
- package/build/npm/types-ts3.8/integrations-bundle/index.instrumentopenaiclient.d.ts +1 -1
- package/build/npm/types-ts3.8/integrations-bundle/index.modulemetadata.d.ts +1 -1
- package/build/npm/types-ts3.8/integrations-bundle/index.rewriteframes.d.ts +1 -1
- package/build/npm/types-ts3.8/pluggable-exports-bundle/index.multiplexedtransport.d.ts +1 -1
- package/build/npm/types-ts3.8/profiling/UIProfiler.d.ts +1 -1
- package/build/npm/types-ts3.8/profiling/index.d.ts +1 -1
- package/build/npm/types-ts3.8/profiling/startProfileForSpan.d.ts +1 -1
- package/build/npm/types-ts3.8/profiling/utils.d.ts +3 -5
- package/build/npm/types-ts3.8/report-dialog.d.ts +1 -1
- package/build/npm/types-ts3.8/sdk.d.ts +1 -1
- package/build/npm/types-ts3.8/stack-parsers.d.ts +1 -1
- package/build/npm/types-ts3.8/tracing/browserTracingIntegration.d.ts +1 -1
- package/build/npm/types-ts3.8/tracing/linkedTraces.d.ts +2 -2
- package/build/npm/types-ts3.8/tracing/reportPageLoaded.d.ts +1 -1
- package/build/npm/types-ts3.8/tracing/request.d.ts +1 -1
- package/build/npm/types-ts3.8/tracing/setActiveSpan.d.ts +1 -1
- package/build/npm/types-ts3.8/transports/fetch.d.ts +1 -1
- package/build/npm/types-ts3.8/transports/offline.d.ts +1 -1
- package/build/npm/types-ts3.8/transports/types.d.ts +1 -1
- package/build/npm/types-ts3.8/userfeedback.d.ts +1 -1
- package/build/npm/types-ts3.8/utils/lazyLoadIntegration.d.ts +1 -1
- package/package.json +7 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"integration.js","sources":["../../../../../../../src/integrations/featureFlags/openfeature/integration.ts"],"sourcesContent":["/**\n * Sentry integration for capturing OpenFeature feature flag evaluations.\n *\n * See the [feature flag documentation](https://develop.sentry.dev/sdk/expected-features/#feature-flags) for more information.\n *\n * @example\n * ```\n * import * as Sentry from \"@sentry/browser\";\n * import { OpenFeature } from \"@openfeature/web-sdk\";\n *\n * Sentry.init(..., integrations: [Sentry.openFeatureIntegration()]);\n * OpenFeature.setProvider(new MyProviderOfChoice());\n * OpenFeature.addHooks(new Sentry.OpenFeatureIntegrationHook());\n * ```\n */\nimport type { Client, Event, EventHint, IntegrationFn } from '@sentry/core';\nimport {\n _INTERNAL_addFeatureFlagToActiveSpan,\n _INTERNAL_copyFlagsFromScopeToEvent,\n _INTERNAL_insertFlagToScope,\n defineIntegration,\n} from '@sentry/core';\nimport type { EvaluationDetails, HookContext, HookHints, JsonValue, OpenFeatureHook } from './types';\n\nexport const openFeatureIntegration = defineIntegration(() => {\n return {\n name: 'OpenFeature',\n\n processEvent(event: Event, _hint: EventHint, _client: Client): Event {\n return _INTERNAL_copyFlagsFromScopeToEvent(event);\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * OpenFeature Hook class implementation.\n */\nexport class OpenFeatureIntegrationHook implements OpenFeatureHook {\n /**\n * Successful evaluation result.\n */\n public after(_hookContext: Readonly<HookContext<JsonValue>>, evaluationDetails: EvaluationDetails<JsonValue>): void {\n _INTERNAL_insertFlagToScope(evaluationDetails.flagKey, evaluationDetails.value);\n _INTERNAL_addFeatureFlagToActiveSpan(evaluationDetails.flagKey, evaluationDetails.value);\n }\n\n /**\n * On error evaluation result.\n */\n public error(hookContext: Readonly<HookContext<JsonValue>>, _error: unknown, _hookHints?: HookHints): void {\n _INTERNAL_insertFlagToScope(hookContext.flagKey, hookContext.defaultValue);\n _INTERNAL_addFeatureFlagToActiveSpan(hookContext.flagKey, hookContext.defaultValue);\n }\n}\n"],"names":["defineIntegration","_INTERNAL_copyFlagsFromScopeToEvent","_INTERNAL_insertFlagToScope","_INTERNAL_addFeatureFlagToActiveSpan"],"mappings":";;;;MAwBa,sBAAA,GAAyBA,
|
|
1
|
+
{"version":3,"file":"integration.js","sources":["../../../../../../../src/integrations/featureFlags/openfeature/integration.ts"],"sourcesContent":["/**\n * Sentry integration for capturing OpenFeature feature flag evaluations.\n *\n * See the [feature flag documentation](https://develop.sentry.dev/sdk/expected-features/#feature-flags) for more information.\n *\n * @example\n * ```\n * import * as Sentry from \"@sentry/browser\";\n * import { OpenFeature } from \"@openfeature/web-sdk\";\n *\n * Sentry.init(..., integrations: [Sentry.openFeatureIntegration()]);\n * OpenFeature.setProvider(new MyProviderOfChoice());\n * OpenFeature.addHooks(new Sentry.OpenFeatureIntegrationHook());\n * ```\n */\nimport type { Client, Event, EventHint, IntegrationFn } from '@sentry/core/browser';\nimport {\n _INTERNAL_addFeatureFlagToActiveSpan,\n _INTERNAL_copyFlagsFromScopeToEvent,\n _INTERNAL_insertFlagToScope,\n defineIntegration,\n} from '@sentry/core/browser';\nimport type { EvaluationDetails, HookContext, HookHints, JsonValue, OpenFeatureHook } from './types';\n\nexport const openFeatureIntegration = defineIntegration(() => {\n return {\n name: 'OpenFeature',\n\n processEvent(event: Event, _hint: EventHint, _client: Client): Event {\n return _INTERNAL_copyFlagsFromScopeToEvent(event);\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * OpenFeature Hook class implementation.\n */\nexport class OpenFeatureIntegrationHook implements OpenFeatureHook {\n /**\n * Successful evaluation result.\n */\n public after(_hookContext: Readonly<HookContext<JsonValue>>, evaluationDetails: EvaluationDetails<JsonValue>): void {\n _INTERNAL_insertFlagToScope(evaluationDetails.flagKey, evaluationDetails.value);\n _INTERNAL_addFeatureFlagToActiveSpan(evaluationDetails.flagKey, evaluationDetails.value);\n }\n\n /**\n * On error evaluation result.\n */\n public error(hookContext: Readonly<HookContext<JsonValue>>, _error: unknown, _hookHints?: HookHints): void {\n _INTERNAL_insertFlagToScope(hookContext.flagKey, hookContext.defaultValue);\n _INTERNAL_addFeatureFlagToActiveSpan(hookContext.flagKey, hookContext.defaultValue);\n }\n}\n"],"names":["defineIntegration","_INTERNAL_copyFlagsFromScopeToEvent","_INTERNAL_insertFlagToScope","_INTERNAL_addFeatureFlagToActiveSpan"],"mappings":";;;;MAwBa,sBAAA,GAAyBA,yBAAiB,CAAC,MAAM;AAC9D,EAAE,OAAO;AACT,IAAI,IAAI,EAAE,aAAa;;AAEvB,IAAI,YAAY,CAAC,KAAK,EAAS,KAAK,EAAa,OAAO,EAAiB;AACzE,MAAM,OAAOC,2CAAmC,CAAC,KAAK,CAAC;AACvD,IAAI,CAAC;AACL,GAAG;AACH,CAAC,CAAA;;AAED;AACA;AACA;AACO,MAAM,4BAAsD;AACnE;AACA;AACA;AACA,GAAS,KAAK,CAAC,YAAY,EAAoC,iBAAiB,EAAsC;AACtH,IAAIC,mCAA2B,CAAC,iBAAiB,CAAC,OAAO,EAAE,iBAAiB,CAAC,KAAK,CAAC;AACnF,IAAIC,4CAAoC,CAAC,iBAAiB,CAAC,OAAO,EAAE,iBAAiB,CAAC,KAAK,CAAC;AAC5F,EAAE;;AAEF;AACA;AACA;AACA,GAAS,KAAK,CAAC,WAAW,EAAoC,MAAM,EAAW,UAAU,EAAoB;AAC7G,IAAID,mCAA2B,CAAC,WAAW,CAAC,OAAO,EAAE,WAAW,CAAC,YAAY,CAAC;AAC9E,IAAIC,4CAAoC,CAAC,WAAW,CAAC,OAAO,EAAE,WAAW,CAAC,YAAY,CAAC;AACvF,EAAE;AACF;;;;;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
2
|
|
|
3
|
-
const
|
|
3
|
+
const browser = require('@sentry/core/browser');
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Sentry integration for capturing feature flag evaluations from the Statsig js-client SDK.
|
|
@@ -25,20 +25,20 @@ const core = require('@sentry/core');
|
|
|
25
25
|
* Sentry.captureException(new Error('something went wrong'));
|
|
26
26
|
* ```
|
|
27
27
|
*/
|
|
28
|
-
const statsigIntegration =
|
|
28
|
+
const statsigIntegration = browser.defineIntegration(
|
|
29
29
|
({ featureFlagClient: statsigClient }) => {
|
|
30
30
|
return {
|
|
31
31
|
name: 'Statsig',
|
|
32
32
|
|
|
33
33
|
setup(_client) {
|
|
34
34
|
statsigClient.on('gate_evaluation', (event) => {
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
browser._INTERNAL_insertFlagToScope(event.gate.name, event.gate.value);
|
|
36
|
+
browser._INTERNAL_addFeatureFlagToActiveSpan(event.gate.name, event.gate.value);
|
|
37
37
|
});
|
|
38
38
|
},
|
|
39
39
|
|
|
40
40
|
processEvent(event, _hint, _client) {
|
|
41
|
-
return
|
|
41
|
+
return browser._INTERNAL_copyFlagsFromScopeToEvent(event);
|
|
42
42
|
},
|
|
43
43
|
};
|
|
44
44
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"integration.js","sources":["../../../../../../../src/integrations/featureFlags/statsig/integration.ts"],"sourcesContent":["import type { Client, Event, EventHint, IntegrationFn } from '@sentry/core';\nimport {\n _INTERNAL_addFeatureFlagToActiveSpan,\n _INTERNAL_copyFlagsFromScopeToEvent,\n _INTERNAL_insertFlagToScope,\n defineIntegration,\n} from '@sentry/core';\nimport type { FeatureGate, StatsigClient } from './types';\n\n/**\n * Sentry integration for capturing feature flag evaluations from the Statsig js-client SDK.\n *\n * See the [feature flag documentation](https://develop.sentry.dev/sdk/expected-features/#feature-flags) for more information.\n *\n * @example\n * ```\n * import { StatsigClient } from '@statsig/js-client';\n * import * as Sentry from '@sentry/browser';\n *\n * const statsigClient = new StatsigClient();\n *\n * Sentry.init({\n * dsn: '___PUBLIC_DSN___',\n * integrations: [Sentry.statsigIntegration({featureFlagClient: statsigClient})],\n * });\n *\n * await statsigClient.initializeAsync(); // or statsigClient.initializeSync();\n *\n * const result = statsigClient.checkGate('my-feature-gate');\n * Sentry.captureException(new Error('something went wrong'));\n * ```\n */\nexport const statsigIntegration = defineIntegration(\n ({ featureFlagClient: statsigClient }: { featureFlagClient: StatsigClient }) => {\n return {\n name: 'Statsig',\n\n setup(_client: Client) {\n statsigClient.on('gate_evaluation', (event: { gate: FeatureGate }) => {\n _INTERNAL_insertFlagToScope(event.gate.name, event.gate.value);\n _INTERNAL_addFeatureFlagToActiveSpan(event.gate.name, event.gate.value);\n });\n },\n\n processEvent(event: Event, _hint: EventHint, _client: Client): Event {\n return _INTERNAL_copyFlagsFromScopeToEvent(event);\n },\n };\n },\n) satisfies IntegrationFn;\n"],"names":["defineIntegration","_INTERNAL_insertFlagToScope","_INTERNAL_addFeatureFlagToActiveSpan","_INTERNAL_copyFlagsFromScopeToEvent"],"mappings":";;;;AASA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAM,kBAAA,GAAqBA,
|
|
1
|
+
{"version":3,"file":"integration.js","sources":["../../../../../../../src/integrations/featureFlags/statsig/integration.ts"],"sourcesContent":["import type { Client, Event, EventHint, IntegrationFn } from '@sentry/core/browser';\nimport {\n _INTERNAL_addFeatureFlagToActiveSpan,\n _INTERNAL_copyFlagsFromScopeToEvent,\n _INTERNAL_insertFlagToScope,\n defineIntegration,\n} from '@sentry/core/browser';\nimport type { FeatureGate, StatsigClient } from './types';\n\n/**\n * Sentry integration for capturing feature flag evaluations from the Statsig js-client SDK.\n *\n * See the [feature flag documentation](https://develop.sentry.dev/sdk/expected-features/#feature-flags) for more information.\n *\n * @example\n * ```\n * import { StatsigClient } from '@statsig/js-client';\n * import * as Sentry from '@sentry/browser';\n *\n * const statsigClient = new StatsigClient();\n *\n * Sentry.init({\n * dsn: '___PUBLIC_DSN___',\n * integrations: [Sentry.statsigIntegration({featureFlagClient: statsigClient})],\n * });\n *\n * await statsigClient.initializeAsync(); // or statsigClient.initializeSync();\n *\n * const result = statsigClient.checkGate('my-feature-gate');\n * Sentry.captureException(new Error('something went wrong'));\n * ```\n */\nexport const statsigIntegration = defineIntegration(\n ({ featureFlagClient: statsigClient }: { featureFlagClient: StatsigClient }) => {\n return {\n name: 'Statsig',\n\n setup(_client: Client) {\n statsigClient.on('gate_evaluation', (event: { gate: FeatureGate }) => {\n _INTERNAL_insertFlagToScope(event.gate.name, event.gate.value);\n _INTERNAL_addFeatureFlagToActiveSpan(event.gate.name, event.gate.value);\n });\n },\n\n processEvent(event: Event, _hint: EventHint, _client: Client): Event {\n return _INTERNAL_copyFlagsFromScopeToEvent(event);\n },\n };\n },\n) satisfies IntegrationFn;\n"],"names":["defineIntegration","_INTERNAL_insertFlagToScope","_INTERNAL_addFeatureFlagToActiveSpan","_INTERNAL_copyFlagsFromScopeToEvent"],"mappings":";;;;AASA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAM,kBAAA,GAAqBA,yBAAiB;AACnD,EAAE,CAAC,EAAE,iBAAiB,EAAE,aAAA,EAAe,KAA2C;AAClF,IAAI,OAAO;AACX,MAAM,IAAI,EAAE,SAAS;;AAErB,MAAM,KAAK,CAAC,OAAO,EAAU;AAC7B,QAAQ,aAAa,CAAC,EAAE,CAAC,iBAAiB,EAAE,CAAC,KAAK,KAA4B;AAC9E,UAAUC,mCAA2B,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC;AACxE,UAAUC,4CAAoC,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC;AACjF,QAAQ,CAAC,CAAC;AACV,MAAM,CAAC;;AAEP,MAAM,YAAY,CAAC,KAAK,EAAS,KAAK,EAAa,OAAO,EAAiB;AAC3E,QAAQ,OAAOC,2CAAmC,CAAC,KAAK,CAAC;AACzD,MAAM,CAAC;AACP,KAAK;AACL,EAAE,CAAC;AACH,CAAA;;;;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
2
|
|
|
3
|
-
const
|
|
3
|
+
const browser = require('@sentry/core/browser');
|
|
4
4
|
const debugBuild = require('../../../debug-build.js');
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -25,18 +25,18 @@ const debugBuild = require('../../../debug-build.js');
|
|
|
25
25
|
* Sentry.captureException(new Error('something went wrong'));
|
|
26
26
|
* ```
|
|
27
27
|
*/
|
|
28
|
-
const unleashIntegration =
|
|
28
|
+
const unleashIntegration = browser.defineIntegration(
|
|
29
29
|
({ featureFlagClientClass: unleashClientClass }) => {
|
|
30
30
|
return {
|
|
31
31
|
name: 'Unleash',
|
|
32
32
|
|
|
33
33
|
setupOnce() {
|
|
34
34
|
const unleashClientPrototype = unleashClientClass.prototype ;
|
|
35
|
-
|
|
35
|
+
browser.fill(unleashClientPrototype, 'isEnabled', _wrappedIsEnabled);
|
|
36
36
|
},
|
|
37
37
|
|
|
38
38
|
processEvent(event, _hint, _client) {
|
|
39
|
-
return
|
|
39
|
+
return browser._INTERNAL_copyFlagsFromScopeToEvent(event);
|
|
40
40
|
},
|
|
41
41
|
};
|
|
42
42
|
},
|
|
@@ -59,10 +59,10 @@ function _wrappedIsEnabled(
|
|
|
59
59
|
const result = original.apply(this, args);
|
|
60
60
|
|
|
61
61
|
if (typeof toggleName === 'string' && typeof result === 'boolean') {
|
|
62
|
-
|
|
63
|
-
|
|
62
|
+
browser._INTERNAL_insertFlagToScope(toggleName, result);
|
|
63
|
+
browser._INTERNAL_addFeatureFlagToActiveSpan(toggleName, result);
|
|
64
64
|
} else if (debugBuild.DEBUG_BUILD) {
|
|
65
|
-
|
|
65
|
+
browser.debug.error(
|
|
66
66
|
`[Feature Flags] UnleashClient.isEnabled does not match expected signature. arg0: ${toggleName} (${typeof toggleName}), result: ${result} (${typeof result})`,
|
|
67
67
|
);
|
|
68
68
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"integration.js","sources":["../../../../../../../src/integrations/featureFlags/unleash/integration.ts"],"sourcesContent":["import type { Client, Event, EventHint, IntegrationFn } from '@sentry/core';\nimport {\n _INTERNAL_addFeatureFlagToActiveSpan,\n _INTERNAL_copyFlagsFromScopeToEvent,\n _INTERNAL_insertFlagToScope,\n debug,\n defineIntegration,\n fill,\n} from '@sentry/core';\nimport { DEBUG_BUILD } from '../../../debug-build';\nimport type { UnleashClient, UnleashClientClass } from './types';\n\ntype UnleashIntegrationOptions = {\n featureFlagClientClass: UnleashClientClass;\n};\n\n/**\n * Sentry integration for capturing feature flag evaluations from the Unleash SDK.\n *\n * See the [feature flag documentation](https://develop.sentry.dev/sdk/expected-features/#feature-flags) for more information.\n *\n * @example\n * ```\n * import { UnleashClient } from 'unleash-proxy-client';\n * import * as Sentry from '@sentry/browser';\n *\n * Sentry.init({\n * dsn: '___PUBLIC_DSN___',\n * integrations: [Sentry.unleashIntegration({featureFlagClientClass: UnleashClient})],\n * });\n *\n * const unleash = new UnleashClient(...);\n * unleash.start();\n *\n * unleash.isEnabled('my-feature');\n * Sentry.captureException(new Error('something went wrong'));\n * ```\n */\nexport const unleashIntegration = defineIntegration(\n ({ featureFlagClientClass: unleashClientClass }: UnleashIntegrationOptions) => {\n return {\n name: 'Unleash',\n\n setupOnce() {\n const unleashClientPrototype = unleashClientClass.prototype as UnleashClient;\n fill(unleashClientPrototype, 'isEnabled', _wrappedIsEnabled);\n },\n\n processEvent(event: Event, _hint: EventHint, _client: Client): Event {\n return _INTERNAL_copyFlagsFromScopeToEvent(event);\n },\n };\n },\n) satisfies IntegrationFn;\n\n/**\n * Wraps the UnleashClient.isEnabled method to capture feature flag evaluations. Its only side effect is writing to Sentry scope.\n *\n * This wrapper is safe for all isEnabled signatures. If the signature does not match (this: UnleashClient, toggleName: string, ...args: unknown[]) => boolean,\n * we log an error and return the original result.\n *\n * @param original - The original method.\n * @returns Wrapped method. Results should match the original.\n */\nfunction _wrappedIsEnabled(\n original: (this: UnleashClient, ...args: unknown[]) => unknown,\n): (this: UnleashClient, ...args: unknown[]) => unknown {\n return function (this: UnleashClient, ...args: unknown[]): unknown {\n const toggleName = args[0];\n const result = original.apply(this, args);\n\n if (typeof toggleName === 'string' && typeof result === 'boolean') {\n _INTERNAL_insertFlagToScope(toggleName, result);\n _INTERNAL_addFeatureFlagToActiveSpan(toggleName, result);\n } else if (DEBUG_BUILD) {\n debug.error(\n `[Feature Flags] UnleashClient.isEnabled does not match expected signature. arg0: ${toggleName} (${typeof toggleName}), result: ${result} (${typeof result})`,\n );\n }\n return result;\n };\n}\n"],"names":["defineIntegration","fill","_INTERNAL_copyFlagsFromScopeToEvent","_INTERNAL_insertFlagToScope","_INTERNAL_addFeatureFlagToActiveSpan","DEBUG_BUILD","debug"],"mappings":";;;;;AAgBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAM,kBAAA,GAAqBA,
|
|
1
|
+
{"version":3,"file":"integration.js","sources":["../../../../../../../src/integrations/featureFlags/unleash/integration.ts"],"sourcesContent":["import type { Client, Event, EventHint, IntegrationFn } from '@sentry/core/browser';\nimport {\n _INTERNAL_addFeatureFlagToActiveSpan,\n _INTERNAL_copyFlagsFromScopeToEvent,\n _INTERNAL_insertFlagToScope,\n debug,\n defineIntegration,\n fill,\n} from '@sentry/core/browser';\nimport { DEBUG_BUILD } from '../../../debug-build';\nimport type { UnleashClient, UnleashClientClass } from './types';\n\ntype UnleashIntegrationOptions = {\n featureFlagClientClass: UnleashClientClass;\n};\n\n/**\n * Sentry integration for capturing feature flag evaluations from the Unleash SDK.\n *\n * See the [feature flag documentation](https://develop.sentry.dev/sdk/expected-features/#feature-flags) for more information.\n *\n * @example\n * ```\n * import { UnleashClient } from 'unleash-proxy-client';\n * import * as Sentry from '@sentry/browser';\n *\n * Sentry.init({\n * dsn: '___PUBLIC_DSN___',\n * integrations: [Sentry.unleashIntegration({featureFlagClientClass: UnleashClient})],\n * });\n *\n * const unleash = new UnleashClient(...);\n * unleash.start();\n *\n * unleash.isEnabled('my-feature');\n * Sentry.captureException(new Error('something went wrong'));\n * ```\n */\nexport const unleashIntegration = defineIntegration(\n ({ featureFlagClientClass: unleashClientClass }: UnleashIntegrationOptions) => {\n return {\n name: 'Unleash',\n\n setupOnce() {\n const unleashClientPrototype = unleashClientClass.prototype as UnleashClient;\n fill(unleashClientPrototype, 'isEnabled', _wrappedIsEnabled);\n },\n\n processEvent(event: Event, _hint: EventHint, _client: Client): Event {\n return _INTERNAL_copyFlagsFromScopeToEvent(event);\n },\n };\n },\n) satisfies IntegrationFn;\n\n/**\n * Wraps the UnleashClient.isEnabled method to capture feature flag evaluations. Its only side effect is writing to Sentry scope.\n *\n * This wrapper is safe for all isEnabled signatures. If the signature does not match (this: UnleashClient, toggleName: string, ...args: unknown[]) => boolean,\n * we log an error and return the original result.\n *\n * @param original - The original method.\n * @returns Wrapped method. Results should match the original.\n */\nfunction _wrappedIsEnabled(\n original: (this: UnleashClient, ...args: unknown[]) => unknown,\n): (this: UnleashClient, ...args: unknown[]) => unknown {\n return function (this: UnleashClient, ...args: unknown[]): unknown {\n const toggleName = args[0];\n const result = original.apply(this, args);\n\n if (typeof toggleName === 'string' && typeof result === 'boolean') {\n _INTERNAL_insertFlagToScope(toggleName, result);\n _INTERNAL_addFeatureFlagToActiveSpan(toggleName, result);\n } else if (DEBUG_BUILD) {\n debug.error(\n `[Feature Flags] UnleashClient.isEnabled does not match expected signature. arg0: ${toggleName} (${typeof toggleName}), result: ${result} (${typeof result})`,\n );\n }\n return result;\n };\n}\n"],"names":["defineIntegration","fill","_INTERNAL_copyFlagsFromScopeToEvent","_INTERNAL_insertFlagToScope","_INTERNAL_addFeatureFlagToActiveSpan","DEBUG_BUILD","debug"],"mappings":";;;;;AAgBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAM,kBAAA,GAAqBA,yBAAiB;AACnD,EAAE,CAAC,EAAE,sBAAsB,EAAE,kBAAA,EAAoB,KAAgC;AACjF,IAAI,OAAO;AACX,MAAM,IAAI,EAAE,SAAS;;AAErB,MAAM,SAAS,GAAG;AAClB,QAAQ,MAAM,sBAAA,GAAyB,kBAAkB,CAAC,SAAA;AAC1D,QAAQC,YAAI,CAAC,sBAAsB,EAAE,WAAW,EAAE,iBAAiB,CAAC;AACpE,MAAM,CAAC;;AAEP,MAAM,YAAY,CAAC,KAAK,EAAS,KAAK,EAAa,OAAO,EAAiB;AAC3E,QAAQ,OAAOC,2CAAmC,CAAC,KAAK,CAAC;AACzD,MAAM,CAAC;AACP,KAAK;AACL,EAAE,CAAC;AACH,CAAA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,iBAAiB;AAC1B,EAAE,QAAQ;AACV,EAAwD;AACxD,EAAE,OAAO,WAA+B,GAAG,IAAI,EAAsB;AACrE,IAAI,MAAM,UAAA,GAAa,IAAI,CAAC,CAAC,CAAC;AAC9B,IAAI,MAAM,MAAA,GAAS,QAAQ,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC;;AAE7C,IAAI,IAAI,OAAO,UAAA,KAAe,QAAA,IAAY,OAAO,MAAA,KAAW,SAAS,EAAE;AACvE,MAAMC,mCAA2B,CAAC,UAAU,EAAE,MAAM,CAAC;AACrD,MAAMC,4CAAoC,CAAC,UAAU,EAAE,MAAM,CAAC;AAC9D,IAAI,CAAA,MAAO,IAAIC,sBAAW,EAAE;AAC5B,MAAMC,aAAK,CAAC,KAAK;AACjB,QAAQ,CAAC,iFAAiF,EAAE,UAAU,CAAC,EAAE,EAAE,OAAO,UAAU,CAAC,WAAW,EAAE,MAAM,CAAC,EAAE,EAAE,OAAO,MAAM,CAAC,CAAC,CAAC;AACrK,OAAO;AACP,IAAI;AACJ,IAAI,OAAO,MAAM;AACjB,EAAE,CAAC;AACH;;;;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
2
|
|
|
3
|
-
const
|
|
3
|
+
const browser = require('@sentry/core/browser');
|
|
4
4
|
const debugBuild = require('../debug-build.js');
|
|
5
5
|
const eventbuilder = require('../eventbuilder.js');
|
|
6
6
|
const helpers = require('../helpers.js');
|
|
@@ -32,13 +32,13 @@ const _globalHandlersIntegration = ((options = {}) => {
|
|
|
32
32
|
};
|
|
33
33
|
}) ;
|
|
34
34
|
|
|
35
|
-
const globalHandlersIntegration =
|
|
35
|
+
const globalHandlersIntegration = browser.defineIntegration(_globalHandlersIntegration);
|
|
36
36
|
|
|
37
37
|
function _installGlobalOnErrorHandler(client) {
|
|
38
|
-
|
|
38
|
+
browser.addGlobalErrorInstrumentationHandler(data => {
|
|
39
39
|
const { stackParser, attachStacktrace } = getOptions();
|
|
40
40
|
|
|
41
|
-
if (
|
|
41
|
+
if (browser.getClient() !== client || helpers.shouldIgnoreOnError()) {
|
|
42
42
|
return;
|
|
43
43
|
}
|
|
44
44
|
|
|
@@ -53,7 +53,7 @@ function _installGlobalOnErrorHandler(client) {
|
|
|
53
53
|
|
|
54
54
|
event.level = 'error';
|
|
55
55
|
|
|
56
|
-
|
|
56
|
+
browser.captureEvent(event, {
|
|
57
57
|
originalException: error,
|
|
58
58
|
mechanism: {
|
|
59
59
|
handled: false,
|
|
@@ -64,22 +64,22 @@ function _installGlobalOnErrorHandler(client) {
|
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
function _installGlobalOnUnhandledRejectionHandler(client) {
|
|
67
|
-
|
|
67
|
+
browser.addGlobalUnhandledRejectionInstrumentationHandler(e => {
|
|
68
68
|
const { stackParser, attachStacktrace } = getOptions();
|
|
69
69
|
|
|
70
|
-
if (
|
|
70
|
+
if (browser.getClient() !== client || helpers.shouldIgnoreOnError()) {
|
|
71
71
|
return;
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
const error = _getUnhandledRejectionError(e);
|
|
75
75
|
|
|
76
|
-
const event =
|
|
76
|
+
const event = browser.isPrimitive(error)
|
|
77
77
|
? _eventFromRejectionWithPrimitive(error)
|
|
78
78
|
: eventbuilder.eventFromUnknownInput(stackParser, error, undefined, attachStacktrace, true);
|
|
79
79
|
|
|
80
80
|
event.level = 'error';
|
|
81
81
|
|
|
82
|
-
|
|
82
|
+
browser.captureEvent(event, {
|
|
83
83
|
originalException: error,
|
|
84
84
|
mechanism: {
|
|
85
85
|
handled: false,
|
|
@@ -93,7 +93,7 @@ function _installGlobalOnUnhandledRejectionHandler(client) {
|
|
|
93
93
|
*
|
|
94
94
|
*/
|
|
95
95
|
function _getUnhandledRejectionError(error) {
|
|
96
|
-
if (
|
|
96
|
+
if (browser.isPrimitive(error)) {
|
|
97
97
|
return error;
|
|
98
98
|
}
|
|
99
99
|
|
|
@@ -160,8 +160,8 @@ function _enhanceEventWithInitialFrame(
|
|
|
160
160
|
ev0sf.push({
|
|
161
161
|
colno,
|
|
162
162
|
lineno,
|
|
163
|
-
filename: getFilenameFromUrl(url) ??
|
|
164
|
-
function:
|
|
163
|
+
filename: getFilenameFromUrl(url) ?? browser.getLocationHref(),
|
|
164
|
+
function: browser.UNKNOWN_FUNCTION,
|
|
165
165
|
in_app: true,
|
|
166
166
|
});
|
|
167
167
|
}
|
|
@@ -170,11 +170,11 @@ function _enhanceEventWithInitialFrame(
|
|
|
170
170
|
}
|
|
171
171
|
|
|
172
172
|
function globalHandlerLog(type) {
|
|
173
|
-
debugBuild.DEBUG_BUILD &&
|
|
173
|
+
debugBuild.DEBUG_BUILD && browser.debug.log(`Global Handler attached: ${type}`);
|
|
174
174
|
}
|
|
175
175
|
|
|
176
176
|
function getOptions() {
|
|
177
|
-
const client =
|
|
177
|
+
const client = browser.getClient();
|
|
178
178
|
const options = client?.getOptions() || {
|
|
179
179
|
stackParser: () => [],
|
|
180
180
|
attachStacktrace: false,
|
|
@@ -183,7 +183,7 @@ function getOptions() {
|
|
|
183
183
|
}
|
|
184
184
|
|
|
185
185
|
function getFilenameFromUrl(url) {
|
|
186
|
-
if (!
|
|
186
|
+
if (!browser.isString(url) || url.length === 0) {
|
|
187
187
|
return undefined;
|
|
188
188
|
}
|
|
189
189
|
|
|
@@ -192,7 +192,7 @@ function getFilenameFromUrl(url) {
|
|
|
192
192
|
// Don't include data prefix for filenames as it's not useful for stack traces
|
|
193
193
|
// Wrap with < > to indicate it's a placeholder
|
|
194
194
|
if (url.startsWith('data:')) {
|
|
195
|
-
return `<${
|
|
195
|
+
return `<${browser.stripDataUrlContent(url, false)}>`;
|
|
196
196
|
}
|
|
197
197
|
|
|
198
198
|
return url;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"globalhandlers.js","sources":["../../../../../src/integrations/globalhandlers.ts"],"sourcesContent":["import type { Client, Event, IntegrationFn, Primitive, StackParser } from '@sentry/core';\nimport {\n addGlobalErrorInstrumentationHandler,\n addGlobalUnhandledRejectionInstrumentationHandler,\n captureEvent,\n debug,\n defineIntegration,\n getClient,\n getLocationHref,\n isPrimitive,\n isString,\n stripDataUrlContent,\n UNKNOWN_FUNCTION,\n} from '@sentry/core';\nimport type { BrowserClient } from '../client';\nimport { DEBUG_BUILD } from '../debug-build';\nimport { eventFromUnknownInput } from '../eventbuilder';\nimport { shouldIgnoreOnError } from '../helpers';\n\ntype GlobalHandlersIntegrationsOptionKeys = 'onerror' | 'onunhandledrejection';\n\ntype GlobalHandlersIntegrations = Record<GlobalHandlersIntegrationsOptionKeys, boolean>;\n\nconst INTEGRATION_NAME = 'GlobalHandlers';\n\nconst _globalHandlersIntegration = ((options: Partial<GlobalHandlersIntegrations> = {}) => {\n const _options = {\n onerror: true,\n onunhandledrejection: true,\n ...options,\n };\n\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n Error.stackTraceLimit = 50;\n },\n setup(client) {\n if (_options.onerror) {\n _installGlobalOnErrorHandler(client);\n globalHandlerLog('onerror');\n }\n if (_options.onunhandledrejection) {\n _installGlobalOnUnhandledRejectionHandler(client);\n globalHandlerLog('onunhandledrejection');\n }\n },\n };\n}) satisfies IntegrationFn;\n\nexport const globalHandlersIntegration = defineIntegration(_globalHandlersIntegration);\n\nfunction _installGlobalOnErrorHandler(client: Client): void {\n addGlobalErrorInstrumentationHandler(data => {\n const { stackParser, attachStacktrace } = getOptions();\n\n if (getClient() !== client || shouldIgnoreOnError()) {\n return;\n }\n\n const { msg, url, line, column, error } = data;\n\n const event = _enhanceEventWithInitialFrame(\n eventFromUnknownInput(stackParser, error || msg, undefined, attachStacktrace, false),\n url,\n line,\n column,\n );\n\n event.level = 'error';\n\n captureEvent(event, {\n originalException: error,\n mechanism: {\n handled: false,\n type: 'auto.browser.global_handlers.onerror',\n },\n });\n });\n}\n\nfunction _installGlobalOnUnhandledRejectionHandler(client: Client): void {\n addGlobalUnhandledRejectionInstrumentationHandler(e => {\n const { stackParser, attachStacktrace } = getOptions();\n\n if (getClient() !== client || shouldIgnoreOnError()) {\n return;\n }\n\n const error = _getUnhandledRejectionError(e);\n\n const event = isPrimitive(error)\n ? _eventFromRejectionWithPrimitive(error)\n : eventFromUnknownInput(stackParser, error, undefined, attachStacktrace, true);\n\n event.level = 'error';\n\n captureEvent(event, {\n originalException: error,\n mechanism: {\n handled: false,\n type: 'auto.browser.global_handlers.onunhandledrejection',\n },\n });\n });\n}\n\n/**\n *\n */\nexport function _getUnhandledRejectionError(error: unknown): unknown {\n if (isPrimitive(error)) {\n return error;\n }\n\n // dig the object of the rejection out of known event types\n try {\n type ErrorWithReason = { reason: unknown };\n // PromiseRejectionEvents store the object of the rejection under 'reason'\n // see https://developer.mozilla.org/en-US/docs/Web/API/PromiseRejectionEvent\n if ('reason' in (error as ErrorWithReason)) {\n return (error as ErrorWithReason).reason;\n }\n\n type CustomEventWithDetail = { detail: { reason: unknown } };\n // something, somewhere, (likely a browser extension) effectively casts PromiseRejectionEvents\n // to CustomEvents, moving the `promise` and `reason` attributes of the PRE into\n // the CustomEvent's `detail` attribute, since they're not part of CustomEvent's spec\n // see https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent and\n // https://github.com/getsentry/sentry-javascript/issues/2380\n if ('detail' in (error as CustomEventWithDetail) && 'reason' in (error as CustomEventWithDetail).detail) {\n return (error as CustomEventWithDetail).detail.reason;\n }\n } catch {} // eslint-disable-line no-empty\n\n return error;\n}\n\n/**\n * Create an event from a promise rejection where the `reason` is a primitive.\n *\n * @param reason: The `reason` property of the promise rejection\n * @returns An Event object with an appropriate `exception` value\n */\nexport function _eventFromRejectionWithPrimitive(reason: Primitive): Event {\n return {\n exception: {\n values: [\n {\n type: 'UnhandledRejection',\n // String() is needed because the Primitive type includes symbols (which can't be automatically stringified)\n value: `Non-Error promise rejection captured with value: ${String(reason)}`,\n },\n ],\n },\n };\n}\n\nfunction _enhanceEventWithInitialFrame(\n event: Event,\n url: string | undefined,\n lineno: number | undefined,\n colno: number | undefined,\n): Event {\n // event.exception\n const e = (event.exception = event.exception || {});\n // event.exception.values\n const ev = (e.values = e.values || []);\n // event.exception.values[0]\n const ev0 = (ev[0] = ev[0] || {});\n // event.exception.values[0].stacktrace\n const ev0s = (ev0.stacktrace = ev0.stacktrace || {});\n // event.exception.values[0].stacktrace.frames\n const ev0sf = (ev0s.frames = ev0s.frames || []);\n\n if (ev0sf.length === 0) {\n ev0sf.push({\n colno,\n lineno,\n filename: getFilenameFromUrl(url) ?? getLocationHref(),\n function: UNKNOWN_FUNCTION,\n in_app: true,\n });\n }\n\n return event;\n}\n\nfunction globalHandlerLog(type: string): void {\n DEBUG_BUILD && debug.log(`Global Handler attached: ${type}`);\n}\n\nfunction getOptions(): { stackParser: StackParser; attachStacktrace?: boolean } {\n const client = getClient<BrowserClient>();\n const options = client?.getOptions() || {\n stackParser: () => [],\n attachStacktrace: false,\n };\n return options;\n}\n\nfunction getFilenameFromUrl(url: string | undefined): string | undefined {\n if (!isString(url) || url.length === 0) {\n return undefined;\n }\n\n // Strip data URL content to avoid long base64 strings in stack frames\n // (e.g. when initializing a Worker with a base64 encoded script)\n // Don't include data prefix for filenames as it's not useful for stack traces\n // Wrap with < > to indicate it's a placeholder\n if (url.startsWith('data:')) {\n return `<${stripDataUrlContent(url, false)}>`;\n }\n\n return url;\n}\n"],"names":["defineIntegration","addGlobalErrorInstrumentationHandler","getClient","shouldIgnoreOnError","eventFromUnknownInput","captureEvent","addGlobalUnhandledRejectionInstrumentationHandler","isPrimitive","getLocationHref","U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../../src/integrations/globalhandlers.ts"],"sourcesContent":["import type { Client, Event, IntegrationFn, Primitive, StackParser } from '@sentry/core/browser';\nimport {\n addGlobalErrorInstrumentationHandler,\n addGlobalUnhandledRejectionInstrumentationHandler,\n captureEvent,\n debug,\n defineIntegration,\n getClient,\n getLocationHref,\n isPrimitive,\n isString,\n stripDataUrlContent,\n UNKNOWN_FUNCTION,\n} from '@sentry/core/browser';\nimport type { BrowserClient } from '../client';\nimport { DEBUG_BUILD } from '../debug-build';\nimport { eventFromUnknownInput } from '../eventbuilder';\nimport { shouldIgnoreOnError } from '../helpers';\n\ntype GlobalHandlersIntegrationsOptionKeys = 'onerror' | 'onunhandledrejection';\n\ntype GlobalHandlersIntegrations = Record<GlobalHandlersIntegrationsOptionKeys, boolean>;\n\nconst INTEGRATION_NAME = 'GlobalHandlers';\n\nconst _globalHandlersIntegration = ((options: Partial<GlobalHandlersIntegrations> = {}) => {\n const _options = {\n onerror: true,\n onunhandledrejection: true,\n ...options,\n };\n\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n Error.stackTraceLimit = 50;\n },\n setup(client) {\n if (_options.onerror) {\n _installGlobalOnErrorHandler(client);\n globalHandlerLog('onerror');\n }\n if (_options.onunhandledrejection) {\n _installGlobalOnUnhandledRejectionHandler(client);\n globalHandlerLog('onunhandledrejection');\n }\n },\n };\n}) satisfies IntegrationFn;\n\nexport const globalHandlersIntegration = defineIntegration(_globalHandlersIntegration);\n\nfunction _installGlobalOnErrorHandler(client: Client): void {\n addGlobalErrorInstrumentationHandler(data => {\n const { stackParser, attachStacktrace } = getOptions();\n\n if (getClient() !== client || shouldIgnoreOnError()) {\n return;\n }\n\n const { msg, url, line, column, error } = data;\n\n const event = _enhanceEventWithInitialFrame(\n eventFromUnknownInput(stackParser, error || msg, undefined, attachStacktrace, false),\n url,\n line,\n column,\n );\n\n event.level = 'error';\n\n captureEvent(event, {\n originalException: error,\n mechanism: {\n handled: false,\n type: 'auto.browser.global_handlers.onerror',\n },\n });\n });\n}\n\nfunction _installGlobalOnUnhandledRejectionHandler(client: Client): void {\n addGlobalUnhandledRejectionInstrumentationHandler(e => {\n const { stackParser, attachStacktrace } = getOptions();\n\n if (getClient() !== client || shouldIgnoreOnError()) {\n return;\n }\n\n const error = _getUnhandledRejectionError(e);\n\n const event = isPrimitive(error)\n ? _eventFromRejectionWithPrimitive(error)\n : eventFromUnknownInput(stackParser, error, undefined, attachStacktrace, true);\n\n event.level = 'error';\n\n captureEvent(event, {\n originalException: error,\n mechanism: {\n handled: false,\n type: 'auto.browser.global_handlers.onunhandledrejection',\n },\n });\n });\n}\n\n/**\n *\n */\nexport function _getUnhandledRejectionError(error: unknown): unknown {\n if (isPrimitive(error)) {\n return error;\n }\n\n // dig the object of the rejection out of known event types\n try {\n type ErrorWithReason = { reason: unknown };\n // PromiseRejectionEvents store the object of the rejection under 'reason'\n // see https://developer.mozilla.org/en-US/docs/Web/API/PromiseRejectionEvent\n if ('reason' in (error as ErrorWithReason)) {\n return (error as ErrorWithReason).reason;\n }\n\n type CustomEventWithDetail = { detail: { reason: unknown } };\n // something, somewhere, (likely a browser extension) effectively casts PromiseRejectionEvents\n // to CustomEvents, moving the `promise` and `reason` attributes of the PRE into\n // the CustomEvent's `detail` attribute, since they're not part of CustomEvent's spec\n // see https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent and\n // https://github.com/getsentry/sentry-javascript/issues/2380\n if ('detail' in (error as CustomEventWithDetail) && 'reason' in (error as CustomEventWithDetail).detail) {\n return (error as CustomEventWithDetail).detail.reason;\n }\n } catch {} // eslint-disable-line no-empty\n\n return error;\n}\n\n/**\n * Create an event from a promise rejection where the `reason` is a primitive.\n *\n * @param reason: The `reason` property of the promise rejection\n * @returns An Event object with an appropriate `exception` value\n */\nexport function _eventFromRejectionWithPrimitive(reason: Primitive): Event {\n return {\n exception: {\n values: [\n {\n type: 'UnhandledRejection',\n // String() is needed because the Primitive type includes symbols (which can't be automatically stringified)\n value: `Non-Error promise rejection captured with value: ${String(reason)}`,\n },\n ],\n },\n };\n}\n\nfunction _enhanceEventWithInitialFrame(\n event: Event,\n url: string | undefined,\n lineno: number | undefined,\n colno: number | undefined,\n): Event {\n // event.exception\n const e = (event.exception = event.exception || {});\n // event.exception.values\n const ev = (e.values = e.values || []);\n // event.exception.values[0]\n const ev0 = (ev[0] = ev[0] || {});\n // event.exception.values[0].stacktrace\n const ev0s = (ev0.stacktrace = ev0.stacktrace || {});\n // event.exception.values[0].stacktrace.frames\n const ev0sf = (ev0s.frames = ev0s.frames || []);\n\n if (ev0sf.length === 0) {\n ev0sf.push({\n colno,\n lineno,\n filename: getFilenameFromUrl(url) ?? getLocationHref(),\n function: UNKNOWN_FUNCTION,\n in_app: true,\n });\n }\n\n return event;\n}\n\nfunction globalHandlerLog(type: string): void {\n DEBUG_BUILD && debug.log(`Global Handler attached: ${type}`);\n}\n\nfunction getOptions(): { stackParser: StackParser; attachStacktrace?: boolean } {\n const client = getClient<BrowserClient>();\n const options = client?.getOptions() || {\n stackParser: () => [],\n attachStacktrace: false,\n };\n return options;\n}\n\nfunction getFilenameFromUrl(url: string | undefined): string | undefined {\n if (!isString(url) || url.length === 0) {\n return undefined;\n }\n\n // Strip data URL content to avoid long base64 strings in stack frames\n // (e.g. when initializing a Worker with a base64 encoded script)\n // Don't include data prefix for filenames as it's not useful for stack traces\n // Wrap with < > to indicate it's a placeholder\n if (url.startsWith('data:')) {\n return `<${stripDataUrlContent(url, false)}>`;\n }\n\n return url;\n}\n"],"names":["defineIntegration","addGlobalErrorInstrumentationHandler","getClient","shouldIgnoreOnError","eventFromUnknownInput","captureEvent","addGlobalUnhandledRejectionInstrumentationHandler","isPrimitive","getLocationHref","UNKNOWN_FUNCTION","DEBUG_BUILD","debug","isString","stripDataUrlContent"],"mappings":";;;;;;;AAuBA,MAAM,gBAAA,GAAmB,gBAAgB;;AAEzC,MAAM,0BAAA,IAA8B,CAAC,OAAO,GAAwC,EAAE,KAAK;AAC3F,EAAE,MAAM,WAAW;AAC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IAAA,KAAA,CAAA,IAAA,CAAA;AACA,MAAA,KAAA;AACA,MAAA,MAAA;AACA,MAAA,QAAA,EAAA,kBAAA,CAAA,GAAA,CAAA,IAAAC,uBAAA,EAAA;AACA,MAAA,QAAA,EAAAC,wBAAA;AACA,MAAA,MAAA,EAAA,IAAA;AACA,KAAA,CAAA;AACA,EAAA;;AAEA,EAAA,OAAA,KAAA;AACA;;AAEA,SAAA,gBAAA,CAAA,IAAA,EAAA;AACA,EAAAC,sBAAA,IAAAC,aAAA,CAAA,GAAA,CAAA,CAAA,yBAAA,EAAA,IAAA,CAAA,CAAA,CAAA;AACA;;AAEA,SAAA,UAAA,GAAA;AACA,EAAA,MAAA,MAAA,GAAAT,iBAAA,EAAA;AACA,EAAA,MAAA,OAAA,GAAA,MAAA,EAAA,UAAA,EAAA,IAAA;AACA,IAAA,WAAA,EAAA,MAAA,EAAA;AACA,IAAA,gBAAA,EAAA,KAAA;AACA,GAAA;AACA,EAAA,OAAA,OAAA;AACA;;AAEA,SAAA,kBAAA,CAAA,GAAA,EAAA;AACA,EAAA,IAAA,CAAAU,gBAAA,CAAA,GAAA,CAAA,IAAA,GAAA,CAAA,MAAA,KAAA,CAAA,EAAA;AACA,IAAA,OAAA,SAAA;AACA,EAAA;;AAEA;AACA;AACA;AACA;AACA,EAAA,IAAA,GAAA,CAAA,UAAA,CAAA,OAAA,CAAA,EAAA;AACA,IAAA,OAAA,CAAA,CAAA,EAAAC,2BAAA,CAAA,GAAA,EAAA,KAAA,CAAA,CAAA,CAAA,CAAA;AACA,EAAA;;AAEA,EAAA,OAAA,GAAA;AACA;;;;;;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
2
|
|
|
3
|
-
const
|
|
3
|
+
const browser = require('@sentry/core/browser');
|
|
4
4
|
const browserUtils = require('@sentry-internal/browser-utils');
|
|
5
5
|
|
|
6
6
|
const INTEGRATION_NAME = 'GraphQLClient';
|
|
@@ -17,10 +17,10 @@ const _graphqlClientIntegration = ((options) => {
|
|
|
17
17
|
|
|
18
18
|
function _updateSpanWithGraphQLData(client, options) {
|
|
19
19
|
client.on('beforeOutgoingRequestSpan', (span, hint) => {
|
|
20
|
-
const spanJSON =
|
|
20
|
+
const spanJSON = browser.spanToJSON(span);
|
|
21
21
|
|
|
22
22
|
const spanAttributes = spanJSON.data || {};
|
|
23
|
-
const spanOp = spanAttributes[
|
|
23
|
+
const spanOp = spanAttributes[browser.SEMANTIC_ATTRIBUTE_SENTRY_OP];
|
|
24
24
|
|
|
25
25
|
const isHttpClientSpan = spanOp === 'http.client';
|
|
26
26
|
|
|
@@ -30,15 +30,15 @@ function _updateSpanWithGraphQLData(client, options) {
|
|
|
30
30
|
|
|
31
31
|
// Fall back to `url` because fetch instrumentation only sets `http.url` for absolute URLs;
|
|
32
32
|
// relative URLs end up only in `url` (see `getFetchSpanAttributes` in packages/core/src/fetch.ts).
|
|
33
|
-
const httpUrl = spanAttributes[
|
|
34
|
-
const httpMethod = spanAttributes[
|
|
33
|
+
const httpUrl = spanAttributes[browser.SEMANTIC_ATTRIBUTE_URL_FULL] || spanAttributes['http.url'] || spanAttributes['url'];
|
|
34
|
+
const httpMethod = spanAttributes[browser.SEMANTIC_ATTRIBUTE_HTTP_REQUEST_METHOD] || spanAttributes['http.method'];
|
|
35
35
|
|
|
36
|
-
if (!
|
|
36
|
+
if (!browser.isString(httpUrl) || !browser.isString(httpMethod)) {
|
|
37
37
|
return;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
const { endpoints } = options;
|
|
41
|
-
const isTracedGraphqlEndpoint =
|
|
41
|
+
const isTracedGraphqlEndpoint = browser.stringMatchesSomePattern(httpUrl, endpoints);
|
|
42
42
|
const payload = getRequestPayloadXhrOrFetch(hint );
|
|
43
43
|
|
|
44
44
|
if (isTracedGraphqlEndpoint && payload) {
|
|
@@ -75,7 +75,7 @@ function _updateBreadcrumbWithGraphQLData(client, options) {
|
|
|
75
75
|
const httpUrl = data?.url;
|
|
76
76
|
const { endpoints } = options;
|
|
77
77
|
|
|
78
|
-
const isTracedGraphqlEndpoint =
|
|
78
|
+
const isTracedGraphqlEndpoint = browser.stringMatchesSomePattern(httpUrl, endpoints);
|
|
79
79
|
const payload = getRequestPayloadXhrOrFetch(handlerData );
|
|
80
80
|
|
|
81
81
|
if (isTracedGraphqlEndpoint && data && payload) {
|
|
@@ -228,7 +228,7 @@ function getGraphQLRequestPayload(payload) {
|
|
|
228
228
|
* This integration ensures that GraphQL requests made in the browser
|
|
229
229
|
* have their GraphQL-specific data captured and attached to spans and breadcrumbs.
|
|
230
230
|
*/
|
|
231
|
-
const graphqlClientIntegration =
|
|
231
|
+
const graphqlClientIntegration = browser.defineIntegration(_graphqlClientIntegration);
|
|
232
232
|
|
|
233
233
|
exports._getGraphQLOperation = _getGraphQLOperation;
|
|
234
234
|
exports.getGraphQLRequestPayload = getGraphQLRequestPayload;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graphqlClient.js","sources":["../../../../../src/integrations/graphqlClient.ts"],"sourcesContent":["import type { Client, IntegrationFn } from '@sentry/core';\nimport {\n defineIntegration,\n isString,\n SEMANTIC_ATTRIBUTE_HTTP_REQUEST_METHOD,\n SEMANTIC_ATTRIBUTE_SENTRY_OP,\n SEMANTIC_ATTRIBUTE_URL_FULL,\n spanToJSON,\n stringMatchesSomePattern,\n} from '@sentry/core';\nimport type { FetchHint, XhrHint } from '@sentry-internal/browser-utils';\nimport { getBodyString, getFetchRequestArgBody, SENTRY_XHR_DATA_KEY } from '@sentry-internal/browser-utils';\n\ninterface GraphQLClientOptions {\n endpoints: Array<string | RegExp>;\n}\n\n/** Standard graphql request shape: https://graphql.org/learn/serving-over-http/#post-request-and-body */\ninterface GraphQLStandardRequest {\n query: string;\n operationName?: string;\n variables?: Record<string, unknown>;\n extensions?: Record<string, unknown>;\n}\n\n/** Persisted operation request */\ninterface GraphQLPersistedRequest {\n operationName: string;\n variables?: Record<string, unknown>;\n extensions: {\n persistedQuery: {\n version: number;\n sha256Hash: string;\n };\n } & Record<string, unknown>;\n}\n\ntype GraphQLRequestPayload = GraphQLStandardRequest | GraphQLPersistedRequest;\n\ninterface GraphQLOperation {\n operationType?: string;\n operationName?: string;\n}\n\nconst INTEGRATION_NAME = 'GraphQLClient';\n\nconst _graphqlClientIntegration = ((options: GraphQLClientOptions) => {\n return {\n name: INTEGRATION_NAME,\n setup(client: Client) {\n _updateSpanWithGraphQLData(client, options);\n _updateBreadcrumbWithGraphQLData(client, options);\n },\n };\n}) satisfies IntegrationFn;\n\nfunction _updateSpanWithGraphQLData(client: Client, options: GraphQLClientOptions): void {\n client.on('beforeOutgoingRequestSpan', (span, hint) => {\n const spanJSON = spanToJSON(span);\n\n const spanAttributes = spanJSON.data || {};\n const spanOp = spanAttributes[SEMANTIC_ATTRIBUTE_SENTRY_OP];\n\n const isHttpClientSpan = spanOp === 'http.client';\n\n if (!isHttpClientSpan) {\n return;\n }\n\n // Fall back to `url` because fetch instrumentation only sets `http.url` for absolute URLs;\n // relative URLs end up only in `url` (see `getFetchSpanAttributes` in packages/core/src/fetch.ts).\n const httpUrl = spanAttributes[SEMANTIC_ATTRIBUTE_URL_FULL] || spanAttributes['http.url'] || spanAttributes['url'];\n const httpMethod = spanAttributes[SEMANTIC_ATTRIBUTE_HTTP_REQUEST_METHOD] || spanAttributes['http.method'];\n\n if (!isString(httpUrl) || !isString(httpMethod)) {\n return;\n }\n\n const { endpoints } = options;\n const isTracedGraphqlEndpoint = stringMatchesSomePattern(httpUrl, endpoints);\n const payload = getRequestPayloadXhrOrFetch(hint as XhrHint | FetchHint);\n\n if (isTracedGraphqlEndpoint && payload) {\n const graphqlBody = getGraphQLRequestPayload(payload);\n\n if (graphqlBody) {\n const operationInfo = _getGraphQLOperation(graphqlBody);\n span.updateName(`${httpMethod} ${httpUrl} (${operationInfo})`);\n\n // Handle standard requests - always capture the query document\n if (isStandardRequest(graphqlBody)) {\n span.setAttribute('graphql.document', graphqlBody.query);\n }\n\n // Handle persisted operations - capture hash for debugging\n if (isPersistedRequest(graphqlBody)) {\n span.setAttribute('graphql.persisted_query.hash.sha256', graphqlBody.extensions.persistedQuery.sha256Hash);\n span.setAttribute('graphql.persisted_query.version', graphqlBody.extensions.persistedQuery.version);\n }\n }\n }\n });\n}\n\nfunction _updateBreadcrumbWithGraphQLData(client: Client, options: GraphQLClientOptions): void {\n client.on('beforeOutgoingRequestBreadcrumb', (breadcrumb, handlerData) => {\n const { category, type, data } = breadcrumb;\n\n const isFetch = category === 'fetch';\n const isXhr = category === 'xhr';\n const isHttpBreadcrumb = type === 'http';\n\n if (isHttpBreadcrumb && (isFetch || isXhr)) {\n const httpUrl = data?.url;\n const { endpoints } = options;\n\n const isTracedGraphqlEndpoint = stringMatchesSomePattern(httpUrl, endpoints);\n const payload = getRequestPayloadXhrOrFetch(handlerData as XhrHint | FetchHint);\n\n if (isTracedGraphqlEndpoint && data && payload) {\n const graphqlBody = getGraphQLRequestPayload(payload);\n\n if (!data.graphql && graphqlBody) {\n const operationInfo = _getGraphQLOperation(graphqlBody);\n\n data['graphql.operation'] = operationInfo;\n\n if (isStandardRequest(graphqlBody)) {\n data['graphql.document'] = graphqlBody.query;\n }\n\n if (isPersistedRequest(graphqlBody)) {\n data['graphql.persisted_query.hash.sha256'] = graphqlBody.extensions.persistedQuery.sha256Hash;\n data['graphql.persisted_query.version'] = graphqlBody.extensions.persistedQuery.version;\n }\n }\n }\n }\n });\n}\n\n/**\n * @param requestBody - GraphQL request\n * @returns A formatted version of the request: 'TYPE NAME' or 'TYPE' or 'persisted NAME'\n */\nexport function _getGraphQLOperation(requestBody: GraphQLRequestPayload): string {\n // Handle persisted operations\n if (isPersistedRequest(requestBody)) {\n return `persisted ${requestBody.operationName}`;\n }\n\n // Handle standard GraphQL requests\n if (isStandardRequest(requestBody)) {\n const { query: graphqlQuery, operationName: graphqlOperationName } = requestBody;\n const { operationName = graphqlOperationName, operationType } = parseGraphQLQuery(graphqlQuery);\n const operationInfo = operationName ? `${operationType} ${operationName}` : `${operationType}`;\n return operationInfo;\n }\n\n // Fallback for unknown request types\n return 'unknown';\n}\n\n/**\n * Get the request body/payload based on the shape of the hint.\n *\n * Exported for tests only.\n */\nexport function getRequestPayloadXhrOrFetch(hint: XhrHint | FetchHint): string | undefined {\n const isXhr = 'xhr' in hint;\n\n let body: string | undefined;\n\n if (isXhr) {\n const sentryXhrData = hint.xhr[SENTRY_XHR_DATA_KEY];\n body = sentryXhrData && getBodyString(sentryXhrData.body)[0];\n } else {\n const sentryFetchData = getFetchRequestArgBody(hint.input);\n body = getBodyString(sentryFetchData)[0];\n }\n\n return body;\n}\n\n/**\n * Extract the name and type of the operation from the GraphQL query.\n *\n * Exported for tests only.\n */\nexport function parseGraphQLQuery(query: string): GraphQLOperation {\n const namedQueryRe = /^(?:\\s*)(query|mutation|subscription)(?:\\s*)(\\w+)(?:\\s*)[{(]/;\n const unnamedQueryRe = /^(?:\\s*)(query|mutation|subscription)(?:\\s*)[{(]/;\n\n const namedMatch = query.match(namedQueryRe);\n if (namedMatch) {\n return {\n operationType: namedMatch[1],\n operationName: namedMatch[2],\n };\n }\n\n const unnamedMatch = query.match(unnamedQueryRe);\n if (unnamedMatch) {\n return {\n operationType: unnamedMatch[1],\n operationName: undefined,\n };\n }\n return {\n operationType: undefined,\n operationName: undefined,\n };\n}\n\n/**\n * Helper to safely check if a value is a non-null object\n */\nfunction isObject(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null;\n}\n\n/**\n * Type guard to check if a request is a standard GraphQL request\n */\nfunction isStandardRequest(payload: unknown): payload is GraphQLStandardRequest {\n return isObject(payload) && typeof payload.query === 'string';\n}\n\n/**\n * Type guard to check if a request is a persisted operation request\n */\nfunction isPersistedRequest(payload: unknown): payload is GraphQLPersistedRequest {\n return (\n isObject(payload) &&\n typeof payload.operationName === 'string' &&\n isObject(payload.extensions) &&\n isObject(payload.extensions.persistedQuery) &&\n typeof payload.extensions.persistedQuery.sha256Hash === 'string' &&\n typeof payload.extensions.persistedQuery.version === 'number'\n );\n}\n\n/**\n * Extract the payload of a request if it's GraphQL.\n * Exported for tests only.\n * @param payload - A valid JSON string\n * @returns A POJO or undefined\n */\nexport function getGraphQLRequestPayload(payload: string): GraphQLRequestPayload | undefined {\n try {\n const requestBody = JSON.parse(payload);\n\n // Return any valid GraphQL request (standard, persisted, or APQ retry with both)\n if (isStandardRequest(requestBody) || isPersistedRequest(requestBody)) {\n return requestBody;\n }\n\n // Not a GraphQL request\n return undefined;\n } catch {\n // Invalid JSON\n return undefined;\n }\n}\n\n/**\n * This integration ensures that GraphQL requests made in the browser\n * have their GraphQL-specific data captured and attached to spans and breadcrumbs.\n */\nexport const graphqlClientIntegration = defineIntegration(_graphqlClientIntegration);\n"],"names":["spanToJSON","SEMANTIC_ATTRIBUTE_SENTRY_OP","SEMANTIC_ATTRIBUTE_URL_FULL","SEMANTIC_ATTRIBUTE_HTTP_REQUEST_METHOD","isString","stringMatchesSomePattern","SENTRY_XHR_DATA_KEY","getBodyString","getFetchRequestArgBody","defineIntegration"],"mappings":";;;;;AA4CA,MAAM,gBAAA,GAAmB,eAAe;;AAExC,MAAM,6BAA6B,CAAC,OAAO,KAA2B;AACtE,EAAE,OAAO;AACT,IAAI,IAAI,EAAE,gBAAgB;AAC1B,IAAI,KAAK,CAAC,MAAM,EAAU;AAC1B,MAAM,0BAA0B,CAAC,MAAM,EAAE,OAAO,CAAC;AACjD,MAAM,gCAAgC,CAAC,MAAM,EAAE,OAAO,CAAC;AACvD,IAAI,CAAC;AACL,GAAG;AACH,CAAC,CAAA;;AAED,SAAS,0BAA0B,CAAC,MAAM,EAAU,OAAO,EAA8B;AACzF,EAAE,MAAM,CAAC,EAAE,CAAC,2BAA2B,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK;AACzD,IAAI,MAAM,QAAA,GAAWA,eAAU,CAAC,IAAI,CAAC;;AAErC,IAAI,MAAM,iBAAiB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A,IAAA,QAAA,CAAA,OAAA,CAAA;AACA,IAAA,OAAA,OAAA,CAAA,aAAA,KAAA,QAAA;AACA,IAAA,QAAA,CAAA,OAAA,CAAA,UAAA,CAAA;AACA,IAAA,QAAA,CAAA,OAAA,CAAA,UAAA,CAAA,cAAA,CAAA;AACA,IAAA,OAAA,OAAA,CAAA,UAAA,CAAA,cAAA,CAAA,UAAA,KAAA,QAAA;AACA,IAAA,OAAA,OAAA,CAAA,UAAA,CAAA,cAAA,CAAA,OAAA,KAAA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAA,wBAAA,CAAA,OAAA,EAAA;AACA,EAAA,IAAA;AACA,IAAA,MAAA,WAAA,GAAA,IAAA,CAAA,KAAA,CAAA,OAAA,CAAA;;AAEA;AACA,IAAA,IAAA,iBAAA,CAAA,WAAA,CAAA,IAAA,kBAAA,CAAA,WAAA,CAAA,EAAA;AACA,MAAA,OAAA,WAAA;AACA,IAAA;;AAEA;AACA,IAAA,OAAA,SAAA;AACA,EAAA,CAAA,CAAA,MAAA;AACA;AACA,IAAA,OAAA,SAAA;AACA,EAAA;AACA;;AAEA;AACA;AACA;AACA;AACA,MAAA,wBAAA,GAAAE,sBAAA,CAAA,yBAAA;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"graphqlClient.js","sources":["../../../../../src/integrations/graphqlClient.ts"],"sourcesContent":["import type { Client, IntegrationFn } from '@sentry/core/browser';\nimport {\n defineIntegration,\n isString,\n SEMANTIC_ATTRIBUTE_HTTP_REQUEST_METHOD,\n SEMANTIC_ATTRIBUTE_SENTRY_OP,\n SEMANTIC_ATTRIBUTE_URL_FULL,\n spanToJSON,\n stringMatchesSomePattern,\n} from '@sentry/core/browser';\nimport type { FetchHint, XhrHint } from '@sentry-internal/browser-utils';\nimport { getBodyString, getFetchRequestArgBody, SENTRY_XHR_DATA_KEY } from '@sentry-internal/browser-utils';\n\ninterface GraphQLClientOptions {\n endpoints: Array<string | RegExp>;\n}\n\n/** Standard graphql request shape: https://graphql.org/learn/serving-over-http/#post-request-and-body */\ninterface GraphQLStandardRequest {\n query: string;\n operationName?: string;\n variables?: Record<string, unknown>;\n extensions?: Record<string, unknown>;\n}\n\n/** Persisted operation request */\ninterface GraphQLPersistedRequest {\n operationName: string;\n variables?: Record<string, unknown>;\n extensions: {\n persistedQuery: {\n version: number;\n sha256Hash: string;\n };\n } & Record<string, unknown>;\n}\n\ntype GraphQLRequestPayload = GraphQLStandardRequest | GraphQLPersistedRequest;\n\ninterface GraphQLOperation {\n operationType?: string;\n operationName?: string;\n}\n\nconst INTEGRATION_NAME = 'GraphQLClient';\n\nconst _graphqlClientIntegration = ((options: GraphQLClientOptions) => {\n return {\n name: INTEGRATION_NAME,\n setup(client: Client) {\n _updateSpanWithGraphQLData(client, options);\n _updateBreadcrumbWithGraphQLData(client, options);\n },\n };\n}) satisfies IntegrationFn;\n\nfunction _updateSpanWithGraphQLData(client: Client, options: GraphQLClientOptions): void {\n client.on('beforeOutgoingRequestSpan', (span, hint) => {\n const spanJSON = spanToJSON(span);\n\n const spanAttributes = spanJSON.data || {};\n const spanOp = spanAttributes[SEMANTIC_ATTRIBUTE_SENTRY_OP];\n\n const isHttpClientSpan = spanOp === 'http.client';\n\n if (!isHttpClientSpan) {\n return;\n }\n\n // Fall back to `url` because fetch instrumentation only sets `http.url` for absolute URLs;\n // relative URLs end up only in `url` (see `getFetchSpanAttributes` in packages/core/src/fetch.ts).\n const httpUrl = spanAttributes[SEMANTIC_ATTRIBUTE_URL_FULL] || spanAttributes['http.url'] || spanAttributes['url'];\n const httpMethod = spanAttributes[SEMANTIC_ATTRIBUTE_HTTP_REQUEST_METHOD] || spanAttributes['http.method'];\n\n if (!isString(httpUrl) || !isString(httpMethod)) {\n return;\n }\n\n const { endpoints } = options;\n const isTracedGraphqlEndpoint = stringMatchesSomePattern(httpUrl, endpoints);\n const payload = getRequestPayloadXhrOrFetch(hint as XhrHint | FetchHint);\n\n if (isTracedGraphqlEndpoint && payload) {\n const graphqlBody = getGraphQLRequestPayload(payload);\n\n if (graphqlBody) {\n const operationInfo = _getGraphQLOperation(graphqlBody);\n span.updateName(`${httpMethod} ${httpUrl} (${operationInfo})`);\n\n // Handle standard requests - always capture the query document\n if (isStandardRequest(graphqlBody)) {\n span.setAttribute('graphql.document', graphqlBody.query);\n }\n\n // Handle persisted operations - capture hash for debugging\n if (isPersistedRequest(graphqlBody)) {\n span.setAttribute('graphql.persisted_query.hash.sha256', graphqlBody.extensions.persistedQuery.sha256Hash);\n span.setAttribute('graphql.persisted_query.version', graphqlBody.extensions.persistedQuery.version);\n }\n }\n }\n });\n}\n\nfunction _updateBreadcrumbWithGraphQLData(client: Client, options: GraphQLClientOptions): void {\n client.on('beforeOutgoingRequestBreadcrumb', (breadcrumb, handlerData) => {\n const { category, type, data } = breadcrumb;\n\n const isFetch = category === 'fetch';\n const isXhr = category === 'xhr';\n const isHttpBreadcrumb = type === 'http';\n\n if (isHttpBreadcrumb && (isFetch || isXhr)) {\n const httpUrl = data?.url;\n const { endpoints } = options;\n\n const isTracedGraphqlEndpoint = stringMatchesSomePattern(httpUrl, endpoints);\n const payload = getRequestPayloadXhrOrFetch(handlerData as XhrHint | FetchHint);\n\n if (isTracedGraphqlEndpoint && data && payload) {\n const graphqlBody = getGraphQLRequestPayload(payload);\n\n if (!data.graphql && graphqlBody) {\n const operationInfo = _getGraphQLOperation(graphqlBody);\n\n data['graphql.operation'] = operationInfo;\n\n if (isStandardRequest(graphqlBody)) {\n data['graphql.document'] = graphqlBody.query;\n }\n\n if (isPersistedRequest(graphqlBody)) {\n data['graphql.persisted_query.hash.sha256'] = graphqlBody.extensions.persistedQuery.sha256Hash;\n data['graphql.persisted_query.version'] = graphqlBody.extensions.persistedQuery.version;\n }\n }\n }\n }\n });\n}\n\n/**\n * @param requestBody - GraphQL request\n * @returns A formatted version of the request: 'TYPE NAME' or 'TYPE' or 'persisted NAME'\n */\nexport function _getGraphQLOperation(requestBody: GraphQLRequestPayload): string {\n // Handle persisted operations\n if (isPersistedRequest(requestBody)) {\n return `persisted ${requestBody.operationName}`;\n }\n\n // Handle standard GraphQL requests\n if (isStandardRequest(requestBody)) {\n const { query: graphqlQuery, operationName: graphqlOperationName } = requestBody;\n const { operationName = graphqlOperationName, operationType } = parseGraphQLQuery(graphqlQuery);\n const operationInfo = operationName ? `${operationType} ${operationName}` : `${operationType}`;\n return operationInfo;\n }\n\n // Fallback for unknown request types\n return 'unknown';\n}\n\n/**\n * Get the request body/payload based on the shape of the hint.\n *\n * Exported for tests only.\n */\nexport function getRequestPayloadXhrOrFetch(hint: XhrHint | FetchHint): string | undefined {\n const isXhr = 'xhr' in hint;\n\n let body: string | undefined;\n\n if (isXhr) {\n const sentryXhrData = hint.xhr[SENTRY_XHR_DATA_KEY];\n body = sentryXhrData && getBodyString(sentryXhrData.body)[0];\n } else {\n const sentryFetchData = getFetchRequestArgBody(hint.input);\n body = getBodyString(sentryFetchData)[0];\n }\n\n return body;\n}\n\n/**\n * Extract the name and type of the operation from the GraphQL query.\n *\n * Exported for tests only.\n */\nexport function parseGraphQLQuery(query: string): GraphQLOperation {\n const namedQueryRe = /^(?:\\s*)(query|mutation|subscription)(?:\\s*)(\\w+)(?:\\s*)[{(]/;\n const unnamedQueryRe = /^(?:\\s*)(query|mutation|subscription)(?:\\s*)[{(]/;\n\n const namedMatch = query.match(namedQueryRe);\n if (namedMatch) {\n return {\n operationType: namedMatch[1],\n operationName: namedMatch[2],\n };\n }\n\n const unnamedMatch = query.match(unnamedQueryRe);\n if (unnamedMatch) {\n return {\n operationType: unnamedMatch[1],\n operationName: undefined,\n };\n }\n return {\n operationType: undefined,\n operationName: undefined,\n };\n}\n\n/**\n * Helper to safely check if a value is a non-null object\n */\nfunction isObject(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null;\n}\n\n/**\n * Type guard to check if a request is a standard GraphQL request\n */\nfunction isStandardRequest(payload: unknown): payload is GraphQLStandardRequest {\n return isObject(payload) && typeof payload.query === 'string';\n}\n\n/**\n * Type guard to check if a request is a persisted operation request\n */\nfunction isPersistedRequest(payload: unknown): payload is GraphQLPersistedRequest {\n return (\n isObject(payload) &&\n typeof payload.operationName === 'string' &&\n isObject(payload.extensions) &&\n isObject(payload.extensions.persistedQuery) &&\n typeof payload.extensions.persistedQuery.sha256Hash === 'string' &&\n typeof payload.extensions.persistedQuery.version === 'number'\n );\n}\n\n/**\n * Extract the payload of a request if it's GraphQL.\n * Exported for tests only.\n * @param payload - A valid JSON string\n * @returns A POJO or undefined\n */\nexport function getGraphQLRequestPayload(payload: string): GraphQLRequestPayload | undefined {\n try {\n const requestBody = JSON.parse(payload);\n\n // Return any valid GraphQL request (standard, persisted, or APQ retry with both)\n if (isStandardRequest(requestBody) || isPersistedRequest(requestBody)) {\n return requestBody;\n }\n\n // Not a GraphQL request\n return undefined;\n } catch {\n // Invalid JSON\n return undefined;\n }\n}\n\n/**\n * This integration ensures that GraphQL requests made in the browser\n * have their GraphQL-specific data captured and attached to spans and breadcrumbs.\n */\nexport const graphqlClientIntegration = defineIntegration(_graphqlClientIntegration);\n"],"names":["spanToJSON","SEMANTIC_ATTRIBUTE_SENTRY_OP","SEMANTIC_ATTRIBUTE_URL_FULL","SEMANTIC_ATTRIBUTE_HTTP_REQUEST_METHOD","isString","stringMatchesSomePattern","SENTRY_XHR_DATA_KEY","getBodyString","getFetchRequestArgBody","defineIntegration"],"mappings":";;;;;AA4CA,MAAM,gBAAA,GAAmB,eAAe;;AAExC,MAAM,6BAA6B,CAAC,OAAO,KAA2B;AACtE,EAAE,OAAO;AACT,IAAI,IAAI,EAAE,gBAAgB;AAC1B,IAAI,KAAK,CAAC,MAAM,EAAU;AAC1B,MAAM,0BAA0B,CAAC,MAAM,EAAE,OAAO,CAAC;AACjD,MAAM,gCAAgC,CAAC,MAAM,EAAE,OAAO,CAAC;AACvD,IAAI,CAAC;AACL,GAAG;AACH,CAAC,CAAA;;AAED,SAAS,0BAA0B,CAAC,MAAM,EAAU,OA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AAA,CAAA,OAAA,EAAA;AACA,EAAA,OAAA,QAAA,CAAA,OAAA,CAAA,IAAA,OAAA,OAAA,CAAA,KAAA,KAAA,QAAA;AACA;;AAEA;AACA;AACA;AACA,SAAA,kBAAA,CAAA,OAAA,EAAA;AACA,EAAA;AACA,IAAA,QAAA,CAAA,OAAA,CAAA;AACA,IAAA,OAAA,OAAA,CAAA,aAAA,KAAA,QAAA;AACA,IAAA,QAAA,CAAA,OAAA,CAAA,UAAA,CAAA;AACA,IAAA,QAAA,CAAA,OAAA,CAAA,UAAA,CAAA,cAAA,CAAA;AACA,IAAA,OAAA,OAAA,CAAA,UAAA,CAAA,cAAA,CAAA,UAAA,KAAA,QAAA;AACA,IAAA,OAAA,OAAA,CAAA,UAAA,CAAA,cAAA,CAAA,OAAA,KAAA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAA,wBAAA,CAAA,OAAA,EAAA;AACA,EAAA,IAAA;AACA,IAAA,MAAA,WAAA,GAAA,IAAA,CAAA,KAAA,CAAA,OAAA,CAAA;;AAEA;AACA,IAAA,IAAA,iBAAA,CAAA,WAAA,CAAA,IAAA,kBAAA,CAAA,WAAA,CAAA,EAAA;AACA,MAAA,OAAA,WAAA;AACA,IAAA;;AAEA;AACA,IAAA,OAAA,SAAA;AACA,EAAA,CAAA,CAAA,MAAA;AACA;AACA,IAAA,OAAA,SAAA;AACA,EAAA;AACA;;AAEA;AACA;AACA;AACA;AACA,MAAA,wBAAA,GAAAE,yBAAA,CAAA,yBAAA;;;;;;;;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
2
|
|
|
3
|
-
const
|
|
3
|
+
const browser = require('@sentry/core/browser');
|
|
4
4
|
const browserUtils = require('@sentry-internal/browser-utils');
|
|
5
5
|
const debugBuild = require('../debug-build.js');
|
|
6
6
|
|
|
@@ -25,7 +25,7 @@ const _httpClientIntegration = ((options = {}) => {
|
|
|
25
25
|
/**
|
|
26
26
|
* Create events for failed client side HTTP requests.
|
|
27
27
|
*/
|
|
28
|
-
const httpClientIntegration =
|
|
28
|
+
const httpClientIntegration = browser.defineIntegration(_httpClientIntegration);
|
|
29
29
|
|
|
30
30
|
/**
|
|
31
31
|
* Interceptor function for fetch requests
|
|
@@ -63,7 +63,7 @@ function _fetchResponseHandler(
|
|
|
63
63
|
type: 'fetch',
|
|
64
64
|
});
|
|
65
65
|
|
|
66
|
-
|
|
66
|
+
browser.captureEvent(event);
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
69
|
|
|
@@ -136,7 +136,7 @@ function _xhrResponseHandler(
|
|
|
136
136
|
type: 'xhr',
|
|
137
137
|
});
|
|
138
138
|
|
|
139
|
-
|
|
139
|
+
browser.captureEvent(event);
|
|
140
140
|
}
|
|
141
141
|
}
|
|
142
142
|
|
|
@@ -254,12 +254,12 @@ function _isInGivenStatusRanges(
|
|
|
254
254
|
* Wraps `fetch` function to capture request and response data
|
|
255
255
|
*/
|
|
256
256
|
function _wrapFetch(client, options) {
|
|
257
|
-
if (!
|
|
257
|
+
if (!browser.supportsNativeFetch()) {
|
|
258
258
|
return;
|
|
259
259
|
}
|
|
260
260
|
|
|
261
|
-
|
|
262
|
-
if (
|
|
261
|
+
browser.addFetchInstrumentationHandler(handlerData => {
|
|
262
|
+
if (browser.getClient() !== client) {
|
|
263
263
|
return;
|
|
264
264
|
}
|
|
265
265
|
|
|
@@ -278,12 +278,12 @@ function _wrapFetch(client, options) {
|
|
|
278
278
|
* Wraps XMLHttpRequest to capture request and response data
|
|
279
279
|
*/
|
|
280
280
|
function _wrapXHR(client, options) {
|
|
281
|
-
if (!('XMLHttpRequest' in
|
|
281
|
+
if (!('XMLHttpRequest' in browser.GLOBAL_OBJ)) {
|
|
282
282
|
return;
|
|
283
283
|
}
|
|
284
284
|
|
|
285
285
|
browserUtils.addXhrInstrumentationHandler(handlerData => {
|
|
286
|
-
if (
|
|
286
|
+
if (browser.getClient() !== client) {
|
|
287
287
|
return;
|
|
288
288
|
}
|
|
289
289
|
|
|
@@ -302,7 +302,7 @@ function _wrapXHR(client, options) {
|
|
|
302
302
|
try {
|
|
303
303
|
_xhrResponseHandler(options, xhr, method, headers, error || virtualError);
|
|
304
304
|
} catch (e) {
|
|
305
|
-
debugBuild.DEBUG_BUILD &&
|
|
305
|
+
debugBuild.DEBUG_BUILD && browser.debug.warn('Error while extracting response event form XHR response', e);
|
|
306
306
|
}
|
|
307
307
|
});
|
|
308
308
|
}
|
|
@@ -317,7 +317,7 @@ function _shouldCaptureResponse(options, status, url) {
|
|
|
317
317
|
return (
|
|
318
318
|
_isInGivenStatusRanges(options.failedRequestStatusCodes, status) &&
|
|
319
319
|
_isInGivenRequestTargets(options.failedRequestTargets, url) &&
|
|
320
|
-
!
|
|
320
|
+
!browser.isSentryRequestUrl(url, browser.getClient())
|
|
321
321
|
);
|
|
322
322
|
}
|
|
323
323
|
|
|
@@ -330,7 +330,7 @@ function _shouldCaptureResponse(options, status, url) {
|
|
|
330
330
|
function _createEvent(data
|
|
331
331
|
|
|
332
332
|
) {
|
|
333
|
-
const client =
|
|
333
|
+
const client = browser.getClient();
|
|
334
334
|
const virtualStackTrace = client && data.error && data.error instanceof Error ? data.error.stack : undefined;
|
|
335
335
|
// Remove the first frame from the stack as it's the HttpClient call
|
|
336
336
|
const stack = virtualStackTrace && client ? client.getOptions().stackParser(virtualStackTrace, 0, 1) : undefined;
|
|
@@ -363,7 +363,7 @@ function _createEvent(data
|
|
|
363
363
|
},
|
|
364
364
|
};
|
|
365
365
|
|
|
366
|
-
|
|
366
|
+
browser.addExceptionMechanism(event, {
|
|
367
367
|
type: `auto.http.client.${data.type}`,
|
|
368
368
|
handled: false,
|
|
369
369
|
});
|
|
@@ -387,7 +387,7 @@ function _getRequest(requestInfo, requestInit) {
|
|
|
387
387
|
}
|
|
388
388
|
|
|
389
389
|
function _shouldSendDefaultPii() {
|
|
390
|
-
const client =
|
|
390
|
+
const client = browser.getClient();
|
|
391
391
|
return client ? Boolean(client.getOptions().sendDefaultPii) : false;
|
|
392
392
|
}
|
|
393
393
|
|