@nathanclaire/edge-telemetry-sdk 3.0.0 → 4.0.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/README.md +831 -186
- package/dist/appLifecycle-CECgRVu_.cjs +2 -0
- package/dist/appLifecycle-CECgRVu_.cjs.map +1 -0
- package/dist/appLifecycle-DQErzJIR.js +22 -0
- package/dist/appLifecycle-DQErzJIR.js.map +1 -0
- package/dist/batch-CwoO7noL.js +56 -0
- package/dist/batch-CwoO7noL.js.map +1 -0
- package/dist/batch-DNu8Xr9T.cjs +2 -0
- package/dist/batch-DNu8Xr9T.cjs.map +1 -0
- package/dist/crashCapture-BOJ8nSAZ.cjs +4 -0
- package/dist/crashCapture-BOJ8nSAZ.cjs.map +1 -0
- package/dist/crashCapture-BW8WuyaU.js +70 -0
- package/dist/crashCapture-BW8WuyaU.js.map +1 -0
- package/dist/crashHandler.web-8F_k2veo.js +29 -0
- package/dist/crashHandler.web-8F_k2veo.js.map +1 -0
- package/dist/crashHandler.web-CWmF56mJ.cjs +2 -0
- package/dist/crashHandler.web-CWmF56mJ.cjs.map +1 -0
- package/dist/crashHandlerNative.native-C2kSikDt.cjs +2 -0
- package/dist/crashHandlerNative.native-C2kSikDt.cjs.map +1 -0
- package/dist/crashHandlerNative.native-FupMnr1U.js +39 -0
- package/dist/crashHandlerNative.native-FupMnr1U.js.map +1 -0
- package/dist/deviceInfo.native-BJ-3Jj1T.js +53 -0
- package/dist/deviceInfo.native-BJ-3Jj1T.js.map +1 -0
- package/dist/deviceInfo.native-BoeTZcD6.cjs +2 -0
- package/dist/deviceInfo.native-BoeTZcD6.cjs.map +1 -0
- package/dist/deviceInfo.web-3L3IDQQA.cjs +2 -0
- package/dist/deviceInfo.web-3L3IDQQA.cjs.map +1 -0
- package/dist/deviceInfo.web-BFB1-pcA.js +41 -0
- package/dist/deviceInfo.web-BFB1-pcA.js.map +1 -0
- package/dist/frameTracker-CHG6sIx9.cjs +2 -0
- package/dist/frameTracker-CHG6sIx9.cjs.map +1 -0
- package/dist/frameTracker-DdB8W_kC.js +54 -0
- package/dist/frameTracker-DdB8W_kC.js.map +1 -0
- package/dist/httpAttributes-BrrtM8zh.js +70 -0
- package/dist/httpAttributes-BrrtM8zh.js.map +1 -0
- package/dist/httpAttributes-D0m6UID7.cjs +2 -0
- package/dist/httpAttributes-D0m6UID7.cjs.map +1 -0
- package/dist/index-BtLlV1HA.js +57 -0
- package/dist/index-BtLlV1HA.js.map +1 -0
- package/dist/{deviceInfo.native-D2k0LDhI.js → index-C2XQ-EYw.js} +362 -411
- package/dist/index-C2XQ-EYw.js.map +1 -0
- package/dist/index-CXsVZY35.cjs +2 -0
- package/dist/index-CXsVZY35.cjs.map +1 -0
- package/dist/index-DLquF88M.cjs +2 -0
- package/dist/index-DLquF88M.cjs.map +1 -0
- package/dist/index.native.cjs +1 -1
- package/dist/index.native.cjs.map +1 -1
- package/dist/index.native.js +94 -59
- package/dist/index.native.js.map +1 -1
- package/dist/index.web.cjs +1 -1
- package/dist/index.web.cjs.map +1 -1
- package/dist/index.web.js +88 -33
- package/dist/index.web.js.map +1 -1
- package/dist/interactionWeb.web-Bl_cZlgh.cjs +2 -0
- package/dist/interactionWeb.web-Bl_cZlgh.cjs.map +1 -0
- package/dist/interactionWeb.web-CJAviVQ7.js +109 -0
- package/dist/interactionWeb.web-CJAviVQ7.js.map +1 -0
- package/dist/interceptFetchWeb.web-T88kO-bE.cjs +2 -0
- package/dist/interceptFetchWeb.web-T88kO-bE.cjs.map +1 -0
- package/dist/interceptFetchWeb.web-UXC2Lb6X.js +61 -0
- package/dist/interceptFetchWeb.web-UXC2Lb6X.js.map +1 -0
- package/dist/interceptHttpNative.native-BVpFuoNB.cjs +2 -0
- package/dist/interceptHttpNative.native-BVpFuoNB.cjs.map +1 -0
- package/dist/interceptHttpNative.native-rX-lPNST.js +18 -0
- package/dist/interceptHttpNative.native-rX-lPNST.js.map +1 -0
- package/dist/loadingTime-Bhomd9qq.cjs +2 -0
- package/dist/loadingTime-Bhomd9qq.cjs.map +1 -0
- package/dist/loadingTime-ZkYvFijA.js +70 -0
- package/dist/loadingTime-ZkYvFijA.js.map +1 -0
- package/dist/memoryNative.native-C42h9SjK.js +54 -0
- package/dist/memoryNative.native-C42h9SjK.js.map +1 -0
- package/dist/memoryNative.native-CA-7w9w1.cjs +2 -0
- package/dist/memoryNative.native-CA-7w9w1.cjs.map +1 -0
- package/dist/memoryStore-BIGZmmfD.cjs +2 -0
- package/dist/memoryStore-BIGZmmfD.cjs.map +1 -0
- package/dist/memoryStore-F5I-GQKM.js +193 -0
- package/dist/memoryStore-F5I-GQKM.js.map +1 -0
- package/dist/nativeSender-CfQaRuDK.cjs +2 -0
- package/dist/nativeSender-CfQaRuDK.cjs.map +1 -0
- package/dist/nativeSender-pgVSIv-X.js +59 -0
- package/dist/nativeSender-pgVSIv-X.js.map +1 -0
- package/dist/navigationRef-BzYbs8cm.js +28 -0
- package/dist/navigationRef-BzYbs8cm.js.map +1 -0
- package/dist/navigationRef-C-_qhb43.cjs +2 -0
- package/dist/navigationRef-C-_qhb43.cjs.map +1 -0
- package/dist/{navigationTracker-Cts68dgG.js → navigationTracker-BmywA_Bg.js} +4 -4
- package/dist/navigationTracker-BmywA_Bg.js.map +1 -0
- package/dist/navigationTracker-HkwVyywz.cjs +2 -0
- package/dist/navigationTracker-HkwVyywz.cjs.map +1 -0
- package/dist/navigationWeb.web-CW_z7Ca4.cjs +2 -0
- package/dist/navigationWeb.web-CW_z7Ca4.cjs.map +1 -0
- package/dist/navigationWeb.web-CcwgKuIZ.js +55 -0
- package/dist/navigationWeb.web-CcwgKuIZ.js.map +1 -0
- package/dist/{networkInfo.native-BK5fpAOL.js → networkInfo.native-CGrx9cnH.js} +15 -15
- package/dist/{networkInfo.native-BK5fpAOL.js.map → networkInfo.native-CGrx9cnH.js.map} +1 -1
- package/dist/{networkInfo.native-cxuw93Uy.cjs → networkInfo.native-YVySdv3S.cjs} +2 -2
- package/dist/{networkInfo.native-cxuw93Uy.cjs.map → networkInfo.native-YVySdv3S.cjs.map} +1 -1
- package/dist/{networkInfo.web-twcNn_hc.js → networkInfo.web-B2YlLNsI.js} +3 -3
- package/dist/networkInfo.web-B2YlLNsI.js.map +1 -0
- package/dist/networkInfo.web-PltJTHsy.cjs +2 -0
- package/dist/networkInfo.web-PltJTHsy.cjs.map +1 -0
- package/dist/runtimeReady.native-Bh7EcYmK.js +14 -0
- package/dist/runtimeReady.native-Bh7EcYmK.js.map +1 -0
- package/dist/runtimeReady.native-jUmuE1lV.cjs +2 -0
- package/dist/runtimeReady.native-jUmuE1lV.cjs.map +1 -0
- package/dist/runtimeReady.web-C8fdIbVR.js +25 -0
- package/dist/runtimeReady.web-C8fdIbVR.js.map +1 -0
- package/dist/runtimeReady.web-DHW682RN.cjs +2 -0
- package/dist/runtimeReady.web-DHW682RN.cjs.map +1 -0
- package/dist/seedRuntimeReady-BKwkBEAF.cjs +2 -0
- package/dist/seedRuntimeReady-BKwkBEAF.cjs.map +1 -0
- package/dist/seedRuntimeReady-Cz8nOKoo.js +10 -0
- package/dist/seedRuntimeReady-Cz8nOKoo.js.map +1 -0
- package/dist/src/adapters/appLifecycle.d.ts +8 -1
- package/dist/src/adapters/batch.d.ts +2 -0
- package/dist/src/adapters/crashCapture.d.ts +38 -9
- package/dist/src/adapters/failedEvents.d.ts +43 -0
- package/dist/src/adapters/frameAggregate.d.ts +8 -3
- package/dist/src/adapters/frameTracker.d.ts +30 -0
- package/dist/src/adapters/httpAttributes.d.ts +18 -0
- package/dist/src/adapters/loadingTime.d.ts +67 -0
- package/dist/src/adapters/native/interceptHttpNative.native.d.ts +18 -0
- package/dist/src/adapters/native/memoryNative.native.d.ts +15 -11
- package/dist/src/adapters/native/runtimeReady.native.d.ts +1 -0
- package/dist/src/adapters/native/store.native.d.ts +10 -0
- package/dist/src/adapters/nativeSender.d.ts +2 -2
- package/dist/src/adapters/navigationRef.d.ts +21 -0
- package/dist/src/adapters/navigationTracker.d.ts +1 -1
- package/dist/src/adapters/screenTiming.d.ts +8 -2
- package/dist/src/adapters/seedRuntimeReady.d.ts +8 -0
- package/dist/src/adapters/traceHeader.d.ts +33 -0
- package/dist/src/adapters/traceManager.d.ts +131 -0
- package/dist/src/adapters/uiInteraction.d.ts +111 -0
- package/dist/src/adapters/viewManager.d.ts +161 -0
- package/dist/src/adapters/viewport.d.ts +15 -0
- package/dist/src/adapters/web/interactionWeb.web.d.ts +36 -0
- package/dist/src/adapters/web/interceptFetchWeb.web.d.ts +3 -11
- package/dist/src/adapters/web/navigationWeb.web.d.ts +10 -0
- package/dist/src/adapters/web/runtimeReady.web.d.ts +5 -0
- package/dist/src/adapters/web/store.web.d.ts +12 -0
- package/dist/src/adapters/web/webVitals.web.d.ts +49 -0
- package/dist/src/adapters/webSender.d.ts +2 -2
- package/dist/src/adapters/webVitals.d.ts +25 -0
- package/dist/src/adapters/xhrIntercept.d.ts +53 -0
- package/dist/src/core/beforeSend.d.ts +20 -0
- package/dist/src/core/debug.d.ts +7 -0
- package/dist/src/core/memoryStore.d.ts +23 -0
- package/dist/src/core/store.d.ts +41 -0
- package/dist/src/core/telemetry.d.ts +305 -35
- package/dist/src/core/userProfile.d.ts +12 -0
- package/dist/src/core/utils/json.d.ts +7 -0
- package/dist/src/core/utils/uuid.d.ts +10 -1
- package/dist/src/createTelemetry.native.d.ts +7 -0
- package/dist/src/createTelemetry.web.d.ts +7 -0
- package/dist/src/index.base.d.ts +17 -1
- package/dist/src/index.native.d.ts +46 -9
- package/dist/src/index.web.d.ts +33 -2
- package/dist/store.native-BYBJcy6o.js +32 -0
- package/dist/store.native-BYBJcy6o.js.map +1 -0
- package/dist/store.native-TPqXngmF.cjs +2 -0
- package/dist/store.native-TPqXngmF.cjs.map +1 -0
- package/dist/store.web-CvqqN-_Z.cjs +2 -0
- package/dist/store.web-CvqqN-_Z.cjs.map +1 -0
- package/dist/store.web-DJAlN0nc.js +31 -0
- package/dist/store.web-DJAlN0nc.js.map +1 -0
- package/dist/telemetry-ByDJIz_9.js +1280 -0
- package/dist/telemetry-ByDJIz_9.js.map +1 -0
- package/dist/telemetry-CrU7i1Jc.cjs +2 -0
- package/dist/telemetry-CrU7i1Jc.cjs.map +1 -0
- package/dist/uiInteraction-CdzvEI1p.cjs +2 -0
- package/dist/uiInteraction-CdzvEI1p.cjs.map +1 -0
- package/dist/uiInteraction-DAqxxz0q.js +104 -0
- package/dist/uiInteraction-DAqxxz0q.js.map +1 -0
- package/dist/viewport-Dd85GUNO.cjs +2 -0
- package/dist/viewport-Dd85GUNO.cjs.map +1 -0
- package/dist/viewport-Dzmt5QwK.js +15 -0
- package/dist/viewport-Dzmt5QwK.js.map +1 -0
- package/dist/web-vitals.attribution-CVCPiX-h.cjs +2 -0
- package/dist/web-vitals.attribution-CVCPiX-h.cjs.map +1 -0
- package/dist/web-vitals.attribution-xw9N5MKQ.js +488 -0
- package/dist/web-vitals.attribution-xw9N5MKQ.js.map +1 -0
- package/dist/webSender-BIwslfpT.js +63 -0
- package/dist/webSender-BIwslfpT.js.map +1 -0
- package/dist/webSender-CVtE4sOF.cjs +2 -0
- package/dist/webSender-CVtE4sOF.cjs.map +1 -0
- package/dist/webVitals.web-CNIpsKlA.js +85 -0
- package/dist/webVitals.web-CNIpsKlA.js.map +1 -0
- package/dist/webVitals.web-DpWJ-iYp.cjs +2 -0
- package/dist/webVitals.web-DpWJ-iYp.cjs.map +1 -0
- package/dist/xhrIntercept-BADex6Cq.cjs +2 -0
- package/dist/xhrIntercept-BADex6Cq.cjs.map +1 -0
- package/dist/xhrIntercept-BNiA41Mj.js +53 -0
- package/dist/xhrIntercept-BNiA41Mj.js.map +1 -0
- package/docs/migration-v4.md +190 -0
- package/package.json +12 -4
- package/dist/appLifecycle-Cynw0kAv.js +0 -14
- package/dist/appLifecycle-Cynw0kAv.js.map +0 -1
- package/dist/appLifecycle-DvJIt7ym.cjs +0 -2
- package/dist/appLifecycle-DvJIt7ym.cjs.map +0 -1
- package/dist/batch-CLBFgYPC.cjs +0 -2
- package/dist/batch-CLBFgYPC.cjs.map +0 -1
- package/dist/batch-DLG_gtOm.js +0 -12
- package/dist/batch-DLG_gtOm.js.map +0 -1
- package/dist/crashCapture-BYTM4FLC.cjs +0 -2
- package/dist/crashCapture-BYTM4FLC.cjs.map +0 -1
- package/dist/crashCapture-D_rkkBVa.js +0 -31
- package/dist/crashCapture-D_rkkBVa.js.map +0 -1
- package/dist/crashHandler.web-BSxDpFTo.cjs +0 -2
- package/dist/crashHandler.web-BSxDpFTo.cjs.map +0 -1
- package/dist/crashHandler.web-D59bmhg9.js +0 -32
- package/dist/crashHandler.web-D59bmhg9.js.map +0 -1
- package/dist/crashHandlerNative.native-DeAFze4E.cjs +0 -2
- package/dist/crashHandlerNative.native-DeAFze4E.cjs.map +0 -1
- package/dist/crashHandlerNative.native-d7qJkzA6.js +0 -41
- package/dist/crashHandlerNative.native-d7qJkzA6.js.map +0 -1
- package/dist/debug-DsvQ9y3W.js +0 -68
- package/dist/debug-DsvQ9y3W.js.map +0 -1
- package/dist/debug-rnOOxFpN.cjs +0 -2
- package/dist/debug-rnOOxFpN.cjs.map +0 -1
- package/dist/deviceInfo.native-7hbRYixR.cjs +0 -2
- package/dist/deviceInfo.native-7hbRYixR.cjs.map +0 -1
- package/dist/deviceInfo.native-D2k0LDhI.js.map +0 -1
- package/dist/deviceInfo.web-ByNAlEJh.cjs +0 -2
- package/dist/deviceInfo.web-ByNAlEJh.cjs.map +0 -1
- package/dist/deviceInfo.web-DzQyEku6.js +0 -40
- package/dist/deviceInfo.web-DzQyEku6.js.map +0 -1
- package/dist/frameAggregate-C_HoVFcK.cjs +0 -2
- package/dist/frameAggregate-C_HoVFcK.cjs.map +0 -1
- package/dist/frameAggregate-Cwh1juw1.js +0 -17
- package/dist/frameAggregate-Cwh1juw1.js.map +0 -1
- package/dist/frameDropsNative.native-CP7zrXDf.js +0 -23
- package/dist/frameDropsNative.native-CP7zrXDf.js.map +0 -1
- package/dist/frameDropsNative.native-DKqEDqip.cjs +0 -2
- package/dist/frameDropsNative.native-DKqEDqip.cjs.map +0 -1
- package/dist/frameDropsWeb.web-C9Lt3Fuj.js +0 -22
- package/dist/frameDropsWeb.web-C9Lt3Fuj.js.map +0 -1
- package/dist/frameDropsWeb.web-azpwQCUz.cjs +0 -2
- package/dist/frameDropsWeb.web-azpwQCUz.cjs.map +0 -1
- package/dist/httpAttributes-BV50UKQU.js +0 -19
- package/dist/httpAttributes-BV50UKQU.js.map +0 -1
- package/dist/httpAttributes-xXOD9trQ.cjs +0 -2
- package/dist/httpAttributes-xXOD9trQ.cjs.map +0 -1
- package/dist/interaction-CH8yoY5-.js +0 -23
- package/dist/interaction-CH8yoY5-.js.map +0 -1
- package/dist/interaction-DcNFBW7a.cjs +0 -2
- package/dist/interaction-DcNFBW7a.cjs.map +0 -1
- package/dist/interceptFetchNative.native-VlhtMG-U.js +0 -49
- package/dist/interceptFetchNative.native-VlhtMG-U.js.map +0 -1
- package/dist/interceptFetchNative.native-jEAldH14.cjs +0 -2
- package/dist/interceptFetchNative.native-jEAldH14.cjs.map +0 -1
- package/dist/interceptFetchWeb.web-DFzZliik.cjs +0 -2
- package/dist/interceptFetchWeb.web-DFzZliik.cjs.map +0 -1
- package/dist/interceptFetchWeb.web-DfsMfoRP.js +0 -77
- package/dist/interceptFetchWeb.web-DfsMfoRP.js.map +0 -1
- package/dist/memoryNative.native-BWLh2S9L.js +0 -48
- package/dist/memoryNative.native-BWLh2S9L.js.map +0 -1
- package/dist/memoryNative.native-DCXSOd4Q.cjs +0 -2
- package/dist/memoryNative.native-DCXSOd4Q.cjs.map +0 -1
- package/dist/memoryWeb.web-B3YuV-cB.js +0 -48
- package/dist/memoryWeb.web-B3YuV-cB.js.map +0 -1
- package/dist/memoryWeb.web-CheXAcJn.cjs +0 -2
- package/dist/memoryWeb.web-CheXAcJn.cjs.map +0 -1
- package/dist/nativeSender-BE_mzw_S.js +0 -70
- package/dist/nativeSender-BE_mzw_S.js.map +0 -1
- package/dist/nativeSender-DyAUGY7c.cjs +0 -2
- package/dist/nativeSender-DyAUGY7c.cjs.map +0 -1
- package/dist/navigationNative.native-3tO5JxSd.cjs +0 -2
- package/dist/navigationNative.native-3tO5JxSd.cjs.map +0 -1
- package/dist/navigationNative.native-BUCGPQX2.js +0 -25
- package/dist/navigationNative.native-BUCGPQX2.js.map +0 -1
- package/dist/navigationTracker-B2GMwyKk.cjs +0 -2
- package/dist/navigationTracker-B2GMwyKk.cjs.map +0 -1
- package/dist/navigationTracker-Cts68dgG.js.map +0 -1
- package/dist/navigationWeb.web-B0necr5j.cjs +0 -2
- package/dist/navigationWeb.web-B0necr5j.cjs.map +0 -1
- package/dist/navigationWeb.web-CORzE_Id.js +0 -46
- package/dist/navigationWeb.web-CORzE_Id.js.map +0 -1
- package/dist/networkInfo.web-DJmw1sNK.cjs +0 -2
- package/dist/networkInfo.web-DJmw1sNK.cjs.map +0 -1
- package/dist/networkInfo.web-twcNn_hc.js.map +0 -1
- package/dist/src/adapters/interaction.d.ts +0 -17
- package/dist/src/adapters/native/frameDropsNative.native.d.ts +0 -16
- package/dist/src/adapters/native/interceptFetchNative.native.d.ts +0 -23
- package/dist/src/adapters/native/navigationNative.native.d.ts +0 -12
- package/dist/src/adapters/web/frameDropsWeb.web.d.ts +0 -16
- package/dist/src/adapters/web/memoryWeb.web.d.ts +0 -26
- package/dist/telemetry-Co4MYdwa.cjs +0 -2
- package/dist/telemetry-Co4MYdwa.cjs.map +0 -1
- package/dist/telemetry-KI0x4gzC.js +0 -389
- package/dist/telemetry-KI0x4gzC.js.map +0 -1
- package/dist/v4-BysszJq8.js +0 -31
- package/dist/v4-BysszJq8.js.map +0 -1
- package/dist/v4-CqdK_b8Y.cjs +0 -2
- package/dist/v4-CqdK_b8Y.cjs.map +0 -1
- package/dist/webSender-B27tmT1w.js +0 -42
- package/dist/webSender-B27tmT1w.js.map +0 -1
- package/dist/webSender-BWi4x1df.cjs +0 -2
- package/dist/webSender-BWi4x1df.cjs.map +0 -1
|
@@ -1,4 +1,47 @@
|
|
|
1
1
|
import { ScreenTimingTracker } from '../adapters/screenTiming';
|
|
2
|
+
import { ViewManager, ViewNameSource } from '../adapters/viewManager';
|
|
3
|
+
import { TraceManager } from '../adapters/traceManager';
|
|
4
|
+
import { ErrorSource } from '../adapters/crashCapture';
|
|
5
|
+
import { Store } from './store';
|
|
6
|
+
import { BeforeSend } from './beforeSend';
|
|
7
|
+
import { Orientation } from '../adapters/viewport';
|
|
8
|
+
export type { BeforeSend } from './beforeSend';
|
|
9
|
+
export type { Orientation };
|
|
10
|
+
/** `sdk.drop_reason` (§11). `rejected` has no producer until 4xx-drops-the-batch lands (#113). */
|
|
11
|
+
export type DropReason = "queue_full" | "store_full" | "rejected";
|
|
12
|
+
/**
|
|
13
|
+
* §4.7's two error names. Both book `sdk.error_count` and `view.error_count` — a closed
|
|
14
|
+
* enumeration, not resource failures and not `console.warn`. Only `app.crash` gets the
|
|
15
|
+
* dedicated crash path and the eviction reprieve, which is the whole point of the split:
|
|
16
|
+
* `COUNT(event_name='app.crash')` must stay a crash count nobody can forget to filter.
|
|
17
|
+
*/
|
|
18
|
+
export declare const isErrorName: (name?: string) => boolean;
|
|
19
|
+
export declare function evictIndex(events: TelemetryEvent[]): number;
|
|
20
|
+
/** Store key for the self-minted, persisted `device.id` (#91). */
|
|
21
|
+
export declare const DEVICE_ID_KEY = "telemetry_device_id";
|
|
22
|
+
/** Store key for the resumable session record (#92). */
|
|
23
|
+
export declare const SESSION_KEY = "telemetry_session";
|
|
24
|
+
/** `session.reason` domains: 3 on session.started, the last 2 on session.finalized (§4.1/§4.2). */
|
|
25
|
+
export type SessionReason = "launch" | "idle" | "max_duration";
|
|
26
|
+
export type SessionEndReason = Exclude<SessionReason, "launch">;
|
|
27
|
+
/**
|
|
28
|
+
* §4.6's mint/emit split, for the one event that has one. A `ui.interaction` is emitted
|
|
29
|
+
* after its dead-click window, so its wire `timestamp` and its `view.id` / `view.name` /
|
|
30
|
+
* `session.id` are snapshotted at the click and replayed here — otherwise a tap that
|
|
31
|
+
* navigates is booked against the view it opened.
|
|
32
|
+
*/
|
|
33
|
+
export type LogSnapshot = {
|
|
34
|
+
/**
|
|
35
|
+
* Epoch ms of the click. Becomes the row's `timestamp`. **Omitted by a span-carrying row
|
|
36
|
+
* that is not deferred** — an `http.request` freezes its *attribution* at send but still
|
|
37
|
+
* reports the completion time §4.4 gives it.
|
|
38
|
+
*/
|
|
39
|
+
at?: number;
|
|
40
|
+
viewId: string;
|
|
41
|
+
sessionId: string;
|
|
42
|
+
/** Epoch ms — `session.start_time` freezes with the id it belongs to (§3.1). */
|
|
43
|
+
sessionStart: number;
|
|
44
|
+
};
|
|
2
45
|
export type TelemetryEvent = {
|
|
3
46
|
type: 'event' | 'metric';
|
|
4
47
|
eventName?: string;
|
|
@@ -9,7 +52,13 @@ export type TelemetryEvent = {
|
|
|
9
52
|
};
|
|
10
53
|
export interface Sender {
|
|
11
54
|
send(events: TelemetryEvent[]): Promise<void>;
|
|
12
|
-
|
|
55
|
+
/**
|
|
56
|
+
* Persist a batch that could not be sent. Returns how many rows the offline store's
|
|
57
|
+
* cap cost, so core can book them as `sdk.drop_reason = "store_full"` (§9.4) — the
|
|
58
|
+
* counter lives on the Context block, which only core assembles. `void` is still a
|
|
59
|
+
* valid return: a consumer's own sender is not obliged to have a cap.
|
|
60
|
+
*/
|
|
61
|
+
onFailure?(events: TelemetryEvent[]): Promise<number | void>;
|
|
13
62
|
replayFailed?(): Promise<void>;
|
|
14
63
|
}
|
|
15
64
|
export interface CrashHandlerOptions {
|
|
@@ -20,13 +69,7 @@ export interface CrashHandler {
|
|
|
20
69
|
}
|
|
21
70
|
export interface NetworkInfo {
|
|
22
71
|
type?: string;
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
export interface WebExtraNetworkInfo {
|
|
26
|
-
type?: string;
|
|
27
|
-
isConnected?: boolean;
|
|
28
|
-
downlink?: number;
|
|
29
|
-
effectiveType?: string;
|
|
72
|
+
is_connected?: boolean;
|
|
30
73
|
}
|
|
31
74
|
export interface NetworkInfoHandler {
|
|
32
75
|
start(telemetry: Telemetry): Promise<NetworkInfo>;
|
|
@@ -43,7 +86,9 @@ export interface NetworkHandler {
|
|
|
43
86
|
start(): Promise<void>;
|
|
44
87
|
}
|
|
45
88
|
export interface MemoryHandler {
|
|
46
|
-
|
|
89
|
+
start(): Promise<void>;
|
|
90
|
+
/** Torn down by `shutdown()`: unlike the rAF-driven trackers this one owns a timer. */
|
|
91
|
+
stop?(): void;
|
|
47
92
|
}
|
|
48
93
|
export interface NavigationHandler {
|
|
49
94
|
start(): Promise<void>;
|
|
@@ -52,35 +97,44 @@ export interface DeviceInfo {
|
|
|
52
97
|
app: {
|
|
53
98
|
name: string;
|
|
54
99
|
version: string;
|
|
55
|
-
|
|
56
|
-
|
|
100
|
+
build_number?: string;
|
|
101
|
+
package_name?: string;
|
|
57
102
|
};
|
|
58
103
|
device: {
|
|
59
|
-
id: string;
|
|
60
104
|
platform: string;
|
|
61
|
-
|
|
105
|
+
platform_version?: string;
|
|
62
106
|
model?: string;
|
|
63
107
|
manufacturer?: string;
|
|
64
108
|
brand?: string;
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
fingerprint?: string;
|
|
109
|
+
android_sdk?: string;
|
|
110
|
+
android_release?: string;
|
|
68
111
|
hardware?: string;
|
|
69
112
|
product?: string;
|
|
70
|
-
|
|
71
|
-
|
|
113
|
+
ios_system_name?: string;
|
|
114
|
+
cpu_abi?: string;
|
|
115
|
+
low_ram?: boolean;
|
|
116
|
+
screen_density?: number;
|
|
117
|
+
screen_width_px?: number;
|
|
118
|
+
screen_height_px?: number;
|
|
119
|
+
orientation?: Orientation;
|
|
72
120
|
};
|
|
73
121
|
}
|
|
74
122
|
export interface UserProfile {
|
|
75
123
|
userId?: string;
|
|
124
|
+
/** @deprecated Removed in v5 — use `identify({ name })`. Still the source of `user.name`. */
|
|
76
125
|
fullName?: string;
|
|
126
|
+
/** @deprecated Removed in v5 — never reached the wire; `identify()` could not set it. */
|
|
77
127
|
firstName?: string;
|
|
128
|
+
/** @deprecated Removed in v5 — never reached the wire; `identify()` could not set it. */
|
|
78
129
|
lastName?: string;
|
|
79
130
|
email?: string;
|
|
80
131
|
phone?: string;
|
|
132
|
+
/** @deprecated Removed in v5 — no column and no reader; `user.avatar` is off the wire (§3.4). */
|
|
81
133
|
avatar?: string;
|
|
82
134
|
customAttributes?: Record<string, any>;
|
|
135
|
+
/** @deprecated Removed in v5 — in-memory only, so it meant "first identify() this process" (§3.4). */
|
|
83
136
|
createdAt?: number;
|
|
137
|
+
/** @deprecated Removed in v5 — byte-identical to `createdAt` for any one-identify() app (§3.4). */
|
|
84
138
|
updatedAt?: number;
|
|
85
139
|
}
|
|
86
140
|
type Opts = {
|
|
@@ -89,11 +143,18 @@ type Opts = {
|
|
|
89
143
|
flushIntervalMs?: number;
|
|
90
144
|
endpoint?: string;
|
|
91
145
|
sessionId?: string;
|
|
92
|
-
userId?: string
|
|
146
|
+
userId?: string;
|
|
93
147
|
sdkVersion?: string;
|
|
94
148
|
platform?: string;
|
|
149
|
+
traceLaunchStart?: number;
|
|
95
150
|
deviceInfoHandler?: DeviceInfoHandler;
|
|
96
151
|
networkInfoHandler?: NetworkInfoHandler;
|
|
152
|
+
store?: Store;
|
|
153
|
+
beforeSend?: BeforeSend;
|
|
154
|
+
sessionSampleRate?: number;
|
|
155
|
+
traceHostAllowlist?: string[];
|
|
156
|
+
buildId?: string;
|
|
157
|
+
deprecatedScreenFeeds?: boolean;
|
|
97
158
|
};
|
|
98
159
|
/**
|
|
99
160
|
* Telemetry core: queueing, batching, retries, auto-replay and session/user management.
|
|
@@ -109,14 +170,26 @@ export declare class Telemetry {
|
|
|
109
170
|
private crashHandler?;
|
|
110
171
|
private navigationTracker?;
|
|
111
172
|
screens: ScreenTimingTracker;
|
|
173
|
+
readonly views: ViewManager;
|
|
174
|
+
readonly trace: TraceManager;
|
|
175
|
+
webInteractions?: {
|
|
176
|
+
start(): void;
|
|
177
|
+
};
|
|
178
|
+
webVitals?: {
|
|
179
|
+
start(): Promise<void>;
|
|
180
|
+
};
|
|
181
|
+
private readonly deprecatedScreenFeeds;
|
|
112
182
|
currentScreen?: string;
|
|
113
183
|
private networkInfoHandler;
|
|
114
184
|
private deviceInfoHandler;
|
|
185
|
+
readonly store: Store;
|
|
115
186
|
private frameDropsHandler?;
|
|
116
187
|
private networkHandler?;
|
|
117
188
|
private memoryHandler?;
|
|
118
189
|
private navigationHandler?;
|
|
119
190
|
private userId?;
|
|
191
|
+
private deviceIdEphemeral;
|
|
192
|
+
private deviceIdPromise?;
|
|
120
193
|
private userProfile?;
|
|
121
194
|
private sessionId;
|
|
122
195
|
private sessionStart;
|
|
@@ -126,9 +199,46 @@ export declare class Telemetry {
|
|
|
126
199
|
private breadcrumbs;
|
|
127
200
|
private lastActivity?;
|
|
128
201
|
private sessionSequence;
|
|
202
|
+
private eventSequence;
|
|
129
203
|
private sessionEventCount;
|
|
130
204
|
private errorCount;
|
|
205
|
+
private readonly configuredSampleRate;
|
|
206
|
+
private sampleRate;
|
|
207
|
+
private sampled;
|
|
208
|
+
private readonly beforeSend?;
|
|
209
|
+
/** `app.build_id` (§4.8). Empty string is *not* a build id — it is an unset one. */
|
|
210
|
+
private readonly buildId?;
|
|
211
|
+
private hookDropped;
|
|
212
|
+
private hookFailed;
|
|
213
|
+
private eventsDropped;
|
|
214
|
+
private dropReason?;
|
|
215
|
+
private crashPersistedThrough;
|
|
216
|
+
private appStartEmitted;
|
|
131
217
|
constructor(opts?: Opts);
|
|
218
|
+
/**
|
|
219
|
+
* §4.7 — report a handled error. Accepts `unknown` on purpose: half of real `catch`
|
|
220
|
+
* blocks receive a string or an axios rejection object, and a consumer should not have
|
|
221
|
+
* to prove to TypeScript that it is an `Error` before reporting it.
|
|
222
|
+
*
|
|
223
|
+
* Emits `app.error`, **never** `app.crash`. There is deliberately no public path to
|
|
224
|
+
* `app.crash` — a consumer's own code must not be able to manufacture rows in the one
|
|
225
|
+
* table an unfiltered crash-free rate is read from.
|
|
226
|
+
*
|
|
227
|
+
* `source` is SDK-internal (`captureConsole` passes `"console"`); the public wrappers
|
|
228
|
+
* forward two arguments, so a consumer can only ever produce `"reported"`. Routing the
|
|
229
|
+
* console path through here rather than through `log()` directly is what keeps the
|
|
230
|
+
* `error.fatal` rule in one place.
|
|
231
|
+
*/
|
|
232
|
+
captureError(error: unknown, context?: Record<string, any>, source?: ErrorSource): Promise<void>;
|
|
233
|
+
/**
|
|
234
|
+
* Extend the breadcrumb trail without emitting anything. §4.7 demotes `console.warn` to
|
|
235
|
+
* exactly this — React's dev-mode warnings were the bulk of v3's `app.crash` volume.
|
|
236
|
+
*
|
|
237
|
+
* SDK-internal: `public` only so `adapters/crashCapture.ts` can reach it. Not on
|
|
238
|
+
* `TelemetryBase` and not part of the consumer API — a host app that wants a trail entry
|
|
239
|
+
* should `log()` an event, which extends the trail anyway.
|
|
240
|
+
*/
|
|
241
|
+
addBreadcrumb(name: string, data?: Record<string, any>): void;
|
|
132
242
|
trackErrors(crashHandler: CrashHandler, options?: CrashHandlerOptions): void;
|
|
133
243
|
getDeviceInfo(deviceInfoHandler: DeviceInfoHandler): void;
|
|
134
244
|
getNetworkInfo(networkInfoHandler: NetworkInfoHandler): void;
|
|
@@ -136,33 +246,126 @@ export declare class Telemetry {
|
|
|
136
246
|
trackNetworkRequests(networkHandler: NetworkHandler): void;
|
|
137
247
|
trackMemoryUsage(memoryHandler: MemoryHandler): void;
|
|
138
248
|
autoTrackNavigation(navigationHandler?: NavigationHandler): void;
|
|
249
|
+
/**
|
|
250
|
+
* The per-session sample roll (§3.6). Never per-event: per-event sampling punches
|
|
251
|
+
* holes that desynchronise the per-view counters by a random factor per view.
|
|
252
|
+
*
|
|
253
|
+
* `Math.random()` is deliberate here where `randomHex` refuses it — this decides one
|
|
254
|
+
* boolean that dies with the session, not an id that persists forever, and a biased
|
|
255
|
+
* PRNG costs a fraction of a percent of sample accuracy rather than a permanent
|
|
256
|
+
* identity collision.
|
|
257
|
+
*/
|
|
258
|
+
private rollSample;
|
|
259
|
+
/** §3.3 / §4.7's platform split, from the entry's declared `platform` opt — never a global. */
|
|
260
|
+
private isNativePlatform;
|
|
139
261
|
private generateSessionId;
|
|
140
262
|
setSessionId(id: string): void;
|
|
141
263
|
getSessionId(): string;
|
|
264
|
+
/**
|
|
265
|
+
* Freeze the identity a deferred row must report (§4.6). Read **synchronously at the
|
|
266
|
+
* moment the thing happened**, so a `log()` that lands after a route change or a session
|
|
267
|
+
* rotation still books the click where it occurred.
|
|
268
|
+
*/
|
|
269
|
+
snapshot(at?: number): LogSnapshot;
|
|
142
270
|
/** Collector endpoint, so fetch/XHR adapters can skip self-capturing the SDK's own POST. */
|
|
143
271
|
getEndpoint(): string | undefined;
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
272
|
+
/**
|
|
273
|
+
* Sampling stays **session-level** (§6.5): an unsampled session injects no header at
|
|
274
|
+
* all — not a `flags=00` id. Read by the interceptors, which sit outside `log()`'s own
|
|
275
|
+
* sampled-out early return and so need the decision directly.
|
|
276
|
+
*/
|
|
277
|
+
isSampled(): boolean;
|
|
278
|
+
/**
|
|
279
|
+
* The entry's one call at init (§4.2): resume the durable session when the gap is
|
|
280
|
+
* inside the idle window, otherwise close the stale one out and start fresh.
|
|
281
|
+
*
|
|
282
|
+
* Process death, tab close, hard reload and bfcache restore all land here, and all
|
|
283
|
+
* four **resume** — which is why a resumed session must not re-emit `session.started`
|
|
284
|
+
* (§4.1), or `COUNT(session.started)` stops equalling session count.
|
|
285
|
+
*/
|
|
286
|
+
resumeOrStartSession(): Promise<void>;
|
|
287
|
+
private hydrateAndAnnounce;
|
|
288
|
+
/**
|
|
289
|
+
* `app.start` (§4.3/§6.2): once per process, a **root** of `trace.root_type = launch`,
|
|
290
|
+
* carrying the launch root minted in the constructor. Idempotent because the web build
|
|
291
|
+
* re-runs `resumeOrStartSession()` on a bfcache restore, which is a resumed process and
|
|
292
|
+
* not a new one.
|
|
293
|
+
*/
|
|
294
|
+
private emitAppStart;
|
|
295
|
+
/**
|
|
296
|
+
* Read the durable record and adopt it. Adoption happens even when the session has
|
|
297
|
+
* expired: `session.finalized` has to ship under the *old* `session.id` and
|
|
298
|
+
* `session.start_time` before the fresh one takes over.
|
|
299
|
+
*/
|
|
300
|
+
private hydrateSession;
|
|
301
|
+
/**
|
|
302
|
+
* Which boundary, if any, the current session has crossed. Idle is checked first:
|
|
303
|
+
* when a long session has also gone quiet, the reason it ended is that the user left.
|
|
304
|
+
*
|
|
305
|
+
* Inert until `lastActivity` is set, so a bare `new Telemetry()` that never started a
|
|
306
|
+
* session never rotates one.
|
|
307
|
+
*/
|
|
308
|
+
private expiryReason;
|
|
309
|
+
/**
|
|
310
|
+
* Write the session through the `Store` so the next process can resume it.
|
|
311
|
+
*
|
|
312
|
+
* ponytail: one write per event. Web's is a synchronous `localStorage` write; native's
|
|
313
|
+
* is an AsyncStorage round-trip — debounce here if it ever shows up in a trace.
|
|
314
|
+
*/
|
|
315
|
+
private persistSession;
|
|
316
|
+
/** Emit session.started for the current session. */
|
|
317
|
+
startSession(reason: SessionReason): Promise<void>;
|
|
318
|
+
/**
|
|
319
|
+
* Finalize the current session: journey summary + sdk.error_count, then an immediate flush.
|
|
320
|
+
*
|
|
321
|
+
* The backend discards `duration_ms` and `event_count` and derives both (§4.2) — they
|
|
322
|
+
* stay on the wire because the event survives as the carrier for `session.reason` and
|
|
323
|
+
* `sdk.error_count`, neither of which is derivable. Duration is stamped from
|
|
324
|
+
* `lastActivity`, never `now`: a lazily-detected rotation must report 2 minutes of use,
|
|
325
|
+
* not the 6 idle hours that followed it.
|
|
326
|
+
*/
|
|
327
|
+
finalizeSession(reason: SessionEndReason): Promise<void>;
|
|
149
328
|
/** Begin a fresh session: new id/start, reset per-session counters, emit session.started. */
|
|
150
|
-
newSession(): Promise<void>;
|
|
151
|
-
/**
|
|
152
|
-
rotateSession(): Promise<void>;
|
|
329
|
+
newSession(reason: SessionReason): Promise<void>;
|
|
330
|
+
/** Boundary rotation: finalize the old session then start a fresh one (the pair). */
|
|
331
|
+
rotateSession(reason: SessionEndReason): Promise<void>;
|
|
332
|
+
/** Truncated at source (§3.2): the collector caps at 255 and we must not be the one over. */
|
|
153
333
|
setUserId(id: string): void;
|
|
154
|
-
getUserId(): string | undefined
|
|
155
|
-
|
|
334
|
+
getUserId(): string | undefined;
|
|
335
|
+
/**
|
|
336
|
+
* The SDK-owned `device.id` (§3.2/§3.3): self-minted, written through the `Store`,
|
|
337
|
+
* uninstall-scoped, stable across process restarts, and never rotated by login,
|
|
338
|
+
* logout or a profile clear.
|
|
339
|
+
*
|
|
340
|
+
* The platform suffix is the entry's (ios|android|web), not the device-info adapter's:
|
|
341
|
+
* this id is persisted forever, so it must not depend on a call that can throw on first run.
|
|
342
|
+
*
|
|
343
|
+
* `getUniqueId()` is deliberately not used — it already carries two lifetimes on RN
|
|
344
|
+
* alone (ANDROID_ID survives reinstall, identifierForVendor does not), so one identity
|
|
345
|
+
* column would mean two things.
|
|
346
|
+
*
|
|
347
|
+
* When the Store reports `unavailable` — incognito, a partitioned iframe, ITP
|
|
348
|
+
* eviction, a full disk — the id lives for one process only and `device.id_ephemeral`
|
|
349
|
+
* rides the Context block to say so, because that population is otherwise
|
|
350
|
+
* indistinguishable from real installs and reads as traffic growth.
|
|
351
|
+
*/
|
|
352
|
+
private getDeviceId;
|
|
156
353
|
/**
|
|
157
354
|
* Set complete user profile information
|
|
158
355
|
*/
|
|
159
356
|
setUserProfile(profile: Partial<UserProfile>): void;
|
|
160
357
|
/**
|
|
161
|
-
* EdgeRum-style identify():
|
|
162
|
-
*
|
|
163
|
-
*
|
|
358
|
+
* EdgeRum-style identify(): record the host-app profile and emit the one event that
|
|
359
|
+
* carries it — `user.profile.update` (§4.10, #107). The PII is no longer on the
|
|
360
|
+
* Context block of every event.
|
|
361
|
+
*
|
|
362
|
+
* `userId` is optional and new in v4: the one call that sends a profile should also
|
|
363
|
+
* set the key that profile attaches to, since `user.id` is consumer-supplied (§3.2)
|
|
364
|
+
* and an unkeyed profile has nothing to upsert on. Omitting it leaves `user.id`
|
|
365
|
+
* exactly as it was — identify never mints one.
|
|
164
366
|
*/
|
|
165
367
|
identify(profile: {
|
|
368
|
+
userId?: string;
|
|
166
369
|
name?: string;
|
|
167
370
|
email?: string;
|
|
168
371
|
phone?: string;
|
|
@@ -205,7 +408,30 @@ export declare class Telemetry {
|
|
|
205
408
|
* Log a named event. Keeps existing signature compatibility.
|
|
206
409
|
* Automatically attaches userId and sessionId to every queued event.
|
|
207
410
|
*/
|
|
208
|
-
log(name: string, data?: Record<string, any
|
|
411
|
+
log(name: string, data?: Record<string, any>, snapshot?: LogSnapshot): Promise<void>;
|
|
412
|
+
/**
|
|
413
|
+
* The crash path (§2 / §9.4): persist the whole queue, then send **one** batch reordered
|
|
414
|
+
* so the crash rides in it. Not a drain — a dying process gets one round trip.
|
|
415
|
+
*
|
|
416
|
+
* ⚠ The web/native asymmetry is real and is not fixed here. On web the `Store` is
|
|
417
|
+
* synchronous `localStorage`, so the persist has *landed* by the time the next line runs
|
|
418
|
+
* and the loss window closes. On native it is an AsyncStorage round-trip that a SIGKILL
|
|
419
|
+
* can outrun, so the window only narrows. Awaiting harder does not change that; the
|
|
420
|
+
* asymmetry is the `Store` port's whole point (`core/store.ts`).
|
|
421
|
+
*
|
|
422
|
+
* The persisted copy is a safety copy, not a handoff: the queue is left intact, because
|
|
423
|
+
* an `app.crash` is not always fatal — `window.onerror` fires and the page keeps running
|
|
424
|
+
* — and the process usually lives on. A successful send therefore
|
|
425
|
+
* leaves a duplicate on disk to replay next launch — which is what `event.sequence` and
|
|
426
|
+
* the backend's `(session_id, event_sequence)` dedup exist for (§2.4).
|
|
427
|
+
*
|
|
428
|
+
* *One* duplicate. Each row is written at most once by this path, watermarked on
|
|
429
|
+
* `event.sequence`: a chatty app crash-flushes often, and re-persisting the whole queue
|
|
430
|
+
* each time would fill the store with copies of
|
|
431
|
+
* its own backlog and book `store_full` drops that are not loss — corrupting the very
|
|
432
|
+
* counter this change adds.
|
|
433
|
+
*/
|
|
434
|
+
private flushCrash;
|
|
209
435
|
/**
|
|
210
436
|
* Build the v3 Context block that rides on every event AND metric: the flattened
|
|
211
437
|
* device/network snapshot, the caller's data, identity + session + sdk fields, and the
|
|
@@ -219,15 +445,59 @@ export declare class Telemetry {
|
|
|
219
445
|
* (memory/frames) must not keep a session alive and defeat the 30-min idle rotation.
|
|
220
446
|
*/
|
|
221
447
|
logMetric(metricName: string, value: number, data?: Record<string, any>): Promise<void>;
|
|
448
|
+
/**
|
|
449
|
+
* The single enqueue point: neither the sample decision nor `beforeSend` can be
|
|
450
|
+
* bypassed by a future emit path, and the hook runs *before* the queue — which is
|
|
451
|
+
* what keeps scrubbed fields off disk when a send fails and the batch is persisted.
|
|
452
|
+
*
|
|
453
|
+
* The sample check is repeated by log()/logMetric() ahead of `collectContext()`, so
|
|
454
|
+
* a sampled-out session does no work per event; this one is the backstop that makes
|
|
455
|
+
* the guarantee structural rather than a convention two call sites happen to follow.
|
|
456
|
+
*
|
|
457
|
+
* The two counters are separate on purpose: "my volume is down 40%" has to
|
|
458
|
+
* distinguish *my rule is too broad* from *my rule is crashing*, and one merged
|
|
459
|
+
* counter answers neither.
|
|
460
|
+
*/
|
|
461
|
+
private enqueue;
|
|
462
|
+
/**
|
|
463
|
+
* Hold the in-memory queue at its cap (§9.4), booking what it costs.
|
|
464
|
+
*
|
|
465
|
+
* The count lands on the *next* event's Context block, not this one's — `collectContext()`
|
|
466
|
+
* has already run by the time we get here. That is §3.7's stated behaviour, not a bug.
|
|
467
|
+
*/
|
|
468
|
+
private capQueue;
|
|
469
|
+
/**
|
|
470
|
+
* Book dropped rows against the monotonic counter and the reason that shipped last.
|
|
471
|
+
* Takes `Sender.onFailure`'s return shape as-is — a sender with no cap returns nothing.
|
|
472
|
+
*/
|
|
473
|
+
private recordDrop;
|
|
222
474
|
private flattenWithPrefix;
|
|
223
475
|
/**
|
|
224
476
|
* Explicit metric helper (optional convenience) — routes through the v3 metric path.
|
|
225
477
|
*/
|
|
226
478
|
recordMetric(name: string, value: number, data?: Record<string, any>): Promise<void>;
|
|
227
479
|
flush(): Promise<void>;
|
|
480
|
+
/**
|
|
481
|
+
* Book an acknowledged (2xx) batch. `session.sequence` orders a session's batches (#29),
|
|
482
|
+
* and it is persisted because a resumed session restarting at 0 would emit duplicate
|
|
483
|
+
* (session.id, session.sequence) pairs and stop ordering anything (#92).
|
|
484
|
+
*/
|
|
485
|
+
private ackBatch;
|
|
228
486
|
getQueue(): TelemetryEvent[];
|
|
229
487
|
shutdown(): Promise<void>;
|
|
230
488
|
getEventCount(): number;
|
|
231
|
-
|
|
489
|
+
/**
|
|
490
|
+
* A route change: the view boundary (§4.5) plus, on native only, the two deprecated
|
|
491
|
+
* feeds (§4.11). v3's two native screen paths were disjoint — `attachNavigation` never
|
|
492
|
+
* touched `inst.screens`, so a React Navigation consumer emitted `navigation` on every
|
|
493
|
+
* route change and never a single `screen.duration`. Unifying them here is what fixes
|
|
494
|
+
* that, which is why a *deprecated* event starts firing where it never has.
|
|
495
|
+
*/
|
|
496
|
+
recordRouteChange(from: string, to: string): Promise<void>;
|
|
497
|
+
/**
|
|
498
|
+
* Feed the name ladder (§4.5.1). Rungs 1 and 2 arrive unnormalized; rung 3's caller
|
|
499
|
+
* normalizes before calling. Whether this re-stamps the current view or mints a
|
|
500
|
+
* successor is the ladder's decision, not the caller's.
|
|
501
|
+
*/
|
|
502
|
+
enterView(name: string, source: ViewNameSource): Promise<void>;
|
|
232
503
|
}
|
|
233
|
-
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { UserProfile } from './telemetry';
|
|
2
|
+
export declare const NAME_CAP = 255;
|
|
3
|
+
export declare const EMAIL_CAP = 255;
|
|
4
|
+
export declare const PHONE_CAP = 50;
|
|
5
|
+
export declare const CUSTOM_MAX_KEYS = 64;
|
|
6
|
+
export declare const CUSTOM_KEY_CAP = 64;
|
|
7
|
+
export declare const CUSTOM_VALUE_CAP = 255;
|
|
8
|
+
/**
|
|
9
|
+
* The wire keys for `user.profile.update`. `user.id` is not here — it rides the Context
|
|
10
|
+
* block, where it is present on this event by construction.
|
|
11
|
+
*/
|
|
12
|
+
export declare function buildProfileAttributes(profile: UserProfile | undefined): Record<string, any>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `JSON.stringify` that returns `undefined` instead of throwing — a cycle, a `toJSON` that
|
|
3
|
+
* threw, a `BigInt`. Shared by `user.custom.*`'s bag rule (§4.10) and `flattenWithPrefix`'s
|
|
4
|
+
* depth cap: both exist so a bad consumer payload is a dropped key rather than an exception
|
|
5
|
+
* raised inside the SDK, in the host app's own call stack.
|
|
6
|
+
*/
|
|
7
|
+
export declare function stringifyOrDrop(value: unknown): string | undefined;
|
|
@@ -1,2 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Wire-contract ids carry a 16-hex-char (64-bit) random segment (§3.3) — except W3C
|
|
3
|
+
* `trace.id`, which is 32 (§6.1). The length is the caller's; the entropy source is not.
|
|
4
|
+
*
|
|
5
|
+
* Entropy is `crypto.getRandomValues`, not `Math.random()` (#91): `device.id` is now
|
|
6
|
+
* persisted, so a collision is *permanent* — two handsets merge into one device row and
|
|
7
|
+
* one rate-limit bucket forever — where a session collision was transient. RN has no
|
|
8
|
+
* WebCrypto of its own; the native entry imports `react-native-get-random-values`
|
|
9
|
+
* (already a dependency) to install it before the first id is minted.
|
|
10
|
+
*/
|
|
2
11
|
export declare function randomHex(length?: number): string;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { TelemetryNative } from './index.native';
|
|
2
|
+
import { Store } from './core/store';
|
|
3
|
+
import { BeforeSend } from './core/beforeSend';
|
|
2
4
|
export type TelemetryOpts = {
|
|
3
5
|
apiKey: string;
|
|
4
6
|
sender?: any;
|
|
@@ -7,6 +9,11 @@ export type TelemetryOpts = {
|
|
|
7
9
|
endpoint?: string;
|
|
8
10
|
captureConsole?: boolean;
|
|
9
11
|
debug?: boolean;
|
|
12
|
+
store?: Store;
|
|
13
|
+
beforeSend?: BeforeSend;
|
|
14
|
+
sessionSampleRate?: number;
|
|
15
|
+
traceHostAllowlist?: string[];
|
|
16
|
+
buildId?: string;
|
|
10
17
|
};
|
|
11
18
|
export declare function assertApiKey(apiKey?: string): void;
|
|
12
19
|
/**
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { TelemetryWeb } from './index.web';
|
|
2
|
+
import { SyncStore } from './core/store';
|
|
3
|
+
import { BeforeSend } from './core/beforeSend';
|
|
2
4
|
export type TelemetryOpts = {
|
|
3
5
|
apiKey: string;
|
|
4
6
|
sender?: any;
|
|
@@ -7,6 +9,11 @@ export type TelemetryOpts = {
|
|
|
7
9
|
endpoint?: string;
|
|
8
10
|
captureConsole?: boolean;
|
|
9
11
|
debug?: boolean;
|
|
12
|
+
store?: SyncStore;
|
|
13
|
+
beforeSend?: BeforeSend;
|
|
14
|
+
sessionSampleRate?: number;
|
|
15
|
+
traceHostAllowlist?: string[];
|
|
16
|
+
buildId?: string;
|
|
10
17
|
};
|
|
11
18
|
export declare function assertApiKey(apiKey?: string): void;
|
|
12
19
|
/**
|
package/dist/src/index.base.d.ts
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
type ProfileInput = {
|
|
2
2
|
userId?: string;
|
|
3
|
+
/** @deprecated Removed in v5 — use `identify({ name })`. */
|
|
3
4
|
fullName?: string;
|
|
5
|
+
/** @deprecated Removed in v5 — never reaches the wire (§3.4). */
|
|
4
6
|
firstName?: string;
|
|
7
|
+
/** @deprecated Removed in v5 — never reaches the wire (§3.4). */
|
|
5
8
|
lastName?: string;
|
|
6
9
|
email?: string;
|
|
7
10
|
phone?: string;
|
|
11
|
+
/** @deprecated Removed in v5 — never reaches the wire (§3.4). */
|
|
8
12
|
avatar?: string;
|
|
9
13
|
customAttributes?: Record<string, any>;
|
|
10
14
|
};
|
|
@@ -13,11 +17,22 @@ export declare abstract class TelemetryBase {
|
|
|
13
17
|
log(event: string, data?: Record<string, any>): Promise<any>;
|
|
14
18
|
flush(): Promise<any>;
|
|
15
19
|
shutdown(): Promise<any>;
|
|
20
|
+
/**
|
|
21
|
+
* React Navigation → rung 2 of the name ladder, on **both** builds (§4.5.1, #96).
|
|
22
|
+
* `getCurrentRoute()` is a navigation-tree API that works identically on RN-Web, so a
|
|
23
|
+
* consumer wires navigation once and gets the same `view.name` on web and native.
|
|
24
|
+
*/
|
|
25
|
+
attachNavigation(navigationRef: any): Promise<void>;
|
|
26
|
+
/**
|
|
27
|
+
* §4.7 — report a handled error as `app.error`. Accepts `unknown`, so a `catch` block
|
|
28
|
+
* that received a string or an axios rejection object needs no narrowing first.
|
|
29
|
+
* There is no public path to `app.crash`, by design (#100).
|
|
30
|
+
*/
|
|
31
|
+
captureError(error: unknown, context?: Record<string, any>): Promise<any>;
|
|
16
32
|
trackErrors(options?: {
|
|
17
33
|
captureConsole?: boolean;
|
|
18
34
|
}): Promise<any>;
|
|
19
35
|
setUserId(id: string): Promise<void>;
|
|
20
|
-
generateUserId(): Promise<any>;
|
|
21
36
|
setUserProfile(profile: ProfileInput): Promise<void>;
|
|
22
37
|
setUserDetails(details: ProfileInput): Promise<void>;
|
|
23
38
|
updateUserProfile(updates: ProfileInput): Promise<void>;
|
|
@@ -26,6 +41,7 @@ export declare abstract class TelemetryBase {
|
|
|
26
41
|
setUserName(fullName: string, firstName?: string, lastName?: string): Promise<void>;
|
|
27
42
|
setUserContact(email?: string, phone?: string): Promise<void>;
|
|
28
43
|
identify(profile: {
|
|
44
|
+
userId?: string;
|
|
29
45
|
name?: string;
|
|
30
46
|
email?: string;
|
|
31
47
|
phone?: string;
|
|
@@ -1,6 +1,19 @@
|
|
|
1
1
|
import { TelemetryBase } from './index.base';
|
|
2
|
+
import { Store } from './core/store';
|
|
3
|
+
import { BeforeSend } from './core/beforeSend';
|
|
2
4
|
export { createTelemetry, type TelemetryOpts } from './createTelemetry.native';
|
|
5
|
+
export type { Store, SyncStore, AsyncStore, StoreRead, StoreWrite } from './core/store';
|
|
6
|
+
export { memoryStore, type MemoryStoreOpts } from './core/memoryStore';
|
|
7
|
+
export type { BeforeSend } from './core/beforeSend';
|
|
3
8
|
export declare class TelemetryNative extends TelemetryBase {
|
|
9
|
+
/** ≥3 named taps in a 1000 ms window, keyed on the name — see `trackTap`. */
|
|
10
|
+
private readonly tapRage;
|
|
11
|
+
/**
|
|
12
|
+
* The resolved core, once `instancePromise` settles. `trackTap` is the one public method that
|
|
13
|
+
* cannot afford an `await` before it reads the world: the host's own press handler
|
|
14
|
+
* navigates on the very next line (§4.6's mint/emit split).
|
|
15
|
+
*/
|
|
16
|
+
private resolved?;
|
|
4
17
|
constructor(opts?: {
|
|
5
18
|
apiKey?: string;
|
|
6
19
|
sender?: any;
|
|
@@ -9,20 +22,44 @@ export declare class TelemetryNative extends TelemetryBase {
|
|
|
9
22
|
endpoint?: string;
|
|
10
23
|
captureConsole?: boolean;
|
|
11
24
|
debug?: boolean;
|
|
25
|
+
store?: Store;
|
|
26
|
+
beforeSend?: BeforeSend;
|
|
27
|
+
sessionSampleRate?: number;
|
|
28
|
+
traceHostAllowlist?: string[];
|
|
29
|
+
buildId?: string;
|
|
12
30
|
});
|
|
13
|
-
private startSessionOnInit;
|
|
14
|
-
private attachAppState;
|
|
15
31
|
attachAppLifecycle(): Promise<void>;
|
|
16
32
|
getDeviceInfo(): Promise<any>;
|
|
17
33
|
getNetworkInfo(): Promise<any>;
|
|
18
34
|
trackFrameDrops(): Promise<any>;
|
|
19
35
|
trackNetworkRequests(): Promise<any>;
|
|
20
36
|
trackMemoryUsage(): Promise<any>;
|
|
21
|
-
screenStart(name: string): Promise<
|
|
22
|
-
screenEnd(name: string): Promise<
|
|
23
|
-
trackRoute(from: string, to: string): Promise<
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
37
|
+
screenStart(name: string): Promise<any>;
|
|
38
|
+
screenEnd(name: string): Promise<any>;
|
|
39
|
+
trackRoute(from: string, to: string): Promise<any>;
|
|
40
|
+
/**
|
|
41
|
+
* §4.6's native producer, explicit-only (#103). `interactionProps()` is gone with
|
|
42
|
+
* `user.interaction` (#102): it sat on the consumer's **root** `<View>`, where
|
|
43
|
+
* `PressEvent.nativeEvent.target` is a node tag number with no public API resolving it,
|
|
44
|
+
* so it could not tell a tap on a button from a tap on padding and every row it emitted
|
|
45
|
+
* was un-nameable. There is no role model to gate on and no DOM to derive from, so
|
|
46
|
+
* anything auto-derived here would be either wrong or a PII leak.
|
|
47
|
+
*
|
|
48
|
+
* `name` is web's rung 1 — explicit author intent — so it ships **unnormalized and
|
|
49
|
+
* uncapped**, and `ui.name_source` has exactly **two** values: `edge_action`, or `none`
|
|
50
|
+
* for a blank name, whose `ui.target` is `unnamed`. **`surface` never appears**: it only
|
|
51
|
+
* means something where role-less elements exist.
|
|
52
|
+
*
|
|
53
|
+
* ⚠ **The mint/emit split.** The row's `timestamp`, `view.id`, `view.name` and
|
|
54
|
+
* `session.id` are snapshotted **here, synchronously**, because the host's press handler
|
|
55
|
+
* navigates on the next line and the emit rides a promise. Stamping emit time would
|
|
56
|
+
* attribute a navigating tap to **the view it opened**, inverting every "which screen
|
|
57
|
+
* frustrates users" query. Before `instancePromise` settles there is no core to snapshot
|
|
58
|
+
* from, so a tap that early falls back to emit-time identity — the launch view either
|
|
59
|
+
* way.
|
|
60
|
+
*
|
|
61
|
+
* ⚠ **`ui.dead` is absent on every native row**, never `false`: with no DOM there is no
|
|
62
|
+
* mutation signal, so any dead-click *rate* must filter to the web build.
|
|
63
|
+
*/
|
|
64
|
+
trackTap(name: string): Promise<any>;
|
|
28
65
|
}
|