@sentry/react-native 5.29.0 → 6.0.0-alpha.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/CHANGELOG.md +90 -0
- package/dist/js/client.d.ts +5 -9
- package/dist/js/client.d.ts.map +1 -1
- package/dist/js/client.js +11 -42
- package/dist/js/client.js.map +1 -1
- package/dist/js/index.d.ts +5 -10
- package/dist/js/index.d.ts.map +1 -1
- package/dist/js/index.js +4 -21
- package/dist/js/index.js.map +1 -1
- package/dist/js/integrations/debugsymbolicator.d.ts +2 -8
- package/dist/js/integrations/debugsymbolicator.d.ts.map +1 -1
- package/dist/js/integrations/debugsymbolicator.js +1 -9
- package/dist/js/integrations/debugsymbolicator.js.map +1 -1
- package/dist/js/integrations/default.d.ts.map +1 -1
- package/dist/js/integrations/default.js +18 -7
- package/dist/js/integrations/default.js.map +1 -1
- package/dist/js/integrations/devicecontext.d.ts +2 -8
- package/dist/js/integrations/devicecontext.d.ts.map +1 -1
- package/dist/js/integrations/devicecontext.js +0 -9
- package/dist/js/integrations/devicecontext.js.map +1 -1
- package/dist/js/integrations/eventorigin.d.ts +2 -8
- package/dist/js/integrations/eventorigin.d.ts.map +1 -1
- package/dist/js/integrations/eventorigin.js +0 -8
- package/dist/js/integrations/eventorigin.js.map +1 -1
- package/dist/js/integrations/expocontext.d.ts +2 -8
- package/dist/js/integrations/expocontext.d.ts.map +1 -1
- package/dist/js/integrations/expocontext.js +0 -8
- package/dist/js/integrations/expocontext.js.map +1 -1
- package/dist/js/integrations/exports.d.ts +4 -0
- package/dist/js/integrations/exports.d.ts.map +1 -1
- package/dist/js/integrations/exports.js +4 -0
- package/dist/js/integrations/exports.js.map +1 -1
- package/dist/js/integrations/modulesloader.d.ts +2 -8
- package/dist/js/integrations/modulesloader.d.ts.map +1 -1
- package/dist/js/integrations/modulesloader.js +0 -8
- package/dist/js/integrations/modulesloader.js.map +1 -1
- package/dist/js/integrations/nativelinkederrors.d.ts +2 -8
- package/dist/js/integrations/nativelinkederrors.d.ts.map +1 -1
- package/dist/js/integrations/nativelinkederrors.js +0 -8
- package/dist/js/integrations/nativelinkederrors.js.map +1 -1
- package/dist/js/integrations/reactnativeerrorhandlers.d.ts +2 -8
- package/dist/js/integrations/reactnativeerrorhandlers.d.ts.map +1 -1
- package/dist/js/integrations/reactnativeerrorhandlers.js +1 -8
- package/dist/js/integrations/reactnativeerrorhandlers.js.map +1 -1
- package/dist/js/integrations/reactnativeinfo.d.ts +2 -8
- package/dist/js/integrations/reactnativeinfo.d.ts.map +1 -1
- package/dist/js/integrations/reactnativeinfo.js +0 -8
- package/dist/js/integrations/reactnativeinfo.js.map +1 -1
- package/dist/js/integrations/release.d.ts +2 -8
- package/dist/js/integrations/release.d.ts.map +1 -1
- package/dist/js/integrations/release.js +0 -8
- package/dist/js/integrations/release.js.map +1 -1
- package/dist/js/integrations/rewriteframes.js +1 -1
- package/dist/js/integrations/rewriteframes.js.map +1 -1
- package/dist/js/integrations/screenshot.d.ts +2 -8
- package/dist/js/integrations/screenshot.d.ts.map +1 -1
- package/dist/js/integrations/screenshot.js +2 -11
- package/dist/js/integrations/screenshot.js.map +1 -1
- package/dist/js/integrations/sdkinfo.d.ts +2 -8
- package/dist/js/integrations/sdkinfo.d.ts.map +1 -1
- package/dist/js/integrations/sdkinfo.js +0 -8
- package/dist/js/integrations/sdkinfo.js.map +1 -1
- package/dist/js/integrations/spotlight.d.ts +2 -10
- package/dist/js/integrations/spotlight.d.ts.map +1 -1
- package/dist/js/integrations/spotlight.js +1 -10
- package/dist/js/integrations/spotlight.js.map +1 -1
- package/dist/js/integrations/viewhierarchy.d.ts +2 -8
- package/dist/js/integrations/viewhierarchy.d.ts.map +1 -1
- package/dist/js/integrations/viewhierarchy.js +0 -8
- package/dist/js/integrations/viewhierarchy.js.map +1 -1
- package/dist/js/options.d.ts +43 -0
- package/dist/js/options.d.ts.map +1 -1
- package/dist/js/options.js.map +1 -1
- package/dist/js/profiling/cache.d.ts +1 -1
- package/dist/js/profiling/hermes.d.ts +1 -1
- package/dist/js/profiling/hermes.d.ts.map +1 -1
- package/dist/js/profiling/integration.d.ts +1 -7
- package/dist/js/profiling/integration.d.ts.map +1 -1
- package/dist/js/profiling/integration.js +39 -25
- package/dist/js/profiling/integration.js.map +1 -1
- package/dist/js/profiling/utils.js +2 -1
- package/dist/js/profiling/utils.js.map +1 -1
- package/dist/js/replay/mobilereplay.d.ts +2 -2
- package/dist/js/replay/mobilereplay.d.ts.map +1 -1
- package/dist/js/replay/mobilereplay.js.map +1 -1
- package/dist/js/scopeSync.d.ts +6 -0
- package/dist/js/scopeSync.d.ts.map +1 -0
- package/dist/js/scopeSync.js +60 -0
- package/dist/js/scopeSync.js.map +1 -0
- package/dist/js/sdk.d.ts +1 -20
- package/dist/js/sdk.d.ts.map +1 -1
- package/dist/js/sdk.js +20 -53
- package/dist/js/sdk.js.map +1 -1
- package/dist/js/tools/sentryMetroSerializer.js.map +1 -1
- package/dist/js/touchevents.d.ts +0 -1
- package/dist/js/touchevents.d.ts.map +1 -1
- package/dist/js/touchevents.js +5 -9
- package/dist/js/touchevents.js.map +1 -1
- package/dist/js/tracing/gesturetracing.d.ts +1 -6
- package/dist/js/tracing/gesturetracing.d.ts.map +1 -1
- package/dist/js/tracing/gesturetracing.js +8 -12
- package/dist/js/tracing/gesturetracing.js.map +1 -1
- package/dist/js/tracing/index.d.ts +6 -7
- package/dist/js/tracing/index.d.ts.map +1 -1
- package/dist/js/tracing/index.js +4 -7
- package/dist/js/tracing/index.js.map +1 -1
- package/dist/js/tracing/integrations/appStart.d.ts +39 -0
- package/dist/js/tracing/integrations/appStart.d.ts.map +1 -0
- package/dist/js/tracing/integrations/appStart.js +301 -0
- package/dist/js/tracing/integrations/appStart.js.map +1 -0
- package/dist/js/tracing/integrations/nativeFrames.d.ts +20 -0
- package/dist/js/tracing/integrations/nativeFrames.d.ts.map +1 -0
- package/dist/js/tracing/integrations/nativeFrames.js +256 -0
- package/dist/js/tracing/integrations/nativeFrames.js.map +1 -0
- package/dist/js/tracing/integrations/stalltracking.d.ts +31 -0
- package/dist/js/tracing/integrations/stalltracking.d.ts.map +1 -0
- package/dist/js/tracing/integrations/stalltracking.js +236 -0
- package/dist/js/tracing/integrations/stalltracking.js.map +1 -0
- package/dist/js/tracing/integrations/userInteraction.d.ts +11 -0
- package/dist/js/tracing/integrations/userInteraction.d.ts.map +1 -0
- package/dist/js/tracing/integrations/userInteraction.js +70 -0
- package/dist/js/tracing/integrations/userInteraction.js.map +1 -0
- package/dist/js/tracing/onSpanEndUtils.d.ts +17 -0
- package/dist/js/tracing/onSpanEndUtils.d.ts.map +1 -0
- package/dist/js/tracing/onSpanEndUtils.js +112 -0
- package/dist/js/tracing/onSpanEndUtils.js.map +1 -0
- package/dist/js/tracing/origin.d.ts +2 -0
- package/dist/js/tracing/origin.d.ts.map +1 -0
- package/dist/js/tracing/origin.js +2 -0
- package/dist/js/tracing/origin.js.map +1 -0
- package/dist/js/tracing/reactnativenavigation.d.ts +21 -39
- package/dist/js/tracing/reactnativenavigation.d.ts.map +1 -1
- package/dist/js/tracing/reactnativenavigation.js +98 -87
- package/dist/js/tracing/reactnativenavigation.js.map +1 -1
- package/dist/js/tracing/reactnativeprofiler.d.ts.map +1 -1
- package/dist/js/tracing/reactnativeprofiler.js +6 -13
- package/dist/js/tracing/reactnativeprofiler.js.map +1 -1
- package/dist/js/tracing/reactnativetracing.d.ts +44 -160
- package/dist/js/tracing/reactnativetracing.d.ts.map +1 -1
- package/dist/js/tracing/reactnativetracing.js +51 -481
- package/dist/js/tracing/reactnativetracing.js.map +1 -1
- package/dist/js/tracing/reactnavigation.d.ts +18 -63
- package/dist/js/tracing/reactnavigation.d.ts.map +1 -1
- package/dist/js/tracing/reactnavigation.js +200 -205
- package/dist/js/tracing/reactnavigation.js.map +1 -1
- package/dist/js/tracing/semanticAttributes.d.ts +12 -0
- package/dist/js/tracing/semanticAttributes.d.ts.map +1 -0
- package/dist/js/tracing/semanticAttributes.js +12 -0
- package/dist/js/tracing/semanticAttributes.js.map +1 -0
- package/dist/js/tracing/span.d.ts +52 -0
- package/dist/js/tracing/span.d.ts.map +1 -0
- package/dist/js/tracing/span.js +82 -0
- package/dist/js/tracing/span.js.map +1 -0
- package/dist/js/tracing/timetodisplay.d.ts.map +1 -1
- package/dist/js/tracing/timetodisplay.js +14 -29
- package/dist/js/tracing/timetodisplay.js.map +1 -1
- package/dist/js/tracing/types.d.ts +2 -9
- package/dist/js/tracing/types.d.ts.map +1 -1
- package/dist/js/tracing/types.js.map +1 -1
- package/dist/js/tracing/utils.d.ts +19 -14
- package/dist/js/tracing/utils.d.ts.map +1 -1
- package/dist/js/tracing/utils.js +38 -52
- package/dist/js/tracing/utils.js.map +1 -1
- package/dist/js/transports/encodePolyfill.d.ts +3 -0
- package/dist/js/transports/encodePolyfill.d.ts.map +1 -0
- package/dist/js/transports/encodePolyfill.js +13 -0
- package/dist/js/transports/encodePolyfill.js.map +1 -0
- package/dist/js/transports/native.d.ts +2 -2
- package/dist/js/transports/native.d.ts.map +1 -1
- package/dist/js/transports/native.js +2 -1
- package/dist/js/transports/native.js.map +1 -1
- package/dist/js/utils/fill.d.ts +7 -0
- package/dist/js/utils/fill.d.ts.map +1 -0
- package/dist/js/utils/fill.js +9 -0
- package/dist/js/utils/fill.js.map +1 -0
- package/dist/js/utils/span.d.ts +19 -0
- package/dist/js/utils/span.d.ts.map +1 -0
- package/dist/js/utils/span.js +29 -0
- package/dist/js/utils/span.js.map +1 -0
- package/dist/js/vendor/react-native/index.d.ts +1 -1
- package/dist/js/vendor/react-native/index.d.ts.map +1 -1
- package/dist/js/vendor/react-native/index.js.map +1 -1
- package/dist/js/version.d.ts +1 -1
- package/dist/js/version.d.ts.map +1 -1
- package/dist/js/version.js +1 -1
- package/dist/js/version.js.map +1 -1
- package/dist/js/wrapper.d.ts.map +1 -1
- package/dist/js/wrapper.js +1 -0
- package/dist/js/wrapper.js.map +1 -1
- package/package.json +10 -12
- package/ts3.8/dist/js/client.d.ts +5 -9
- package/ts3.8/dist/js/index.d.ts +5 -10
- package/ts3.8/dist/js/integrations/debugsymbolicator.d.ts +2 -8
- package/ts3.8/dist/js/integrations/devicecontext.d.ts +2 -8
- package/ts3.8/dist/js/integrations/eventorigin.d.ts +2 -8
- package/ts3.8/dist/js/integrations/expocontext.d.ts +2 -8
- package/ts3.8/dist/js/integrations/exports.d.ts +4 -0
- package/ts3.8/dist/js/integrations/modulesloader.d.ts +2 -8
- package/ts3.8/dist/js/integrations/nativelinkederrors.d.ts +2 -8
- package/ts3.8/dist/js/integrations/reactnativeerrorhandlers.d.ts +2 -8
- package/ts3.8/dist/js/integrations/reactnativeinfo.d.ts +2 -8
- package/ts3.8/dist/js/integrations/release.d.ts +2 -8
- package/ts3.8/dist/js/integrations/screenshot.d.ts +2 -8
- package/ts3.8/dist/js/integrations/sdkinfo.d.ts +2 -8
- package/ts3.8/dist/js/integrations/spotlight.d.ts +2 -10
- package/ts3.8/dist/js/integrations/viewhierarchy.d.ts +2 -8
- package/ts3.8/dist/js/options.d.ts +43 -0
- package/ts3.8/dist/js/profiling/cache.d.ts +1 -1
- package/ts3.8/dist/js/profiling/hermes.d.ts +1 -1
- package/ts3.8/dist/js/profiling/integration.d.ts +1 -7
- package/ts3.8/dist/js/replay/mobilereplay.d.ts +2 -2
- package/ts3.8/dist/js/scopeSync.d.ts +6 -0
- package/ts3.8/dist/js/sdk.d.ts +1 -20
- package/ts3.8/dist/js/touchevents.d.ts +0 -1
- package/ts3.8/dist/js/tracing/gesturetracing.d.ts +1 -6
- package/ts3.8/dist/js/tracing/index.d.ts +6 -7
- package/ts3.8/dist/js/tracing/integrations/appStart.d.ts +39 -0
- package/ts3.8/dist/js/tracing/integrations/nativeFrames.d.ts +20 -0
- package/ts3.8/dist/js/tracing/integrations/stalltracking.d.ts +31 -0
- package/ts3.8/dist/js/tracing/integrations/userInteraction.d.ts +11 -0
- package/ts3.8/dist/js/tracing/onSpanEndUtils.d.ts +17 -0
- package/ts3.8/dist/js/tracing/origin.d.ts +2 -0
- package/ts3.8/dist/js/tracing/reactnativenavigation.d.ts +21 -39
- package/ts3.8/dist/js/tracing/reactnativetracing.d.ts +44 -160
- package/ts3.8/dist/js/tracing/reactnavigation.d.ts +18 -63
- package/ts3.8/dist/js/tracing/semanticAttributes.d.ts +12 -0
- package/ts3.8/dist/js/tracing/span.d.ts +52 -0
- package/ts3.8/dist/js/tracing/types.d.ts +2 -9
- package/ts3.8/dist/js/tracing/utils.d.ts +19 -14
- package/ts3.8/dist/js/transports/encodePolyfill.d.ts +3 -0
- package/ts3.8/dist/js/transports/native.d.ts +2 -2
- package/ts3.8/dist/js/utils/fill.d.ts +7 -0
- package/ts3.8/dist/js/utils/span.d.ts +19 -0
- package/ts3.8/dist/js/vendor/react-native/index.d.ts +1 -1
- package/ts3.8/dist/js/version.d.ts +1 -1
- package/dist/js/integrations/index.d.ts +0 -16
- package/dist/js/integrations/index.d.ts.map +0 -1
- package/dist/js/integrations/index.js +0 -17
- package/dist/js/integrations/index.js.map +0 -1
- package/dist/js/scope.d.ts +0 -54
- package/dist/js/scope.d.ts.map +0 -1
- package/dist/js/scope.js +0 -89
- package/dist/js/scope.js.map +0 -1
- package/dist/js/tracing/addTracingExtensions.d.ts +0 -8
- package/dist/js/tracing/addTracingExtensions.d.ts.map +0 -1
- package/dist/js/tracing/addTracingExtensions.js +0 -66
- package/dist/js/tracing/addTracingExtensions.js.map +0 -1
- package/dist/js/tracing/nativeframes.d.ts +0 -60
- package/dist/js/tracing/nativeframes.d.ts.map +0 -1
- package/dist/js/tracing/nativeframes.js +0 -210
- package/dist/js/tracing/nativeframes.js.map +0 -1
- package/dist/js/tracing/reactnavigationv4.d.ts +0 -92
- package/dist/js/tracing/reactnavigationv4.d.ts.map +0 -1
- package/dist/js/tracing/reactnavigationv4.js +0 -229
- package/dist/js/tracing/reactnavigationv4.js.map +0 -1
- package/dist/js/tracing/routingInstrumentation.d.ts +0 -52
- package/dist/js/tracing/routingInstrumentation.d.ts.map +0 -1
- package/dist/js/tracing/routingInstrumentation.js +0 -36
- package/dist/js/tracing/routingInstrumentation.js.map +0 -1
- package/dist/js/tracing/stalltracking.d.ts +0 -99
- package/dist/js/tracing/stalltracking.d.ts.map +0 -1
- package/dist/js/tracing/stalltracking.js +0 -286
- package/dist/js/tracing/stalltracking.js.map +0 -1
- package/dist/js/tracing/transaction.d.ts +0 -11
- package/dist/js/tracing/transaction.d.ts.map +0 -1
- package/dist/js/tracing/transaction.js +0 -37
- package/dist/js/tracing/transaction.js.map +0 -1
- package/dist/js/transports/TextEncoder.d.ts +0 -3
- package/dist/js/transports/TextEncoder.d.ts.map +0 -1
- package/dist/js/transports/TextEncoder.js +0 -12
- package/dist/js/transports/TextEncoder.js.map +0 -1
- package/ts3.8/dist/js/integrations/index.d.ts +0 -16
- package/ts3.8/dist/js/scope.d.ts +0 -54
- package/ts3.8/dist/js/tracing/addTracingExtensions.d.ts +0 -8
- package/ts3.8/dist/js/tracing/nativeframes.d.ts +0 -60
- package/ts3.8/dist/js/tracing/reactnavigationv4.d.ts +0 -92
- package/ts3.8/dist/js/tracing/routingInstrumentation.d.ts +0 -52
- package/ts3.8/dist/js/tracing/stalltracking.d.ts +0 -99
- package/ts3.8/dist/js/tracing/transaction.d.ts +0 -11
- package/ts3.8/dist/js/transports/TextEncoder.d.ts +0 -3
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
// THESE EXPORTS WILL BE REMOVED IN THE NEXT MAJOR RELEASE
|
|
2
|
-
export { DebugSymbolicator } from './debugsymbolicator';
|
|
3
|
-
export { DeviceContext } from './devicecontext';
|
|
4
|
-
export { ReactNativeErrorHandlers } from './reactnativeerrorhandlers';
|
|
5
|
-
export { NativeLinkedErrors } from './nativelinkederrors';
|
|
6
|
-
export { Release } from './release';
|
|
7
|
-
export { EventOrigin } from './eventorigin';
|
|
8
|
-
export { SdkInfo } from './sdkinfo';
|
|
9
|
-
export { ReactNativeInfo } from './reactnativeinfo';
|
|
10
|
-
export { ModulesLoader } from './modulesloader';
|
|
11
|
-
export { HermesProfiling } from '../profiling/integration';
|
|
12
|
-
export { Screenshot } from './screenshot';
|
|
13
|
-
export { ViewHierarchy } from './viewhierarchy';
|
|
14
|
-
export { ExpoContext } from './expocontext';
|
|
15
|
-
export { Spotlight } from './spotlight';
|
|
16
|
-
export { mobileReplayIntegration } from '../replay/mobilereplay';
|
|
17
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/js/integrations/index.ts"],"names":[],"mappings":"AAAA,0DAA0D;AAE1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC","sourcesContent":["// THESE EXPORTS WILL BE REMOVED IN THE NEXT MAJOR RELEASE\n\nexport { DebugSymbolicator } from './debugsymbolicator';\nexport { DeviceContext } from './devicecontext';\nexport { ReactNativeErrorHandlers } from './reactnativeerrorhandlers';\nexport { NativeLinkedErrors } from './nativelinkederrors';\nexport { Release } from './release';\nexport { EventOrigin } from './eventorigin';\nexport { SdkInfo } from './sdkinfo';\nexport { ReactNativeInfo } from './reactnativeinfo';\nexport { ModulesLoader } from './modulesloader';\nexport { HermesProfiling } from '../profiling/integration';\nexport { Screenshot } from './screenshot';\nexport { ViewHierarchy } from './viewhierarchy';\nexport { ExpoContext } from './expocontext';\nexport { Spotlight } from './spotlight';\nexport { mobileReplayIntegration } from '../replay/mobilereplay';\n"]}
|
package/dist/js/scope.d.ts
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { Scope } from '@sentry/core';
|
|
2
|
-
import type { Attachment, Breadcrumb, User } from '@sentry/types';
|
|
3
|
-
/**
|
|
4
|
-
* Extends the scope methods to set scope on the Native SDKs
|
|
5
|
-
*/
|
|
6
|
-
export declare class ReactNativeScope extends Scope {
|
|
7
|
-
/**
|
|
8
|
-
* @inheritDoc
|
|
9
|
-
*/
|
|
10
|
-
setUser(user: User | null): this;
|
|
11
|
-
/**
|
|
12
|
-
* @inheritDoc
|
|
13
|
-
*/
|
|
14
|
-
setTag(key: string, value: string): this;
|
|
15
|
-
/**
|
|
16
|
-
* @inheritDoc
|
|
17
|
-
*/
|
|
18
|
-
setTags(tags: {
|
|
19
|
-
[key: string]: string;
|
|
20
|
-
}): this;
|
|
21
|
-
/**
|
|
22
|
-
* @inheritDoc
|
|
23
|
-
*/
|
|
24
|
-
setExtras(extras: {
|
|
25
|
-
[key: string]: any;
|
|
26
|
-
}): this;
|
|
27
|
-
/**
|
|
28
|
-
* @inheritDoc
|
|
29
|
-
*/
|
|
30
|
-
setExtra(key: string, extra: any): this;
|
|
31
|
-
/**
|
|
32
|
-
* @inheritDoc
|
|
33
|
-
*/
|
|
34
|
-
addBreadcrumb(breadcrumb: Breadcrumb, maxBreadcrumbs?: number): this;
|
|
35
|
-
/**
|
|
36
|
-
* @inheritDoc
|
|
37
|
-
*/
|
|
38
|
-
clearBreadcrumbs(): this;
|
|
39
|
-
/**
|
|
40
|
-
* @inheritDoc
|
|
41
|
-
*/
|
|
42
|
-
setContext(key: string, context: {
|
|
43
|
-
[key: string]: any;
|
|
44
|
-
} | null): this;
|
|
45
|
-
/**
|
|
46
|
-
* @inheritDoc
|
|
47
|
-
*/
|
|
48
|
-
addAttachment(attachment: Attachment): this;
|
|
49
|
-
/**
|
|
50
|
-
* @inheritDoc
|
|
51
|
-
*/
|
|
52
|
-
clearAttachments(): this;
|
|
53
|
-
}
|
|
54
|
-
//# sourceMappingURL=scope.d.ts.map
|
package/dist/js/scope.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"scope.d.ts","sourceRoot":"","sources":["../../src/js/scope.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AACrC,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAMlE;;GAEG;AACH,qBAAa,gBAAiB,SAAQ,KAAK;IACzC;;OAEG;IACI,OAAO,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI;IAKvC;;OAEG;IACI,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;IAK/C;;OAEG;IACI,OAAO,CAAC,IAAI,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,GAAG,IAAI;IAQrD;;OAEG;IAEI,SAAS,CAAC,MAAM,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE,GAAG,IAAI;IAOtD;;OAEG;IAEI,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,IAAI;IAK9C;;OAEG;IACI,aAAa,CAAC,UAAU,EAAE,UAAU,EAAE,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI;IAc3E;;OAEG;IACI,gBAAgB,IAAI,IAAI;IAK/B;;OAEG;IAEI,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE,GAAG,IAAI,GAAG,IAAI;IAK5E;;OAEG;IACI,aAAa,CAAC,UAAU,EAAE,UAAU,GAAG,IAAI;IAIlD;;OAEG;IACI,gBAAgB,IAAI,IAAI;CAGhC"}
|
package/dist/js/scope.js
DELETED
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import { Scope } from '@sentry/core';
|
|
2
|
-
import { DEFAULT_BREADCRUMB_LEVEL } from './breadcrumb';
|
|
3
|
-
import { convertToNormalizedObject } from './utils/normalize';
|
|
4
|
-
import { NATIVE } from './wrapper';
|
|
5
|
-
/**
|
|
6
|
-
* Extends the scope methods to set scope on the Native SDKs
|
|
7
|
-
*/
|
|
8
|
-
export class ReactNativeScope extends Scope {
|
|
9
|
-
/**
|
|
10
|
-
* @inheritDoc
|
|
11
|
-
*/
|
|
12
|
-
setUser(user) {
|
|
13
|
-
NATIVE.setUser(user);
|
|
14
|
-
return super.setUser(user);
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* @inheritDoc
|
|
18
|
-
*/
|
|
19
|
-
setTag(key, value) {
|
|
20
|
-
NATIVE.setTag(key, value);
|
|
21
|
-
return super.setTag(key, value);
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* @inheritDoc
|
|
25
|
-
*/
|
|
26
|
-
setTags(tags) {
|
|
27
|
-
// As native only has setTag, we just loop through each tag key.
|
|
28
|
-
Object.keys(tags).forEach(key => {
|
|
29
|
-
NATIVE.setTag(key, tags[key]);
|
|
30
|
-
});
|
|
31
|
-
return super.setTags(tags);
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* @inheritDoc
|
|
35
|
-
*/
|
|
36
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
37
|
-
setExtras(extras) {
|
|
38
|
-
Object.keys(extras).forEach(key => {
|
|
39
|
-
NATIVE.setExtra(key, extras[key]);
|
|
40
|
-
});
|
|
41
|
-
return super.setExtras(extras);
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* @inheritDoc
|
|
45
|
-
*/
|
|
46
|
-
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types,@typescript-eslint/no-explicit-any
|
|
47
|
-
setExtra(key, extra) {
|
|
48
|
-
NATIVE.setExtra(key, extra);
|
|
49
|
-
return super.setExtra(key, extra);
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* @inheritDoc
|
|
53
|
-
*/
|
|
54
|
-
addBreadcrumb(breadcrumb, maxBreadcrumbs) {
|
|
55
|
-
const mergedBreadcrumb = Object.assign(Object.assign({}, breadcrumb), { level: breadcrumb.level || DEFAULT_BREADCRUMB_LEVEL, data: breadcrumb.data ? convertToNormalizedObject(breadcrumb.data) : undefined });
|
|
56
|
-
super.addBreadcrumb(mergedBreadcrumb, maxBreadcrumbs);
|
|
57
|
-
const finalBreadcrumb = this._breadcrumbs[this._breadcrumbs.length - 1];
|
|
58
|
-
NATIVE.addBreadcrumb(finalBreadcrumb);
|
|
59
|
-
return this;
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* @inheritDoc
|
|
63
|
-
*/
|
|
64
|
-
clearBreadcrumbs() {
|
|
65
|
-
NATIVE.clearBreadcrumbs();
|
|
66
|
-
return super.clearBreadcrumbs();
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* @inheritDoc
|
|
70
|
-
*/
|
|
71
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
72
|
-
setContext(key, context) {
|
|
73
|
-
NATIVE.setContext(key, context);
|
|
74
|
-
return super.setContext(key, context);
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* @inheritDoc
|
|
78
|
-
*/
|
|
79
|
-
addAttachment(attachment) {
|
|
80
|
-
return super.addAttachment(attachment);
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* @inheritDoc
|
|
84
|
-
*/
|
|
85
|
-
clearAttachments() {
|
|
86
|
-
return super.clearAttachments();
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
//# sourceMappingURL=scope.js.map
|
package/dist/js/scope.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"scope.js","sourceRoot":"","sources":["../../src/js/scope.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAGrC,OAAO,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAC;AACxD,OAAO,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAEnC;;GAEG;AACH,MAAM,OAAO,gBAAiB,SAAQ,KAAK;IACzC;;OAEG;IACI,OAAO,CAAC,IAAiB;QAC9B,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QACrB,OAAO,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7B,CAAC;IAED;;OAEG;IACI,MAAM,CAAC,GAAW,EAAE,KAAa;QACtC,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;QAC1B,OAAO,KAAK,CAAC,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IAClC,CAAC;IAED;;OAEG;IACI,OAAO,CAAC,IAA+B;QAC5C,gEAAgE;QAChE,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;YAC9B,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;QAChC,CAAC,CAAC,CAAC;QACH,OAAO,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C,GAAW,EAAE,OAAsC;QACnE,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;QAChC,OAAO,KAAK,CAAC,UAAU,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;IACxC,CAAC;IAED;;OAEG;IACI,aAAa,CAAC,UAAsB;QACzC,OAAO,KAAK,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;IACzC,CAAC;IAED;;OAEG;IACI,gBAAgB;QACrB,OAAO,KAAK,CAAC,gBAAgB,EAAE,CAAC;IAClC,CAAC;CACF","sourcesContent":["import { Scope } from '@sentry/core';\nimport type { Attachment, Breadcrumb, User } from '@sentry/types';\n\nimport { DEFAULT_BREADCRUMB_LEVEL } from './breadcrumb';\nimport { convertToNormalizedObject } from './utils/normalize';\nimport { NATIVE } from './wrapper';\n\n/**\n * Extends the scope methods to set scope on the Native SDKs\n */\nexport class ReactNativeScope extends Scope {\n /**\n * @inheritDoc\n */\n public setUser(user: User | null): this {\n NATIVE.setUser(user);\n return super.setUser(user);\n }\n\n /**\n * @inheritDoc\n */\n public setTag(key: string, value: string): this {\n NATIVE.setTag(key, value);\n return super.setTag(key, value);\n }\n\n /**\n * @inheritDoc\n */\n public setTags(tags: { [key: string]: string }): this {\n // As native only has setTag, we just loop through each tag key.\n Object.keys(tags).forEach(key => {\n NATIVE.setTag(key, tags[key]);\n });\n return super.setTags(tags);\n }\n\n /**\n * @inheritDoc\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n public setExtras(extras: { [key: string]: any }): this {\n Object.keys(extras).forEach(key => {\n NATIVE.setExtra(key, extras[key]);\n });\n return super.setExtras(extras);\n }\n\n /**\n * @inheritDoc\n */\n // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types,@typescript-eslint/no-explicit-any\n public setExtra(key: string, extra: any): this {\n NATIVE.setExtra(key, extra);\n return super.setExtra(key, extra);\n }\n\n /**\n * @inheritDoc\n */\n public addBreadcrumb(breadcrumb: Breadcrumb, maxBreadcrumbs?: number): this {\n const mergedBreadcrumb: Breadcrumb = {\n ...breadcrumb,\n level: breadcrumb.level || DEFAULT_BREADCRUMB_LEVEL,\n data: breadcrumb.data ? convertToNormalizedObject(breadcrumb.data) : undefined,\n };\n\n super.addBreadcrumb(mergedBreadcrumb, maxBreadcrumbs);\n\n const finalBreadcrumb = this._breadcrumbs[this._breadcrumbs.length - 1];\n NATIVE.addBreadcrumb(finalBreadcrumb);\n return this;\n }\n\n /**\n * @inheritDoc\n */\n public clearBreadcrumbs(): this {\n NATIVE.clearBreadcrumbs();\n return super.clearBreadcrumbs();\n }\n\n /**\n * @inheritDoc\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n public setContext(key: string, context: { [key: string]: any } | null): this {\n NATIVE.setContext(key, context);\n return super.setContext(key, context);\n }\n\n /**\n * @inheritDoc\n */\n public addAttachment(attachment: Attachment): this {\n return super.addAttachment(attachment);\n }\n\n /**\n * @inheritDoc\n */\n public clearAttachments(): this {\n return super.clearAttachments();\n }\n}\n"]}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { Hub, Transaction } from '@sentry/core';
|
|
2
|
-
import type { CustomSamplingContext, TransactionContext } from '@sentry/types';
|
|
3
|
-
/**
|
|
4
|
-
* Adds React Native's extensions. Needs to be called before any transactions are created.
|
|
5
|
-
*/
|
|
6
|
-
export declare function _addTracingExtensions(): void;
|
|
7
|
-
export type StartTransactionFunction = (this: Hub, transactionContext: TransactionContext, customSamplingContext?: CustomSamplingContext) => Transaction;
|
|
8
|
-
//# sourceMappingURL=addTracingExtensions.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"addTracingExtensions.d.ts","sourceRoot":"","sources":["../../../src/js/tracing/addTracingExtensions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAErD,OAAO,KAAK,EAAE,qBAAqB,EAAe,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAK5F;;GAEG;AACH,wBAAgB,qBAAqB,IAAI,IAAI,CAiB5C;AAED,MAAM,MAAM,wBAAwB,GAAG,CACrC,IAAI,EAAE,GAAG,EACT,kBAAkB,EAAE,kBAAkB,EACtC,qBAAqB,CAAC,EAAE,qBAAqB,KAC1C,WAAW,CAAC"}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { addTracingExtensions, getCurrentHub, getMainCarrier } from '@sentry/core';
|
|
2
|
-
import { DEFAULT } from '../tracing/ops';
|
|
3
|
-
import { ReactNativeTracing } from '../tracing/reactnativetracing';
|
|
4
|
-
/**
|
|
5
|
-
* Adds React Native's extensions. Needs to be called before any transactions are created.
|
|
6
|
-
*/
|
|
7
|
-
export function _addTracingExtensions() {
|
|
8
|
-
addTracingExtensions();
|
|
9
|
-
const carrier = getMainCarrier();
|
|
10
|
-
if (carrier.__SENTRY__) {
|
|
11
|
-
carrier.__SENTRY__.extensions = carrier.__SENTRY__.extensions || {};
|
|
12
|
-
if (carrier.__SENTRY__.extensions.startTransaction) {
|
|
13
|
-
const originalStartTransaction = carrier.__SENTRY__.extensions.startTransaction;
|
|
14
|
-
/*
|
|
15
|
-
Overwrites the transaction start and finish to start and finish stall tracking.
|
|
16
|
-
Preferably instead of overwriting add a callback method for this in the Transaction itself.
|
|
17
|
-
*/
|
|
18
|
-
const _startTransaction = _patchStartTransaction(originalStartTransaction);
|
|
19
|
-
carrier.__SENTRY__.extensions.startTransaction = _startTransaction;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Overwrite the startTransaction extension method to start and end stall tracking.
|
|
25
|
-
*/
|
|
26
|
-
const _patchStartTransaction = (originalStartTransaction) => {
|
|
27
|
-
/**
|
|
28
|
-
* Method to overwrite with
|
|
29
|
-
*/
|
|
30
|
-
function _startTransaction(transactionContext, customSamplingContext) {
|
|
31
|
-
// Native SDKs require op to be set - for JS Relay sets `default`
|
|
32
|
-
if (!transactionContext.op) {
|
|
33
|
-
transactionContext.op = DEFAULT;
|
|
34
|
-
}
|
|
35
|
-
const transaction = originalStartTransaction.apply(this, [transactionContext, customSamplingContext]);
|
|
36
|
-
const originalStartChild = transaction.startChild.bind(transaction);
|
|
37
|
-
transaction.startChild = (spanContext) => {
|
|
38
|
-
return originalStartChild(Object.assign(Object.assign({}, spanContext), {
|
|
39
|
-
// Native SDKs require op to be set
|
|
40
|
-
op: (spanContext === null || spanContext === void 0 ? void 0 : spanContext.op) || DEFAULT }));
|
|
41
|
-
};
|
|
42
|
-
const reactNativeTracing = getCurrentHub().getIntegration(ReactNativeTracing);
|
|
43
|
-
if (reactNativeTracing) {
|
|
44
|
-
reactNativeTracing.onTransactionStart(transaction);
|
|
45
|
-
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
46
|
-
const originalFinish = transaction.finish;
|
|
47
|
-
transaction.finish = (endTimestamp) => {
|
|
48
|
-
if (reactNativeTracing) {
|
|
49
|
-
reactNativeTracing.onTransactionFinish(transaction, endTimestamp);
|
|
50
|
-
}
|
|
51
|
-
return originalFinish.apply(transaction, [endTimestamp]);
|
|
52
|
-
};
|
|
53
|
-
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
54
|
-
const originalEnd = transaction.end;
|
|
55
|
-
transaction.end = (endTimestamp) => {
|
|
56
|
-
if (reactNativeTracing) {
|
|
57
|
-
reactNativeTracing.onTransactionFinish(transaction, endTimestamp);
|
|
58
|
-
}
|
|
59
|
-
return originalEnd.apply(transaction, [endTimestamp]);
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
return transaction;
|
|
63
|
-
}
|
|
64
|
-
return _startTransaction;
|
|
65
|
-
};
|
|
66
|
-
//# sourceMappingURL=addTracingExtensions.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"addTracingExtensions.js","sourceRoot":"","sources":["../../../src/js/tracing/addTracingExtensions.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,o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,mCAAmC;gBACnC,EAAE,EAAE,CAAA,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,EAAE,KAAI,OAAO,IAC9B,CAAC;QACL,CAAC,CAAC;QAEF,MAAM,kBAAkB,GAAG,aAAa,EAAE,CAAC,cAAc,CAAC,kBAAkB,CAAC,CAAC;QAE9E,IAAI,kBAAkB,EAAE;YACtB,kBAAkB,CAAC,kBAAkB,CAAC,WAAW,CAAC,CAAC;YAEnD,6DAA6D;YAC7D,MAAM,cAAc,GAAG,WAAW,CAAC,MAAM,CAAC;YAE1C,WAAW,CAAC,MAAM,GAAG,CAAC,YAAgC,EAAE,EAAE;gBACxD,IAAI,kBAAkB,EAAE;oBACtB,kBAAkB,CAAC,mBAAmB,CAAC,WAAW,EAAE,YAAY,CAAC,CAAC;iBACnE;gBAED,OAAO,cAAc,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC;YAC3D,CAAC,CAAC;YAEF,6DAA6D;YAC7D,MAAM,WAAW,GAAG,WAAW,CAAC,GAAG,CAAC;YAEpC,WAAW,CAAC,GAAG,GAAG,CAAC,YAAgC,EAAE,EAAE;gBACrD,IAAI,kBAAkB,EAAE;oBACtB,kBAAkB,CAAC,mBAAmB,CAAC,WAAW,EAAE,YAAY,CAAC,CAAC;iBACnE;gBAED,OAAO,WAAW,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC;YACxD,CAAC,CAAC;SACH;QAED,OAAO,WAAW,CAAC;IACrB,CAAC;IAED,OAAO,iBAAiB,CAAC;AAC3B,CAAC,CAAC","sourcesContent":["import type { Hub, Transaction } from '@sentry/core';\nimport { addTracingExtensions, getCurrentHub, getMainCarrier } from '@sentry/core';\nimport type { CustomSamplingContext, SpanContext, TransactionContext } from '@sentry/types';\n\nimport { DEFAULT } from '../tracing/ops';\nimport { ReactNativeTracing } from '../tracing/reactnativetracing';\n\n/**\n * Adds React Native's extensions. Needs to be called before any transactions are created.\n */\nexport function _addTracingExtensions(): void {\n addTracingExtensions();\n const carrier = getMainCarrier();\n if (carrier.__SENTRY__) {\n carrier.__SENTRY__.extensions = carrier.__SENTRY__.extensions || {};\n if (carrier.__SENTRY__.extensions.startTransaction) {\n const originalStartTransaction = carrier.__SENTRY__.extensions.startTransaction as StartTransactionFunction;\n\n /*\n Overwrites the transaction start and finish to start and finish stall tracking.\n Preferably instead of overwriting add a callback method for this in the Transaction itself.\n */\n const _startTransaction = _patchStartTransaction(originalStartTransaction);\n\n carrier.__SENTRY__.extensions.startTransaction = _startTransaction;\n }\n }\n}\n\nexport type StartTransactionFunction = (\n this: Hub,\n transactionContext: TransactionContext,\n customSamplingContext?: CustomSamplingContext,\n) => Transaction;\n\n/**\n * Overwrite the startTransaction extension method to start and end stall tracking.\n */\nconst _patchStartTransaction = (originalStartTransaction: StartTransactionFunction): StartTransactionFunction => {\n /**\n * Method to overwrite with\n */\n function _startTransaction(\n this: Hub,\n transactionContext: TransactionContext,\n customSamplingContext?: CustomSamplingContext,\n ): Transaction {\n // Native SDKs require op to be set - for JS Relay sets `default`\n if (!transactionContext.op) {\n transactionContext.op = DEFAULT;\n }\n\n const transaction: Transaction = originalStartTransaction.apply(this, [transactionContext, customSamplingContext]);\n const originalStartChild: Transaction['startChild'] = transaction.startChild.bind(transaction);\n transaction.startChild = (\n spanContext?: Pick<SpanContext, Exclude<keyof SpanContext, 'sampled' | 'traceId' | 'parentSpanId'>>,\n ): ReturnType<Transaction['startChild']> => {\n return originalStartChild({\n ...spanContext,\n // Native SDKs require op to be set\n op: spanContext?.op || DEFAULT,\n });\n };\n\n const reactNativeTracing = getCurrentHub().getIntegration(ReactNativeTracing);\n\n if (reactNativeTracing) {\n reactNativeTracing.onTransactionStart(transaction);\n\n // eslint-disable-next-line @typescript-eslint/unbound-method\n const originalFinish = transaction.finish;\n\n transaction.finish = (endTimestamp: number | undefined) => {\n if (reactNativeTracing) {\n reactNativeTracing.onTransactionFinish(transaction, endTimestamp);\n }\n\n return originalFinish.apply(transaction, [endTimestamp]);\n };\n\n // eslint-disable-next-line @typescript-eslint/unbound-method\n const originalEnd = transaction.end;\n\n transaction.end = (endTimestamp: number | undefined) => {\n if (reactNativeTracing) {\n reactNativeTracing.onTransactionFinish(transaction, endTimestamp);\n }\n\n return originalEnd.apply(transaction, [endTimestamp]);\n };\n }\n\n return transaction;\n }\n\n return _startTransaction;\n};\n"]}
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import type { Transaction } from '@sentry/core';
|
|
2
|
-
import type { EventProcessor, Measurements, MeasurementUnit } from '@sentry/types';
|
|
3
|
-
export interface FramesMeasurements extends Measurements {
|
|
4
|
-
frames_total: {
|
|
5
|
-
value: number;
|
|
6
|
-
unit: MeasurementUnit;
|
|
7
|
-
};
|
|
8
|
-
frames_slow: {
|
|
9
|
-
value: number;
|
|
10
|
-
unit: MeasurementUnit;
|
|
11
|
-
};
|
|
12
|
-
frames_frozen: {
|
|
13
|
-
value: number;
|
|
14
|
-
unit: MeasurementUnit;
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Instrumentation to add native slow/frozen frames measurements onto transactions.
|
|
19
|
-
*/
|
|
20
|
-
export declare class NativeFramesInstrumentation {
|
|
21
|
-
/** The native frames at the finish time of the most recent span. */
|
|
22
|
-
private _lastSpanFinishFrames?;
|
|
23
|
-
constructor(addGlobalEventProcessor: (e: EventProcessor) => void, doesExist: () => boolean);
|
|
24
|
-
/**
|
|
25
|
-
* To be called when a transaction is started.
|
|
26
|
-
* Logs the native frames at this start point and instruments child span finishes.
|
|
27
|
-
*/
|
|
28
|
-
onTransactionStart(transaction: Transaction): void;
|
|
29
|
-
/**
|
|
30
|
-
* To be called when a transaction is finished
|
|
31
|
-
*/
|
|
32
|
-
onTransactionFinish(transaction: Transaction): void;
|
|
33
|
-
/**
|
|
34
|
-
* Called on a span finish to fetch native frames to support transactions with trimEnd.
|
|
35
|
-
* Only to be called when a span does not have an end timestamp.
|
|
36
|
-
*/
|
|
37
|
-
private _onSpanFinish;
|
|
38
|
-
/**
|
|
39
|
-
* Returns the computed frames measurements and awaits for them if they are not ready yet.
|
|
40
|
-
*/
|
|
41
|
-
private _getFramesMeasurements;
|
|
42
|
-
/**
|
|
43
|
-
* Returns the computed frames measurements given ready data
|
|
44
|
-
*/
|
|
45
|
-
private _prepareMeasurements;
|
|
46
|
-
/**
|
|
47
|
-
* Fetch finish frames for a transaction at the current time. Calls any awaiting listeners.
|
|
48
|
-
*/
|
|
49
|
-
private _fetchEndFramesForTransaction;
|
|
50
|
-
/**
|
|
51
|
-
* On a finish frames failure, we cancel the await.
|
|
52
|
-
*/
|
|
53
|
-
private _cancelEndFrames;
|
|
54
|
-
/**
|
|
55
|
-
* Adds frames measurements to an event. Called from a valid event processor.
|
|
56
|
-
* Awaits for finish frames if needed.
|
|
57
|
-
*/
|
|
58
|
-
private _processEvent;
|
|
59
|
-
}
|
|
60
|
-
//# sourceMappingURL=nativeframes.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"nativeframes.d.ts","sourceRoot":"","sources":["../../../src/js/tracing/nativeframes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAQ,WAAW,EAAE,MAAM,cAAc,CAAC;AACtD,OAAO,KAAK,EAAS,cAAc,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAc1F,MAAM,WAAW,kBAAmB,SAAQ,YAAY;IACtD,YAAY,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,eAAe,CAAA;KAAE,CAAC;IACvD,WAAW,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,eAAe,CAAA;KAAE,CAAC;IACtD,aAAa,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,eAAe,CAAA;KAAE,CAAC;CACzD;AAcD;;GAEG;AACH,qBAAa,2BAA2B;IACtC,oEAAoE;IACpE,OAAO,CAAC,qBAAqB,CAAC,CAG5B;gBAEiB,uBAAuB,EAAE,CAAC,CAAC,EAAE,cAAc,KAAK,IAAI,EAAE,SAAS,EAAE,MAAM,OAAO;IAMjG;;;OAGG;IACI,kBAAkB,CAAC,WAAW,EAAE,WAAW,GAAG,IAAI;IA4BzD;;OAEG;IACI,mBAAmB,CAAC,WAAW,EAAE,WAAW,GAAG,IAAI;IAS1D;;;OAGG;IACH,OAAO,CAAC,aAAa;IAiBrB;;OAEG;YACW,sBAAsB;IA4BpC;;OAEG;IACH,OAAO,CAAC,oBAAoB;IA4D5B;;OAEG;YACW,6BAA6B;IAoB3C;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAUxB;;;OAGG;YACW,aAAa;CAiD5B"}
|
|
@@ -1,210 +0,0 @@
|
|
|
1
|
-
import { __awaiter } from "tslib";
|
|
2
|
-
import { logger, timestampInSeconds } from '@sentry/utils';
|
|
3
|
-
import { NATIVE } from '../wrapper';
|
|
4
|
-
import { instrumentChildSpanFinish } from './utils';
|
|
5
|
-
/**
|
|
6
|
-
* Timeout from the final native frames fetch to processing the associated transaction.
|
|
7
|
-
* If the transaction is not processed by this time, the native frames will be dropped
|
|
8
|
-
* and not added to the event.
|
|
9
|
-
*/
|
|
10
|
-
const FINAL_FRAMES_TIMEOUT_MS = 2000;
|
|
11
|
-
/** The listeners for each native frames response, keyed by traceId. This must be global to avoid closure issues and reading outdated values. */
|
|
12
|
-
const _framesListeners = new Map();
|
|
13
|
-
/** The native frames at the transaction finish time, keyed by traceId. This must be global to avoid closure issues and reading outdated values. */
|
|
14
|
-
const _finishFrames = new Map();
|
|
15
|
-
/**
|
|
16
|
-
* A margin of error of 50ms is allowed for the async native bridge call.
|
|
17
|
-
* Anything larger would reduce the accuracy of our frames measurements.
|
|
18
|
-
*/
|
|
19
|
-
const MARGIN_OF_ERROR_SECONDS = 0.05;
|
|
20
|
-
/**
|
|
21
|
-
* Instrumentation to add native slow/frozen frames measurements onto transactions.
|
|
22
|
-
*/
|
|
23
|
-
export class NativeFramesInstrumentation {
|
|
24
|
-
constructor(addGlobalEventProcessor, doesExist) {
|
|
25
|
-
logger.log('[ReactNativeTracing] Native frames instrumentation initialized.');
|
|
26
|
-
addGlobalEventProcessor(event => this._processEvent(event, doesExist));
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* To be called when a transaction is started.
|
|
30
|
-
* Logs the native frames at this start point and instruments child span finishes.
|
|
31
|
-
*/
|
|
32
|
-
onTransactionStart(transaction) {
|
|
33
|
-
logger.debug(`[NativeFrames] Fetching frames for root span start (${transaction.spanContext().spanId}).`);
|
|
34
|
-
void NATIVE.fetchNativeFrames()
|
|
35
|
-
.then(framesMetrics => {
|
|
36
|
-
if (framesMetrics) {
|
|
37
|
-
transaction.setData('__startFrames', framesMetrics);
|
|
38
|
-
}
|
|
39
|
-
else {
|
|
40
|
-
logger.warn(`[NativeFrames] Fetched frames for root span start (${transaction.spanContext().spanId}), but no frames were returned.`);
|
|
41
|
-
}
|
|
42
|
-
})
|
|
43
|
-
.then(undefined, error => {
|
|
44
|
-
logger.error(`[NativeFrames] Error while fetching frames for root span start (${transaction.spanContext().spanId})`, error);
|
|
45
|
-
});
|
|
46
|
-
instrumentChildSpanFinish(transaction, (_, endTimestamp) => {
|
|
47
|
-
if (!endTimestamp) {
|
|
48
|
-
this._onSpanFinish();
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* To be called when a transaction is finished
|
|
54
|
-
*/
|
|
55
|
-
onTransactionFinish(transaction) {
|
|
56
|
-
this._fetchEndFramesForTransaction(transaction).then(undefined, (reason) => {
|
|
57
|
-
logger.error(`[NativeFrames] Error while fetching frames for root span start (${transaction.spanContext().spanId})`, reason);
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* Called on a span finish to fetch native frames to support transactions with trimEnd.
|
|
62
|
-
* Only to be called when a span does not have an end timestamp.
|
|
63
|
-
*/
|
|
64
|
-
_onSpanFinish() {
|
|
65
|
-
const timestamp = timestampInSeconds();
|
|
66
|
-
void NATIVE.fetchNativeFrames()
|
|
67
|
-
.then(nativeFrames => {
|
|
68
|
-
if (nativeFrames) {
|
|
69
|
-
this._lastSpanFinishFrames = {
|
|
70
|
-
timestamp,
|
|
71
|
-
nativeFrames,
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
|
-
})
|
|
75
|
-
.then(undefined, error => {
|
|
76
|
-
logger.error(`[NativeFrames] Error while fetching frames for child span end.`, error);
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* Returns the computed frames measurements and awaits for them if they are not ready yet.
|
|
81
|
-
*/
|
|
82
|
-
_getFramesMeasurements(traceId, finalEndTimestamp, startFrames) {
|
|
83
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
84
|
-
if (_finishFrames.has(traceId)) {
|
|
85
|
-
logger.debug(`[NativeFrames] Native end frames already fetched for trace id (${traceId}).`);
|
|
86
|
-
return this._prepareMeasurements(traceId, finalEndTimestamp, startFrames);
|
|
87
|
-
}
|
|
88
|
-
return new Promise(resolve => {
|
|
89
|
-
const timeout = setTimeout(() => {
|
|
90
|
-
logger.debug(`[NativeFrames] Native end frames listener removed by timeout for trace id (${traceId}).`);
|
|
91
|
-
_framesListeners.delete(traceId);
|
|
92
|
-
resolve(null);
|
|
93
|
-
}, 2000);
|
|
94
|
-
_framesListeners.set(traceId, () => {
|
|
95
|
-
logger.debug(`[NativeFrames] Native end frames listener called for trace id (${traceId}).`);
|
|
96
|
-
resolve(this._prepareMeasurements(traceId, finalEndTimestamp, startFrames));
|
|
97
|
-
clearTimeout(timeout);
|
|
98
|
-
_framesListeners.delete(traceId);
|
|
99
|
-
});
|
|
100
|
-
});
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
|
-
/**
|
|
104
|
-
* Returns the computed frames measurements given ready data
|
|
105
|
-
*/
|
|
106
|
-
_prepareMeasurements(traceId, finalEndTimestamp, // The actual transaction finish time.
|
|
107
|
-
startFrames) {
|
|
108
|
-
let finalFinishFrames;
|
|
109
|
-
const finish = _finishFrames.get(traceId);
|
|
110
|
-
if (finish &&
|
|
111
|
-
finish.nativeFrames &&
|
|
112
|
-
// Must be in the margin of error of the actual transaction finish time (finalEndTimestamp)
|
|
113
|
-
Math.abs(finish.timestamp - finalEndTimestamp) < MARGIN_OF_ERROR_SECONDS) {
|
|
114
|
-
logger.debug(`[NativeFrames] Using frames from root span end (traceId, ${traceId}).`);
|
|
115
|
-
finalFinishFrames = finish.nativeFrames;
|
|
116
|
-
}
|
|
117
|
-
else if (this._lastSpanFinishFrames &&
|
|
118
|
-
Math.abs(this._lastSpanFinishFrames.timestamp - finalEndTimestamp) < MARGIN_OF_ERROR_SECONDS) {
|
|
119
|
-
// Fallback to the last span finish if it is within the margin of error of the actual finish timestamp.
|
|
120
|
-
// This should be the case for trimEnd.
|
|
121
|
-
logger.debug(`[NativeFrames] Using native frames from last span end (traceId, ${traceId}).`);
|
|
122
|
-
finalFinishFrames = this._lastSpanFinishFrames.nativeFrames;
|
|
123
|
-
}
|
|
124
|
-
else {
|
|
125
|
-
logger.warn(`[NativeFrames] Frames were collected within larger than margin of error delay for traceId (${traceId}). Dropping the inaccurate values.`);
|
|
126
|
-
return null;
|
|
127
|
-
}
|
|
128
|
-
const measurements = {
|
|
129
|
-
frames_total: {
|
|
130
|
-
value: finalFinishFrames.totalFrames - startFrames.totalFrames,
|
|
131
|
-
unit: 'none',
|
|
132
|
-
},
|
|
133
|
-
frames_frozen: {
|
|
134
|
-
value: finalFinishFrames.frozenFrames - startFrames.frozenFrames,
|
|
135
|
-
unit: 'none',
|
|
136
|
-
},
|
|
137
|
-
frames_slow: {
|
|
138
|
-
value: finalFinishFrames.slowFrames - startFrames.slowFrames,
|
|
139
|
-
unit: 'none',
|
|
140
|
-
},
|
|
141
|
-
};
|
|
142
|
-
if (measurements.frames_frozen.value <= 0 &&
|
|
143
|
-
measurements.frames_slow.value <= 0 &&
|
|
144
|
-
measurements.frames_total.value <= 0) {
|
|
145
|
-
logger.warn(`[NativeFrames] Detected zero slow or frozen frames. Not adding measurements to traceId (${traceId}).`);
|
|
146
|
-
return null;
|
|
147
|
-
}
|
|
148
|
-
return measurements;
|
|
149
|
-
}
|
|
150
|
-
/**
|
|
151
|
-
* Fetch finish frames for a transaction at the current time. Calls any awaiting listeners.
|
|
152
|
-
*/
|
|
153
|
-
_fetchEndFramesForTransaction(transaction) {
|
|
154
|
-
var _a;
|
|
155
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
156
|
-
const startFrames = transaction.data.__startFrames;
|
|
157
|
-
// This timestamp marks when the finish frames were retrieved. It should be pretty close to the transaction finish.
|
|
158
|
-
const timestamp = timestampInSeconds();
|
|
159
|
-
let finishFrames = null;
|
|
160
|
-
if (startFrames) {
|
|
161
|
-
finishFrames = yield NATIVE.fetchNativeFrames();
|
|
162
|
-
}
|
|
163
|
-
_finishFrames.set(transaction.traceId, {
|
|
164
|
-
nativeFrames: finishFrames,
|
|
165
|
-
timestamp,
|
|
166
|
-
});
|
|
167
|
-
(_a = _framesListeners.get(transaction.traceId)) === null || _a === void 0 ? void 0 : _a();
|
|
168
|
-
setTimeout(() => this._cancelEndFrames(transaction), FINAL_FRAMES_TIMEOUT_MS);
|
|
169
|
-
});
|
|
170
|
-
}
|
|
171
|
-
/**
|
|
172
|
-
* On a finish frames failure, we cancel the await.
|
|
173
|
-
*/
|
|
174
|
-
_cancelEndFrames(transaction) {
|
|
175
|
-
if (_finishFrames.has(transaction.traceId)) {
|
|
176
|
-
_finishFrames.delete(transaction.traceId);
|
|
177
|
-
logger.log(`[NativeFrames] Native frames timed out for ${transaction.op} transaction ${transaction.name}. Not adding native frames measurements.`);
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
/**
|
|
181
|
-
* Adds frames measurements to an event. Called from a valid event processor.
|
|
182
|
-
* Awaits for finish frames if needed.
|
|
183
|
-
*/
|
|
184
|
-
_processEvent(event, doesExist) {
|
|
185
|
-
var _a, _b, _c;
|
|
186
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
187
|
-
if (!doesExist()) {
|
|
188
|
-
return event;
|
|
189
|
-
}
|
|
190
|
-
if (event.type === 'transaction' && event.transaction && event.contexts && event.contexts.trace) {
|
|
191
|
-
const traceContext = event.contexts.trace;
|
|
192
|
-
const traceId = traceContext.trace_id;
|
|
193
|
-
if (!((_a = traceContext.data) === null || _a === void 0 ? void 0 : _a.__startFrames)) {
|
|
194
|
-
logger.warn(`[NativeFrames] Start frames of transaction ${event.transaction} (eventId, ${event.event_id}) are missing, but it already ended.`);
|
|
195
|
-
}
|
|
196
|
-
if (traceId && ((_b = traceContext.data) === null || _b === void 0 ? void 0 : _b.__startFrames) && event.timestamp) {
|
|
197
|
-
const measurements = yield this._getFramesMeasurements(traceId, event.timestamp, traceContext.data.__startFrames);
|
|
198
|
-
if (measurements) {
|
|
199
|
-
logger.log(`[Measurements] Adding measurements to ${traceContext.op} transaction ${event.transaction}: ${JSON.stringify(measurements, undefined, 2)}`);
|
|
200
|
-
event.measurements = Object.assign(Object.assign({}, ((_c = event.measurements) !== null && _c !== void 0 ? _c : {})), measurements);
|
|
201
|
-
_finishFrames.delete(traceId);
|
|
202
|
-
}
|
|
203
|
-
delete traceContext.data.__startFrames;
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
return event;
|
|
207
|
-
});
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
//# sourceMappingURL=nativeframes.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"nativeframes.js","sourceRoot":"","sources":["../../../src/js/tracing/nativeframes.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,MAAM,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAG3D,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,yBAAyB,EAAE,MA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,EAAE,SAAS,EAAE,CAAC,CAAC,EAAE,CAClD,CAAC;wBAEF,KAAK,CAAC,YAAY,mCACb,CAAC,MAAA,KAAK,CAAC,YAAY,mCAAI,EAAE,CAAC,GAC1B,YAAY,CAChB,CAAC;wBAEF,aAAa,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;qBAC/B;oBAED,OAAO,YAAY,CAAC,IAAI,CAAC,aAAa,CAAC;iBACxC;aACF;YAED,OAAO,KAAK,CAAC;;KACd;CACF","sourcesContent":["import type { Span, Transaction } from '@sentry/core';\nimport type { Event, EventProcessor, Measurements, MeasurementUnit } from '@sentry/types';\nimport { logger, timestampInSeconds } from '@sentry/utils';\n\nimport type { NativeFramesResponse } from '../NativeRNSentry';\nimport { NATIVE } from '../wrapper';\nimport { instrumentChildSpanFinish } from './utils';\n\n/**\n * Timeout from the final native frames fetch to processing the associated transaction.\n * If the transaction is not processed by this time, the native frames will be dropped\n * and not added to the event.\n */\nconst FINAL_FRAMES_TIMEOUT_MS = 2000;\n\nexport interface FramesMeasurements extends Measurements {\n frames_total: { value: number; unit: MeasurementUnit };\n frames_slow: { value: number; unit: MeasurementUnit };\n frames_frozen: { value: number; unit: MeasurementUnit };\n}\n\n/** The listeners for each native frames response, keyed by traceId. This must be global to avoid closure issues and reading outdated values. */\nconst _framesListeners: Map<string, () => void> = new Map();\n\n/** The native frames at the transaction finish time, keyed by traceId. This must be global to avoid closure issues and reading outdated values. */\nconst _finishFrames: Map<string, { timestamp: number; nativeFrames: NativeFramesResponse | null }> = new Map();\n\n/**\n * A margin of error of 50ms is allowed for the async native bridge call.\n * Anything larger would reduce the accuracy of our frames measurements.\n */\nconst MARGIN_OF_ERROR_SECONDS = 0.05;\n\n/**\n * Instrumentation to add native slow/frozen frames measurements onto transactions.\n */\nexport class NativeFramesInstrumentation {\n /** The native frames at the finish time of the most recent span. */\n private _lastSpanFinishFrames?: {\n timestamp: number;\n nativeFrames: NativeFramesResponse;\n };\n\n public constructor(addGlobalEventProcessor: (e: EventProcessor) => void, doesExist: () => boolean) {\n logger.log('[ReactNativeTracing] Native frames instrumentation initialized.');\n\n addGlobalEventProcessor(event => this._processEvent(event, doesExist));\n }\n\n /**\n * To be called when a transaction is started.\n * Logs the native frames at this start point and instruments child span finishes.\n */\n public onTransactionStart(transaction: Transaction): void {\n logger.debug(`[NativeFrames] Fetching frames for root span start (${transaction.spanContext().spanId}).`);\n void NATIVE.fetchNativeFrames()\n .then(framesMetrics => {\n if (framesMetrics) {\n transaction.setData('__startFrames', framesMetrics);\n } else {\n logger.warn(\n `[NativeFrames] Fetched frames for root span start (${\n transaction.spanContext().spanId\n }), but no frames were returned.`,\n );\n }\n })\n .then(undefined, error => {\n logger.error(\n `[NativeFrames] Error while fetching frames for root span start (${transaction.spanContext().spanId})`,\n error,\n );\n });\n\n instrumentChildSpanFinish(transaction, (_: Span, endTimestamp?: number) => {\n if (!endTimestamp) {\n this._onSpanFinish();\n }\n });\n }\n\n /**\n * To be called when a transaction is finished\n */\n public onTransactionFinish(transaction: Transaction): void {\n this._fetchEndFramesForTransaction(transaction).then(undefined, (reason: unknown) => {\n logger.error(\n `[NativeFrames] Error while fetching frames for root span start (${transaction.spanContext().spanId})`,\n reason,\n );\n });\n }\n\n /**\n * Called on a span finish to fetch native frames to support transactions with trimEnd.\n * Only to be called when a span does not have an end timestamp.\n */\n private _onSpanFinish(): void {\n const timestamp = timestampInSeconds();\n\n void NATIVE.fetchNativeFrames()\n .then(nativeFrames => {\n if (nativeFrames) {\n this._lastSpanFinishFrames = {\n timestamp,\n nativeFrames,\n };\n }\n })\n .then(undefined, error => {\n logger.error(`[NativeFrames] Error while fetching frames for child span end.`, error);\n });\n }\n\n /**\n * Returns the computed frames measurements and awaits for them if they are not ready yet.\n */\n private async _getFramesMeasurements(\n traceId: string,\n finalEndTimestamp: number,\n startFrames: NativeFramesResponse,\n ): Promise<FramesMeasurements | null> {\n if (_finishFrames.has(traceId)) {\n logger.debug(`[NativeFrames] Native end frames already fetched for trace id (${traceId}).`);\n return this._prepareMeasurements(traceId, finalEndTimestamp, startFrames);\n }\n\n return new Promise(resolve => {\n const timeout = setTimeout(() => {\n logger.debug(`[NativeFrames] Native end frames listener removed by timeout for trace id (${traceId}).`);\n _framesListeners.delete(traceId);\n\n resolve(null);\n }, 2000);\n\n _framesListeners.set(traceId, () => {\n logger.debug(`[NativeFrames] Native end frames listener called for trace id (${traceId}).`);\n resolve(this._prepareMeasurements(traceId, finalEndTimestamp, startFrames));\n\n clearTimeout(timeout);\n _framesListeners.delete(traceId);\n });\n });\n }\n\n /**\n * Returns the computed frames measurements given ready data\n */\n private _prepareMeasurements(\n traceId: string,\n finalEndTimestamp: number, // The actual transaction finish time.\n startFrames: NativeFramesResponse,\n ): FramesMeasurements | null {\n let finalFinishFrames: NativeFramesResponse | undefined;\n\n const finish = _finishFrames.get(traceId);\n if (\n finish &&\n finish.nativeFrames &&\n // Must be in the margin of error of the actual transaction finish time (finalEndTimestamp)\n Math.abs(finish.timestamp - finalEndTimestamp) < MARGIN_OF_ERROR_SECONDS\n ) {\n logger.debug(`[NativeFrames] Using frames from root span end (traceId, ${traceId}).`);\n finalFinishFrames = finish.nativeFrames;\n } else if (\n this._lastSpanFinishFrames &&\n Math.abs(this._lastSpanFinishFrames.timestamp - finalEndTimestamp) < MARGIN_OF_ERROR_SECONDS\n ) {\n // Fallback to the last span finish if it is within the margin of error of the actual finish timestamp.\n // This should be the case for trimEnd.\n logger.debug(`[NativeFrames] Using native frames from last span end (traceId, ${traceId}).`);\n finalFinishFrames = this._lastSpanFinishFrames.nativeFrames;\n } else {\n logger.warn(\n `[NativeFrames] Frames were collected within larger than margin of error delay for traceId (${traceId}). Dropping the inaccurate values.`,\n );\n return null;\n }\n\n const measurements = {\n frames_total: {\n value: finalFinishFrames.totalFrames - startFrames.totalFrames,\n unit: 'none',\n },\n frames_frozen: {\n value: finalFinishFrames.frozenFrames - startFrames.frozenFrames,\n unit: 'none',\n },\n frames_slow: {\n value: finalFinishFrames.slowFrames - startFrames.slowFrames,\n unit: 'none',\n },\n };\n\n if (\n measurements.frames_frozen.value <= 0 &&\n measurements.frames_slow.value <= 0 &&\n measurements.frames_total.value <= 0\n ) {\n logger.warn(\n `[NativeFrames] Detected zero slow or frozen frames. Not adding measurements to traceId (${traceId}).`,\n );\n return null;\n }\n\n return measurements;\n }\n\n /**\n * Fetch finish frames for a transaction at the current time. Calls any awaiting listeners.\n */\n private async _fetchEndFramesForTransaction(transaction: Transaction): Promise<void> {\n const startFrames = transaction.data.__startFrames as NativeFramesResponse | undefined;\n\n // This timestamp marks when the finish frames were retrieved. It should be pretty close to the transaction finish.\n const timestamp = timestampInSeconds();\n let finishFrames: NativeFramesResponse | null = null;\n if (startFrames) {\n finishFrames = await NATIVE.fetchNativeFrames();\n }\n\n _finishFrames.set(transaction.traceId, {\n nativeFrames: finishFrames,\n timestamp,\n });\n\n _framesListeners.get(transaction.traceId)?.();\n\n setTimeout(() => this._cancelEndFrames(transaction), FINAL_FRAMES_TIMEOUT_MS);\n }\n\n /**\n * On a finish frames failure, we cancel the await.\n */\n private _cancelEndFrames(transaction: Transaction): void {\n if (_finishFrames.has(transaction.traceId)) {\n _finishFrames.delete(transaction.traceId);\n\n logger.log(\n `[NativeFrames] Native frames timed out for ${transaction.op} transaction ${transaction.name}. Not adding native frames measurements.`,\n );\n }\n }\n\n /**\n * Adds frames measurements to an event. Called from a valid event processor.\n * Awaits for finish frames if needed.\n */\n private async _processEvent(event: Event, doesExist: () => boolean): Promise<Event> {\n if (!doesExist()) {\n return event;\n }\n\n if (event.type === 'transaction' && event.transaction && event.contexts && event.contexts.trace) {\n const traceContext = event.contexts.trace as {\n data?: { [key: string]: unknown };\n trace_id: string;\n name?: string;\n op?: string;\n };\n\n const traceId = traceContext.trace_id;\n\n if (!traceContext.data?.__startFrames) {\n logger.warn(\n `[NativeFrames] Start frames of transaction ${event.transaction} (eventId, ${event.event_id}) are missing, but it already ended.`,\n );\n }\n\n if (traceId && traceContext.data?.__startFrames && event.timestamp) {\n const measurements = await this._getFramesMeasurements(\n traceId,\n event.timestamp,\n traceContext.data.__startFrames as NativeFramesResponse,\n );\n\n if (measurements) {\n logger.log(\n `[Measurements] Adding measurements to ${traceContext.op} transaction ${\n event.transaction\n }: ${JSON.stringify(measurements, undefined, 2)}`,\n );\n\n event.measurements = {\n ...(event.measurements ?? {}),\n ...measurements,\n };\n\n _finishFrames.delete(traceId);\n }\n\n delete traceContext.data.__startFrames;\n }\n }\n\n return event;\n }\n}\n"]}
|