@nathanclaire/edge-telemetry-sdk 3.0.0 → 5.0.1
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/LICENSE +21 -0
- package/README.md +985 -185
- package/dist/appLifecycle-DS_fEclk.cjs +2 -0
- package/dist/appLifecycle-DS_fEclk.cjs.map +1 -0
- package/dist/appLifecycle-PffQ4vC1.js +24 -0
- package/dist/appLifecycle-PffQ4vC1.js.map +1 -0
- package/dist/autoTaps.native-By9I4Kr2.cjs +2 -0
- package/dist/autoTaps.native-By9I4Kr2.cjs.map +1 -0
- package/dist/autoTaps.native-DQCXevD7.js +66 -0
- package/dist/autoTaps.native-DQCXevD7.js.map +1 -0
- package/dist/crashHandler.web-6KvedEB-.cjs +2 -0
- package/dist/crashHandler.web-6KvedEB-.cjs.map +1 -0
- package/dist/crashHandler.web-BUlSXYoS.js +30 -0
- package/dist/crashHandler.web-BUlSXYoS.js.map +1 -0
- package/dist/crashHandlerNative.native-CFVQ5UcO.cjs +2 -0
- package/dist/crashHandlerNative.native-CFVQ5UcO.cjs.map +1 -0
- package/dist/crashHandlerNative.native-DsCRd-oN.js +39 -0
- package/dist/crashHandlerNative.native-DsCRd-oN.js.map +1 -0
- package/dist/deviceInfo.native-D5gNBG7m.cjs +2 -0
- package/dist/deviceInfo.native-D5gNBG7m.cjs.map +1 -0
- package/dist/deviceInfo.native-DiiHrnI3.js +53 -0
- package/dist/deviceInfo.native-DiiHrnI3.js.map +1 -0
- package/dist/deviceInfo.web-BHsjVveq.js +41 -0
- package/dist/deviceInfo.web-BHsjVveq.js.map +1 -0
- package/dist/deviceInfo.web-DGCUHAnv.cjs +2 -0
- package/dist/deviceInfo.web-DGCUHAnv.cjs.map +1 -0
- package/dist/deviceState.native-BEysbZ6O.js +58 -0
- package/dist/deviceState.native-BEysbZ6O.js.map +1 -0
- package/dist/deviceState.native-CrQMy11_.cjs +2 -0
- package/dist/deviceState.native-CrQMy11_.cjs.map +1 -0
- package/dist/deviceState.web-ByaQm9Ry.js +14 -0
- package/dist/deviceState.web-ByaQm9Ry.js.map +1 -0
- package/dist/deviceState.web-CSfUgHDU.cjs +2 -0
- package/dist/deviceState.web-CSfUgHDU.cjs.map +1 -0
- package/dist/frameTracker-9j0en6Zm.cjs +2 -0
- package/dist/frameTracker-9j0en6Zm.cjs.map +1 -0
- package/dist/frameTracker-BzXnxSkb.js +53 -0
- package/dist/frameTracker-BzXnxSkb.js.map +1 -0
- package/dist/httpAttributes-BWXOr4eP.js +70 -0
- package/dist/httpAttributes-BWXOr4eP.js.map +1 -0
- package/dist/httpAttributes-COY0_kiF.cjs +2 -0
- package/dist/httpAttributes-COY0_kiF.cjs.map +1 -0
- package/dist/index.native.cjs +1 -1
- package/dist/index.native.cjs.map +1 -1
- package/dist/index.native.d.ts +1 -1
- package/dist/index.native.js +173 -81
- 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.d.ts +1 -1
- package/dist/index.web.js +107 -39
- package/dist/index.web.js.map +1 -1
- package/dist/interactionWeb.web-BWBjmovb.js +109 -0
- package/dist/interactionWeb.web-BWBjmovb.js.map +1 -0
- package/dist/interactionWeb.web-CKDJLD9r.cjs +2 -0
- package/dist/interactionWeb.web-CKDJLD9r.cjs.map +1 -0
- package/dist/interceptFetchWeb.web-DjSR_Rft.js +62 -0
- package/dist/interceptFetchWeb.web-DjSR_Rft.js.map +1 -0
- package/dist/interceptFetchWeb.web-ZHw6IQkU.cjs +2 -0
- package/dist/interceptFetchWeb.web-ZHw6IQkU.cjs.map +1 -0
- package/dist/interceptHttpNative.native-C5scIcgY.cjs +2 -0
- package/dist/interceptHttpNative.native-C5scIcgY.cjs.map +1 -0
- package/dist/interceptHttpNative.native-vF_Fksjk.js +18 -0
- package/dist/interceptHttpNative.native-vF_Fksjk.js.map +1 -0
- package/dist/loadingTime-Cj5Oh8lT.cjs +2 -0
- package/dist/loadingTime-Cj5Oh8lT.cjs.map +1 -0
- package/dist/loadingTime-DMc0zTY8.js +70 -0
- package/dist/loadingTime-DMc0zTY8.js.map +1 -0
- package/dist/memoryNative.native-CK3QFVjY.cjs +2 -0
- package/dist/memoryNative.native-CK3QFVjY.cjs.map +1 -0
- package/dist/memoryNative.native-DkA6f7id.js +54 -0
- package/dist/memoryNative.native-DkA6f7id.js.map +1 -0
- package/dist/nativeSender-Dt1HLaLi.js +37 -0
- package/dist/nativeSender-Dt1HLaLi.js.map +1 -0
- package/dist/nativeSender-hCgUa7Vz.cjs +2 -0
- package/dist/nativeSender-hCgUa7Vz.cjs.map +1 -0
- package/dist/navigationRef-CVIv0aIK.js +30 -0
- package/dist/navigationRef-CVIv0aIK.js.map +1 -0
- package/dist/navigationRef-CfIbeXX8.cjs +2 -0
- package/dist/navigationRef-CfIbeXX8.cjs.map +1 -0
- package/dist/navigationWeb.web-CRHpr5zl.js +51 -0
- package/dist/navigationWeb.web-CRHpr5zl.js.map +1 -0
- package/dist/navigationWeb.web-DwWjL80b.cjs +2 -0
- package/dist/navigationWeb.web-DwWjL80b.cjs.map +1 -0
- package/dist/{networkChange-CUO1hRLj.cjs → networkChange-2FGIQM-N.cjs} +2 -2
- package/dist/networkChange-2FGIQM-N.cjs.map +1 -0
- package/dist/{networkChange-D39hdSb0.js → networkChange-QA0893vW.js} +2 -2
- package/dist/networkChange-QA0893vW.js.map +1 -0
- package/dist/networkInfo.native-CcJ3JVRF.js +31 -0
- package/dist/networkInfo.native-CcJ3JVRF.js.map +1 -0
- package/dist/networkInfo.native-whB2wf6a.cjs +2 -0
- package/dist/networkInfo.native-whB2wf6a.cjs.map +1 -0
- package/dist/{networkInfo.web-twcNn_hc.js → networkInfo.web-CcUpXMUK.js} +4 -4
- package/dist/networkInfo.web-CcUpXMUK.js.map +1 -0
- package/dist/networkInfo.web-DfO-BUFx.cjs +2 -0
- package/dist/networkInfo.web-DfO-BUFx.cjs.map +1 -0
- package/dist/react-bqe7KPOf.cjs +4 -0
- package/dist/react-bqe7KPOf.cjs.map +1 -0
- package/dist/react-urNtDGTL.js +413 -0
- package/dist/react-urNtDGTL.js.map +1 -0
- package/dist/runtimeReady.native-CxFl1rQR.js +35 -0
- package/dist/runtimeReady.native-CxFl1rQR.js.map +1 -0
- package/dist/runtimeReady.native-zueSbsEv.cjs +2 -0
- package/dist/runtimeReady.native-zueSbsEv.cjs.map +1 -0
- package/dist/runtimeReady.web-JuE239Tg.js +25 -0
- package/dist/runtimeReady.web-JuE239Tg.js.map +1 -0
- package/dist/runtimeReady.web-vhAJFU61.cjs +2 -0
- package/dist/runtimeReady.web-vhAJFU61.cjs.map +1 -0
- package/dist/seedRuntimeReady-BlRdf3pR.js +10 -0
- package/dist/seedRuntimeReady-BlRdf3pR.js.map +1 -0
- package/dist/seedRuntimeReady-CbjqbWCd.cjs +2 -0
- package/dist/seedRuntimeReady-CbjqbWCd.cjs.map +1 -0
- package/dist/src/adapters/appLifecycle.d.ts +11 -4
- package/dist/src/adapters/batch.d.ts +46 -0
- package/dist/src/adapters/crashCapture.d.ts +42 -9
- package/dist/src/adapters/deviceState.d.ts +9 -0
- package/dist/src/adapters/failedEvents.d.ts +43 -0
- package/dist/src/adapters/frameAggregate.d.ts +19 -12
- package/dist/src/adapters/frameTracker.d.ts +30 -0
- package/dist/src/adapters/hangDetector.d.ts +41 -0
- package/dist/src/adapters/httpAttributes.d.ts +18 -0
- package/dist/src/adapters/loadingTime.d.ts +67 -0
- package/dist/src/adapters/manualSpans.d.ts +41 -0
- package/dist/src/adapters/native/autoTaps.native.d.ts +15 -0
- package/dist/src/adapters/native/deviceState.native.d.ts +15 -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/networkInfo.native.d.ts +1 -1
- package/dist/src/adapters/native/runtimeReady.native.d.ts +17 -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 +29 -0
- package/dist/src/adapters/networkChange.d.ts +2 -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 +144 -0
- package/dist/src/adapters/uiInteraction.d.ts +111 -0
- package/dist/src/adapters/viewManager.d.ts +177 -0
- package/dist/src/adapters/viewport.d.ts +15 -0
- package/dist/src/adapters/web/deviceState.web.d.ts +10 -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 +13 -7
- 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 +56 -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 +55 -0
- package/dist/src/core/beforeSend.d.ts +20 -0
- package/dist/src/core/breadcrumbs.d.ts +10 -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 +422 -42
- package/dist/src/core/userProfile.d.ts +19 -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 +10 -1
- package/dist/src/createTelemetry.web.d.ts +9 -1
- package/dist/src/golden.helper.d.ts +4 -0
- package/dist/src/index.base.d.ts +93 -3
- package/dist/src/index.native.d.ts +7 -27
- package/dist/src/index.web.d.ts +7 -23
- package/dist/src/react.d.ts +45 -0
- package/dist/src/telemetryNative.native.d.ts +79 -0
- package/dist/src/telemetryWeb.web.d.ts +59 -0
- package/dist/store.native-BbS76uWV.cjs +2 -0
- package/dist/store.native-BbS76uWV.cjs.map +1 -0
- package/dist/store.native-MlWyGgBp.js +32 -0
- package/dist/store.native-MlWyGgBp.js.map +1 -0
- package/dist/store.web-BzKaP57Z.cjs +2 -0
- package/dist/store.web-BzKaP57Z.cjs.map +1 -0
- package/dist/store.web-rhh0NOfs.js +31 -0
- package/dist/store.web-rhh0NOfs.js.map +1 -0
- package/dist/telemetry-60sfWkh0.js +1754 -0
- package/dist/telemetry-60sfWkh0.js.map +1 -0
- package/dist/telemetry-CW63glwb.cjs +2 -0
- package/dist/telemetry-CW63glwb.cjs.map +1 -0
- package/dist/uiInteraction-BIDOMcrL.js +109 -0
- package/dist/uiInteraction-BIDOMcrL.js.map +1 -0
- package/dist/uiInteraction-DxlwCVSn.cjs +2 -0
- package/dist/uiInteraction-DxlwCVSn.cjs.map +1 -0
- package/dist/viewport-9JcVIXYF.cjs +2 -0
- package/dist/viewport-9JcVIXYF.cjs.map +1 -0
- package/dist/viewport-GWTEBt2K.js +15 -0
- package/dist/viewport-GWTEBt2K.js.map +1 -0
- package/dist/web-vitals.attribution-DAvBvdng.cjs +2 -0
- package/dist/web-vitals.attribution-DAvBvdng.cjs.map +1 -0
- package/dist/web-vitals.attribution-DcoMtvlY.js +488 -0
- package/dist/web-vitals.attribution-DcoMtvlY.js.map +1 -0
- package/dist/webSender-DA087xb5.cjs +2 -0
- package/dist/webSender-DA087xb5.cjs.map +1 -0
- package/dist/webSender-g4rs5TIg.js +44 -0
- package/dist/webSender-g4rs5TIg.js.map +1 -0
- package/dist/webVitals.web-DRTDK6s5.js +100 -0
- package/dist/webVitals.web-DRTDK6s5.js.map +1 -0
- package/dist/webVitals.web-DvScDIjX.cjs +2 -0
- package/dist/webVitals.web-DvScDIjX.cjs.map +1 -0
- package/dist/xhrIntercept-9uAkQh3N.js +55 -0
- package/dist/xhrIntercept-9uAkQh3N.js.map +1 -0
- package/dist/xhrIntercept-xG1Yl5RI.cjs +2 -0
- package/dist/xhrIntercept-xG1Yl5RI.cjs.map +1 -0
- package/docs/migration-v4.md +190 -0
- package/docs/migration-v5.md +178 -0
- package/package.json +22 -6
- 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 +0 -1171
- 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 +0 -19
- 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/networkChange-CUO1hRLj.cjs.map +0 -1
- package/dist/networkChange-D39hdSb0.js.map +0 -1
- package/dist/networkInfo.native-BK5fpAOL.js +0 -343
- package/dist/networkInfo.native-BK5fpAOL.js.map +0 -1
- package/dist/networkInfo.native-cxuw93Uy.cjs +0 -2
- package/dist/networkInfo.native-cxuw93Uy.cjs.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/navigationTracker.d.ts +0 -6
- package/dist/src/adapters/screenTiming.d.ts +0 -9
- 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,48 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ViewManager, ViewNameSource } from '../adapters/viewManager';
|
|
2
|
+
import { TraceManager } from '../adapters/traceManager';
|
|
3
|
+
import { HangDetector } from '../adapters/hangDetector';
|
|
4
|
+
import { OpenSpan, TaskOutcome } from '../adapters/manualSpans';
|
|
5
|
+
import { ErrorSource } from '../adapters/crashCapture';
|
|
6
|
+
import { Store } from './store';
|
|
7
|
+
import { BeforeSend } from './beforeSend';
|
|
8
|
+
import { Orientation } from '../adapters/viewport';
|
|
9
|
+
export type { BeforeSend } from './beforeSend';
|
|
10
|
+
export type { Orientation };
|
|
11
|
+
/** `sdk.drop_reason` (§11). `rejected` is a 4xx-dropped batch (§2.5, #162). */
|
|
12
|
+
export type DropReason = "queue_full" | "store_full" | "rejected";
|
|
13
|
+
/**
|
|
14
|
+
* §4.7's two error names. Both book `sdk.error_count` and `view.error_count` — a closed
|
|
15
|
+
* enumeration, not resource failures and not `console.warn`. Only `app.crash` gets the
|
|
16
|
+
* dedicated crash path and the eviction reprieve, which is the whole point of the split:
|
|
17
|
+
* `COUNT(event_name='app.crash')` must stay a crash count nobody can forget to filter.
|
|
18
|
+
*/
|
|
19
|
+
export declare const isErrorName: (name?: string) => boolean;
|
|
20
|
+
export declare function evictIndex(events: TelemetryEvent[]): number;
|
|
21
|
+
/** Store key for the self-minted, persisted `device.id` (#91). */
|
|
22
|
+
export declare const DEVICE_ID_KEY = "telemetry_device_id";
|
|
23
|
+
/** Store key for the resumable session record (#92). */
|
|
24
|
+
export declare const SESSION_KEY = "telemetry_session";
|
|
25
|
+
/** Why a session started/ended. `launch` is internal only — it ships as no `session.reason` (catalogue #179). */
|
|
26
|
+
export type SessionReason = "launch" | "timeout" | "max_duration" | "manual";
|
|
27
|
+
export type SessionEndReason = Exclude<SessionReason, "launch">;
|
|
28
|
+
/**
|
|
29
|
+
* §4.6's mint/emit split, for the one event that has one. A `ui.interaction` is emitted
|
|
30
|
+
* after its dead-click window, so its wire `timestamp` and its `view.id` / `view.name` /
|
|
31
|
+
* `session.id` are snapshotted at the click and replayed here — otherwise a tap that
|
|
32
|
+
* navigates is booked against the view it opened.
|
|
33
|
+
*/
|
|
34
|
+
export type LogSnapshot = {
|
|
35
|
+
/**
|
|
36
|
+
* Epoch ms of the click. Becomes the row's `timestamp`. **Omitted by a span-carrying row
|
|
37
|
+
* that is not deferred** — an `http.request` freezes its *attribution* at send but still
|
|
38
|
+
* reports the completion time §4.4 gives it.
|
|
39
|
+
*/
|
|
40
|
+
at?: number;
|
|
41
|
+
viewId: string;
|
|
42
|
+
sessionId: string;
|
|
43
|
+
/** Epoch ms — `session.start_time` freezes with the id it belongs to (§3.1). */
|
|
44
|
+
sessionStart: number;
|
|
45
|
+
};
|
|
2
46
|
export type TelemetryEvent = {
|
|
3
47
|
type: 'event' | 'metric';
|
|
4
48
|
eventName?: string;
|
|
@@ -9,7 +53,13 @@ export type TelemetryEvent = {
|
|
|
9
53
|
};
|
|
10
54
|
export interface Sender {
|
|
11
55
|
send(events: TelemetryEvent[]): Promise<void>;
|
|
12
|
-
|
|
56
|
+
/**
|
|
57
|
+
* Persist a batch that could not be sent. Returns how many rows the offline store's
|
|
58
|
+
* cap cost, so core can book them as `sdk.drop_reason = "store_full"` (§9.4) — the
|
|
59
|
+
* counter lives on the Context block, which only core assembles. `void` is still a
|
|
60
|
+
* valid return: a consumer's own sender is not obliged to have a cap.
|
|
61
|
+
*/
|
|
62
|
+
onFailure?(events: TelemetryEvent[]): Promise<number | void>;
|
|
13
63
|
replayFailed?(): Promise<void>;
|
|
14
64
|
}
|
|
15
65
|
export interface CrashHandlerOptions {
|
|
@@ -20,13 +70,7 @@ export interface CrashHandler {
|
|
|
20
70
|
}
|
|
21
71
|
export interface NetworkInfo {
|
|
22
72
|
type?: string;
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
export interface WebExtraNetworkInfo {
|
|
26
|
-
type?: string;
|
|
27
|
-
isConnected?: boolean;
|
|
28
|
-
downlink?: number;
|
|
29
|
-
effectiveType?: string;
|
|
73
|
+
is_connected?: boolean;
|
|
30
74
|
}
|
|
31
75
|
export interface NetworkInfoHandler {
|
|
32
76
|
start(telemetry: Telemetry): Promise<NetworkInfo>;
|
|
@@ -43,7 +87,21 @@ export interface NetworkHandler {
|
|
|
43
87
|
start(): Promise<void>;
|
|
44
88
|
}
|
|
45
89
|
export interface MemoryHandler {
|
|
46
|
-
|
|
90
|
+
start(): Promise<void>;
|
|
91
|
+
/** Torn down by `shutdown()`: unlike the rAF-driven trackers this one owns a timer. */
|
|
92
|
+
stop?(): void;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* #173's device state. `battery()` is synchronous on purpose — a cached last read — so no
|
|
96
|
+
* failure row ever awaits a native call. Native implements all of it; web only `accessibility`.
|
|
97
|
+
*/
|
|
98
|
+
export interface DeviceStateHandler {
|
|
99
|
+
battery?(): Record<string, number | boolean>;
|
|
100
|
+
refresh?(): Promise<void>;
|
|
101
|
+
start?(): void;
|
|
102
|
+
stop?(): void;
|
|
103
|
+
/** Read once per session, onto `session.started`. A failed read omits only its own key. */
|
|
104
|
+
accessibility(): Promise<Record<string, number | boolean>>;
|
|
47
105
|
}
|
|
48
106
|
export interface NavigationHandler {
|
|
49
107
|
start(): Promise<void>;
|
|
@@ -52,35 +110,44 @@ export interface DeviceInfo {
|
|
|
52
110
|
app: {
|
|
53
111
|
name: string;
|
|
54
112
|
version: string;
|
|
55
|
-
|
|
56
|
-
|
|
113
|
+
build_number?: string;
|
|
114
|
+
package_name?: string;
|
|
57
115
|
};
|
|
58
116
|
device: {
|
|
59
|
-
id: string;
|
|
60
117
|
platform: string;
|
|
61
|
-
|
|
118
|
+
platform_version?: string;
|
|
62
119
|
model?: string;
|
|
63
120
|
manufacturer?: string;
|
|
64
121
|
brand?: string;
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
fingerprint?: string;
|
|
122
|
+
android_sdk?: number;
|
|
123
|
+
android_release?: string;
|
|
68
124
|
hardware?: string;
|
|
69
125
|
product?: string;
|
|
70
|
-
|
|
71
|
-
|
|
126
|
+
system_name?: string;
|
|
127
|
+
cpu_abi?: string;
|
|
128
|
+
low_ram?: boolean;
|
|
129
|
+
screen_density?: number;
|
|
130
|
+
screen_width_px?: number;
|
|
131
|
+
screen_height_px?: number;
|
|
132
|
+
orientation?: Orientation;
|
|
72
133
|
};
|
|
73
134
|
}
|
|
74
135
|
export interface UserProfile {
|
|
75
136
|
userId?: string;
|
|
137
|
+
/** @deprecated Removed in v6 — use `identify({ name })`. Still the source of `user.name`. */
|
|
76
138
|
fullName?: string;
|
|
139
|
+
/** @deprecated Removed in v6 — never reached the wire; `identify()` could not set it. */
|
|
77
140
|
firstName?: string;
|
|
141
|
+
/** @deprecated Removed in v6 — never reached the wire; `identify()` could not set it. */
|
|
78
142
|
lastName?: string;
|
|
79
143
|
email?: string;
|
|
80
144
|
phone?: string;
|
|
145
|
+
/** @deprecated Removed in v6 — no column and no reader; `user.avatar` is off the wire (§3.4). */
|
|
81
146
|
avatar?: string;
|
|
82
147
|
customAttributes?: Record<string, any>;
|
|
148
|
+
/** @deprecated Removed in v6 — in-memory only, so it meant "first identify() this process" (§3.4). */
|
|
83
149
|
createdAt?: number;
|
|
150
|
+
/** @deprecated Removed in v6 — byte-identical to `createdAt` for any one-identify() app (§3.4). */
|
|
84
151
|
updatedAt?: number;
|
|
85
152
|
}
|
|
86
153
|
type Opts = {
|
|
@@ -89,11 +156,19 @@ type Opts = {
|
|
|
89
156
|
flushIntervalMs?: number;
|
|
90
157
|
endpoint?: string;
|
|
91
158
|
sessionId?: string;
|
|
92
|
-
userId?: string
|
|
159
|
+
userId?: string;
|
|
93
160
|
sdkVersion?: string;
|
|
94
161
|
platform?: string;
|
|
162
|
+
traceLaunchStart?: number;
|
|
95
163
|
deviceInfoHandler?: DeviceInfoHandler;
|
|
164
|
+
deviceStateHandler?: DeviceStateHandler;
|
|
96
165
|
networkInfoHandler?: NetworkInfoHandler;
|
|
166
|
+
store?: Store;
|
|
167
|
+
beforeSend?: BeforeSend;
|
|
168
|
+
sessionSampleRate?: number;
|
|
169
|
+
traceHostAllowlist?: string[];
|
|
170
|
+
buildId?: string;
|
|
171
|
+
enabled?: boolean;
|
|
97
172
|
};
|
|
98
173
|
/**
|
|
99
174
|
* Telemetry core: queueing, batching, retries, auto-replay and session/user management.
|
|
@@ -107,16 +182,28 @@ export declare class Telemetry {
|
|
|
107
182
|
private intervalId;
|
|
108
183
|
private endpoint?;
|
|
109
184
|
private crashHandler?;
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
185
|
+
readonly views: ViewManager;
|
|
186
|
+
readonly trace: TraceManager;
|
|
187
|
+
webInteractions?: {
|
|
188
|
+
start(): void;
|
|
189
|
+
};
|
|
190
|
+
webVitals?: {
|
|
191
|
+
start(): Promise<void>;
|
|
192
|
+
stop(): void;
|
|
193
|
+
};
|
|
194
|
+
readonly hangs?: HangDetector;
|
|
195
|
+
readonly deviceState?: DeviceStateHandler;
|
|
113
196
|
private networkInfoHandler;
|
|
197
|
+
private networkStarted;
|
|
114
198
|
private deviceInfoHandler;
|
|
199
|
+
readonly store: Store;
|
|
115
200
|
private frameDropsHandler?;
|
|
116
201
|
private networkHandler?;
|
|
117
202
|
private memoryHandler?;
|
|
118
203
|
private navigationHandler?;
|
|
119
204
|
private userId?;
|
|
205
|
+
private deviceIdEphemeral;
|
|
206
|
+
private deviceIdPromise?;
|
|
120
207
|
private userProfile?;
|
|
121
208
|
private sessionId;
|
|
122
209
|
private sessionStart;
|
|
@@ -126,43 +213,238 @@ export declare class Telemetry {
|
|
|
126
213
|
private breadcrumbs;
|
|
127
214
|
private lastActivity?;
|
|
128
215
|
private sessionSequence;
|
|
216
|
+
private eventSequence;
|
|
129
217
|
private sessionEventCount;
|
|
130
218
|
private errorCount;
|
|
219
|
+
private readonly configuredSampleRate;
|
|
220
|
+
private sampleRate;
|
|
221
|
+
private sampled;
|
|
222
|
+
private readonly beforeSend?;
|
|
223
|
+
/** `app.build_id` (§4.8). Empty string is *not* a build id — it is an unset one. */
|
|
224
|
+
private readonly buildId?;
|
|
225
|
+
private hookDropped;
|
|
226
|
+
private hookFailed;
|
|
227
|
+
private eventsDropped;
|
|
228
|
+
private dropReason?;
|
|
229
|
+
private crashPersistedThrough;
|
|
230
|
+
private appStartEmitted;
|
|
231
|
+
/** `app.start.js_ready_ms` (§4.3, #171) — native only; the entry's reader, run at emit. */
|
|
232
|
+
jsReadyMs?: () => number | undefined;
|
|
233
|
+
/** `app.start.duration_ms` (#179) — the entry's reader; resolves `undefined` when unknown. */
|
|
234
|
+
appStartMs?: () => Promise<number | undefined>;
|
|
235
|
+
private readonly spans;
|
|
236
|
+
private finalizing;
|
|
237
|
+
private enabled;
|
|
238
|
+
private pendingStart;
|
|
131
239
|
constructor(opts?: Opts);
|
|
240
|
+
/**
|
|
241
|
+
* §4.7 — report a handled error. Accepts `unknown` on purpose: half of real `catch`
|
|
242
|
+
* blocks receive a string or an axios rejection object, and a consumer should not have
|
|
243
|
+
* to prove to TypeScript that it is an `Error` before reporting it.
|
|
244
|
+
*
|
|
245
|
+
* Emits `app.error`, **never** `app.crash`. There is deliberately no public path to
|
|
246
|
+
* `app.crash` — a consumer's own code must not be able to manufacture rows in the one
|
|
247
|
+
* table an unfiltered crash-free rate is read from.
|
|
248
|
+
*
|
|
249
|
+
* `source` is SDK-internal (`captureConsole` passes `"console"`); the public wrappers
|
|
250
|
+
* forward two arguments, so a consumer can only ever produce `"reported"`. Routing the
|
|
251
|
+
* console path through here rather than through `log()` directly is what keeps the
|
|
252
|
+
* `error.fatal` rule in one place.
|
|
253
|
+
*/
|
|
254
|
+
captureError(error: unknown, context?: Record<string, any>, source?: ErrorSource): Promise<void>;
|
|
255
|
+
/**
|
|
256
|
+
* Extend the breadcrumb trail without emitting anything. §4.7 demotes `console.warn` to
|
|
257
|
+
* exactly this — React's dev-mode warnings were the bulk of v3's `app.crash` volume.
|
|
258
|
+
*
|
|
259
|
+
* Also the public `addBreadcrumb()` (#167) — one path, so the SDK's own crumbs and the
|
|
260
|
+
* host's obey the same bounds (`boundCrumb`). Shows on `app.crash` and `app.hang`.
|
|
261
|
+
*/
|
|
262
|
+
addBreadcrumb(name: string, data?: Record<string, any>): void;
|
|
263
|
+
/**
|
|
264
|
+
* `startNewSession()` (#167) — logout/login. The same finalize + started pair as an idle
|
|
265
|
+
* or max-duration rotation, with `session.reason: manual` on both.
|
|
266
|
+
*/
|
|
267
|
+
startNewSession(): Promise<void>;
|
|
132
268
|
trackErrors(crashHandler: CrashHandler, options?: CrashHandlerOptions): void;
|
|
133
269
|
getDeviceInfo(deviceInfoHandler: DeviceInfoHandler): void;
|
|
270
|
+
/** Starts the network tracker once; later calls are no-ops, so listeners never stack. */
|
|
134
271
|
getNetworkInfo(networkInfoHandler: NetworkInfoHandler): void;
|
|
135
272
|
trackFrameDrops(frameDropsHandler: FrameDropsHandler): void;
|
|
136
273
|
trackNetworkRequests(networkHandler: NetworkHandler): void;
|
|
274
|
+
/** The offline replay and the flush timer — at construction, and again at each `enable()`. */
|
|
275
|
+
private startDelivery;
|
|
276
|
+
isEnabled(): boolean;
|
|
277
|
+
/**
|
|
278
|
+
* The consent kill-switch (#172). Synchronous: the flag is off before this returns. The
|
|
279
|
+
* in-memory queue, the offline store and the session record are dropped — an opt-out
|
|
280
|
+
* means nothing is sent **and nothing is kept**, open spans included — and every timer
|
|
281
|
+
* stops; the rAF loop keeps running but `logMetric` discards its samples. While off the
|
|
282
|
+
* network patches pass through untouched. `device.id` is kept: it is not telemetry, and
|
|
283
|
+
* minting a new one at re-consent would read as a new install.
|
|
284
|
+
*/
|
|
285
|
+
disable(): void;
|
|
286
|
+
/**
|
|
287
|
+
* Resume collection (#172) and run the lazy session-expiry check — a session can expire
|
|
288
|
+
* while disabled. A dark-started process announces its session here (`session.started`,
|
|
289
|
+
* unless a live record resumes) and never emits `app.start`.
|
|
290
|
+
*/
|
|
291
|
+
enable(): Promise<void>;
|
|
137
292
|
trackMemoryUsage(memoryHandler: MemoryHandler): void;
|
|
138
293
|
autoTrackNavigation(navigationHandler?: NavigationHandler): void;
|
|
294
|
+
/**
|
|
295
|
+
* The per-session sample roll (§3.6). Never per-event: per-event sampling punches
|
|
296
|
+
* holes that desynchronise the per-view counters by a random factor per view.
|
|
297
|
+
*
|
|
298
|
+
* `Math.random()` is deliberate here where `randomHex` refuses it — this decides one
|
|
299
|
+
* boolean that dies with the session, not an id that persists forever, and a biased
|
|
300
|
+
* PRNG costs a fraction of a percent of sample accuracy rather than a permanent
|
|
301
|
+
* identity collision.
|
|
302
|
+
*/
|
|
303
|
+
private rollSample;
|
|
304
|
+
/** §3.3 / §4.7's platform split, from the entry's declared `platform` opt — never a global. */
|
|
305
|
+
private isNativePlatform;
|
|
139
306
|
private generateSessionId;
|
|
140
307
|
setSessionId(id: string): void;
|
|
141
308
|
getSessionId(): string;
|
|
309
|
+
/**
|
|
310
|
+
* Freeze the identity a deferred row must report (§4.6). Read **synchronously at the
|
|
311
|
+
* moment the thing happened**, so a `log()` that lands after a route change or a session
|
|
312
|
+
* rotation still books the click where it occurred.
|
|
313
|
+
*/
|
|
314
|
+
snapshot(at?: number): LogSnapshot;
|
|
142
315
|
/** Collector endpoint, so fetch/XHR adapters can skip self-capturing the SDK's own POST. */
|
|
143
316
|
getEndpoint(): string | undefined;
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
317
|
+
/**
|
|
318
|
+
* Sampling stays **session-level** (§6.5): an unsampled session injects no header at
|
|
319
|
+
* all — not a `flags=00` id. Read by the interceptors, which sit outside `log()`'s own
|
|
320
|
+
* sampled-out early return and so need the decision directly.
|
|
321
|
+
*/
|
|
322
|
+
isSampled(): boolean;
|
|
323
|
+
/**
|
|
324
|
+
* The entry's one call at init (§4.2): resume the durable session when the gap is
|
|
325
|
+
* inside the idle window, otherwise close the stale one out and start fresh.
|
|
326
|
+
*
|
|
327
|
+
* Process death, tab close, hard reload and bfcache restore all land here, and all
|
|
328
|
+
* four **resume** — which is why a resumed session must not re-emit `session.started`
|
|
329
|
+
* (§4.1), or `COUNT(session.started)` stops equalling session count.
|
|
330
|
+
*/
|
|
331
|
+
resumeOrStartSession(): Promise<void>;
|
|
332
|
+
private hydrateAndAnnounce;
|
|
333
|
+
/**
|
|
334
|
+
* `app.start` (§4.3/§6.2): once per process, a **root** of `trace.root_type = launch`,
|
|
335
|
+
* carrying the launch root minted in the constructor. Idempotent because the web build
|
|
336
|
+
* re-runs `resumeOrStartSession()` on a bfcache restore, which is a resumed process and
|
|
337
|
+
* not a new one.
|
|
338
|
+
*/
|
|
339
|
+
private emitAppStart;
|
|
340
|
+
/**
|
|
341
|
+
* Read the durable record and adopt it. Adoption happens even when the session has
|
|
342
|
+
* expired: `session.finalized` has to ship under the *old* `session.id` and
|
|
343
|
+
* `session.start_time` before the fresh one takes over.
|
|
344
|
+
*/
|
|
345
|
+
private hydrateSession;
|
|
346
|
+
/**
|
|
347
|
+
* Another tab wrote the shared session record (#161, web's `storage` event). Two tabs keep
|
|
348
|
+
* their own in-memory `lastActivity`, so without this one can idle-expire a session the
|
|
349
|
+
* other is still using, or both can finalize the same `session.id`.
|
|
350
|
+
*
|
|
351
|
+
* Same id: fold in the other tab's progress — activity and the ordinals only ever move
|
|
352
|
+
* forward, so `max` is the merge. A different id is the other tab's rotation: this tab's
|
|
353
|
+
* live view is emitted under the session it belongs to, then the successor session is
|
|
354
|
+
* adopted **silently** — its `session.started` already shipped from the tab that rotated,
|
|
355
|
+
* and the retired one's `session.finalized` too, which is the whole point.
|
|
356
|
+
*
|
|
357
|
+
* Shared core, no platform branch: the entry decides what feeds it.
|
|
358
|
+
*/
|
|
359
|
+
adoptSessionRecord(raw: string | null | undefined): Promise<void>;
|
|
360
|
+
/**
|
|
361
|
+
* Which boundary, if any, the current session has crossed. Idle is checked first:
|
|
362
|
+
* when a long session has also gone quiet, the reason it ended is that the user left.
|
|
363
|
+
*
|
|
364
|
+
* Inert until `lastActivity` is set, so a bare `new Telemetry()` that never started a
|
|
365
|
+
* session never rotates one.
|
|
366
|
+
*/
|
|
367
|
+
private expiryReason;
|
|
368
|
+
/**
|
|
369
|
+
* Write the session through the `Store` so the next process can resume it.
|
|
370
|
+
*
|
|
371
|
+
* ponytail: one write per event. Web's is a synchronous `localStorage` write; native's
|
|
372
|
+
* is an AsyncStorage round-trip — debounce here if it ever shows up in a trace.
|
|
373
|
+
*/
|
|
374
|
+
private persistSession;
|
|
375
|
+
/** Emit session.started for the current session. */
|
|
376
|
+
startSession(reason: SessionReason): Promise<void>;
|
|
377
|
+
/**
|
|
378
|
+
* Finalize the current session: journey summary + sdk.error_count, then an immediate flush.
|
|
379
|
+
*
|
|
380
|
+
* The backend discards `duration_ms` and `event_count` and derives both (§4.2) — they
|
|
381
|
+
* stay on the wire because the event survives as the carrier for `session.reason` and
|
|
382
|
+
* `sdk.error_count`, neither of which is derivable. Duration is stamped from
|
|
383
|
+
* `lastActivity`, never `now`: a lazily-detected rotation must report 2 minutes of use,
|
|
384
|
+
* not the 6 idle hours that followed it.
|
|
385
|
+
*/
|
|
386
|
+
finalizeSession(reason: SessionEndReason): Promise<void>;
|
|
387
|
+
/** Every span frozen to the session being left ships `abandoned` under it — before the switch. */
|
|
388
|
+
private abandonSpans;
|
|
149
389
|
/** Begin a fresh session: new id/start, reset per-session counters, emit session.started. */
|
|
150
|
-
newSession(): Promise<void>;
|
|
151
|
-
/**
|
|
152
|
-
|
|
390
|
+
newSession(reason: SessionReason): Promise<void>;
|
|
391
|
+
/**
|
|
392
|
+
* Open a manual span — **synchronously**, so the trace keys, `view.id` and `session.id`
|
|
393
|
+
* freeze at the call (§3.1). Inert (`undefined`, reported through `debug()`) for a blank
|
|
394
|
+
* name or past 32 open spans; never throws. Refreshes `lastActivity` but is not an
|
|
395
|
+
* action: `view.action_count` counts `ui.interaction` only.
|
|
396
|
+
*
|
|
397
|
+
* On a session that has already expired the freeze waits for the rotation the start
|
|
398
|
+
* itself triggers, so a journey begun after a long idle belongs to the new session
|
|
399
|
+
* rather than being `abandoned` by the very next row.
|
|
400
|
+
*/
|
|
401
|
+
startSpan(name: unknown, attrs?: Record<string, unknown>, at?: number): OpenSpan | undefined;
|
|
402
|
+
/**
|
|
403
|
+
* Close a span by name and emit its one `task.complete`. An unknown or already-closed
|
|
404
|
+
* name is a no-op. With `only`, the close is a handle's, and a superseded handle cannot
|
|
405
|
+
* close the span that replaced it.
|
|
406
|
+
*/
|
|
407
|
+
endSpan(name: unknown, outcome?: TaskOutcome, attrs?: Record<string, unknown>, at?: number, only?: OpenSpan, reason?: unknown): Promise<void>;
|
|
408
|
+
private emitTask;
|
|
409
|
+
/** Boundary rotation: finalize the old session then start a fresh one (the pair). */
|
|
410
|
+
rotateSession(reason: SessionEndReason): Promise<void>;
|
|
411
|
+
/** Truncated at source (§3.2): the collector caps at 255 and we must not be the one over. */
|
|
153
412
|
setUserId(id: string): void;
|
|
154
|
-
getUserId(): string | undefined
|
|
155
|
-
|
|
413
|
+
getUserId(): string | undefined;
|
|
414
|
+
/**
|
|
415
|
+
* The SDK-owned `device.id` (§3.2/§3.3): self-minted, written through the `Store`,
|
|
416
|
+
* uninstall-scoped, stable across process restarts, and never rotated by login,
|
|
417
|
+
* logout or a profile clear.
|
|
418
|
+
*
|
|
419
|
+
* The platform suffix is the entry's (ios|android|web), not the device-info adapter's:
|
|
420
|
+
* this id is persisted forever, so it must not depend on a call that can throw on first run.
|
|
421
|
+
*
|
|
422
|
+
* `getUniqueId()` is deliberately not used — it already carries two lifetimes on RN
|
|
423
|
+
* alone (ANDROID_ID survives reinstall, identifierForVendor does not), so one identity
|
|
424
|
+
* column would mean two things.
|
|
425
|
+
*
|
|
426
|
+
* When the Store reports `unavailable` — incognito, a partitioned iframe, ITP
|
|
427
|
+
* eviction, a full disk — the id lives for one process only and `device.id_ephemeral`
|
|
428
|
+
* rides the Context block to say so, because that population is otherwise
|
|
429
|
+
* indistinguishable from real installs and reads as traffic growth.
|
|
430
|
+
*/
|
|
431
|
+
private getDeviceId;
|
|
156
432
|
/**
|
|
157
433
|
* Set complete user profile information
|
|
158
434
|
*/
|
|
159
435
|
setUserProfile(profile: Partial<UserProfile>): void;
|
|
160
436
|
/**
|
|
161
|
-
* EdgeRum-style identify():
|
|
162
|
-
*
|
|
163
|
-
*
|
|
437
|
+
* EdgeRum-style identify(): record the host-app profile and emit the one event that
|
|
438
|
+
* carries it — `user.profile.update` (§4.10, #107). The PII is no longer on the
|
|
439
|
+
* Context block of every event.
|
|
440
|
+
*
|
|
441
|
+
* `userId` is optional and new in v4: the one call that sends a profile should also
|
|
442
|
+
* set the key that profile attaches to, since `user.id` is consumer-supplied (§3.2)
|
|
443
|
+
* and an unkeyed profile has nothing to upsert on. Omitting it leaves `user.id`
|
|
444
|
+
* exactly as it was — identify never mints one.
|
|
164
445
|
*/
|
|
165
446
|
identify(profile: {
|
|
447
|
+
userId?: string;
|
|
166
448
|
name?: string;
|
|
167
449
|
email?: string;
|
|
168
450
|
phone?: string;
|
|
@@ -205,7 +487,34 @@ export declare class Telemetry {
|
|
|
205
487
|
* Log a named event. Keeps existing signature compatibility.
|
|
206
488
|
* Automatically attaches userId and sessionId to every queued event.
|
|
207
489
|
*/
|
|
208
|
-
log(name: string, data?: Record<string, any
|
|
490
|
+
log(name: string, data?: Record<string, any>, snapshot?: LogSnapshot): Promise<void>;
|
|
491
|
+
/** §2.5 4xx: drop the batch, book it, and tell a dev once — it is usually a wrong apiKey. */
|
|
492
|
+
private reject;
|
|
493
|
+
/** §2.5 429: halt the drain until `X-RateLimit-Reset`, 1 s when the header is absent. */
|
|
494
|
+
private holdFor;
|
|
495
|
+
/**
|
|
496
|
+
* The crash path (§2 / §9.4): persist the whole queue, then send **one** batch reordered
|
|
497
|
+
* so the crash rides in it. Not a drain — a dying process gets one round trip.
|
|
498
|
+
*
|
|
499
|
+
* ⚠ The web/native asymmetry is real and is not fixed here. On web the `Store` is
|
|
500
|
+
* synchronous `localStorage`, so the persist has *landed* by the time the next line runs
|
|
501
|
+
* and the loss window closes. On native it is an AsyncStorage round-trip that a SIGKILL
|
|
502
|
+
* can outrun, so the window only narrows. Awaiting harder does not change that; the
|
|
503
|
+
* asymmetry is the `Store` port's whole point (`core/store.ts`).
|
|
504
|
+
*
|
|
505
|
+
* The persisted copy is a safety copy, not a handoff: the queue is left intact, because
|
|
506
|
+
* an `app.crash` is not always fatal — `window.onerror` fires and the page keeps running
|
|
507
|
+
* — and the process usually lives on. A successful send therefore
|
|
508
|
+
* leaves a duplicate on disk to replay next launch — which is what `event.sequence` and
|
|
509
|
+
* the backend's `(session_id, event_sequence)` dedup exist for (§2.4).
|
|
510
|
+
*
|
|
511
|
+
* *One* duplicate. Each row is written at most once by this path, watermarked on
|
|
512
|
+
* `event.sequence`: a chatty app crash-flushes often, and re-persisting the whole queue
|
|
513
|
+
* each time would fill the store with copies of
|
|
514
|
+
* its own backlog and book `store_full` drops that are not loss — corrupting the very
|
|
515
|
+
* counter this change adds.
|
|
516
|
+
*/
|
|
517
|
+
private flushCrash;
|
|
209
518
|
/**
|
|
210
519
|
* Build the v3 Context block that rides on every event AND metric: the flattened
|
|
211
520
|
* device/network snapshot, the caller's data, identity + session + sdk fields, and the
|
|
@@ -218,16 +527,87 @@ export declare class Telemetry {
|
|
|
218
527
|
* don't extend the breadcrumb trail and don't count as session activity — a periodic sampler
|
|
219
528
|
* (memory/frames) must not keep a session alive and defeat the 30-min idle rotation.
|
|
220
529
|
*/
|
|
221
|
-
logMetric(metricName: string, value: number, data?: Record<string, any
|
|
530
|
+
logMetric(metricName: string, value: number, data?: Record<string, any>, unitOverride?: string, hostName?: string): Promise<void>;
|
|
531
|
+
/**
|
|
532
|
+
* The single enqueue point: neither the sample decision nor `beforeSend` can be
|
|
533
|
+
* bypassed by a future emit path, and the hook runs *before* the queue — which is
|
|
534
|
+
* what keeps scrubbed fields off disk when a send fails and the batch is persisted.
|
|
535
|
+
*
|
|
536
|
+
* The sample check is repeated by log()/logMetric() ahead of `collectContext()`, so
|
|
537
|
+
* a sampled-out session does no work per event; this one is the backstop that makes
|
|
538
|
+
* the guarantee structural rather than a convention two call sites happen to follow.
|
|
539
|
+
*
|
|
540
|
+
* The two counters are separate on purpose: "my volume is down 40%" has to
|
|
541
|
+
* distinguish *my rule is too broad* from *my rule is crashing*, and one merged
|
|
542
|
+
* counter answers neither.
|
|
543
|
+
*/
|
|
544
|
+
private enqueue;
|
|
545
|
+
/**
|
|
546
|
+
* Hold the in-memory queue at its cap (§9.4), booking what it costs.
|
|
547
|
+
*
|
|
548
|
+
* The count lands on the *next* event's Context block, not this one's — `collectContext()`
|
|
549
|
+
* has already run by the time we get here. That is §3.7's stated behaviour, not a bug.
|
|
550
|
+
*/
|
|
551
|
+
private capQueue;
|
|
552
|
+
/**
|
|
553
|
+
* Book dropped rows against the monotonic counter and the reason that shipped last.
|
|
554
|
+
* Takes `Sender.onFailure`'s return shape as-is — a sender with no cap returns nothing.
|
|
555
|
+
*/
|
|
556
|
+
private recordDrop;
|
|
222
557
|
private flattenWithPrefix;
|
|
223
558
|
/**
|
|
224
|
-
*
|
|
559
|
+
* The public metric path (#167), sent as `custom.metric` with the host's name in
|
|
560
|
+
* `metric.name` (processor #41). The SDK's own names stay **reserved**, and no cap on distinct
|
|
561
|
+
* names. A non-finite value is dropped, never shipped as a fabricated number. `unit`
|
|
562
|
+
* becomes `metric.unit`, stamped after `data` so an attribute cannot mislabel it.
|
|
563
|
+
*/
|
|
564
|
+
recordMetric(name: string, value: number, data?: Record<string, any>, opts?: {
|
|
565
|
+
unit?: string;
|
|
566
|
+
}): Promise<void> | undefined;
|
|
567
|
+
/**
|
|
568
|
+
* §2.4's draining flush (#162): batches go **sequentially** until the queue is empty,
|
|
569
|
+
* stopping at the first failure, at most `DRAIN_MAX_BATCHES` per call and paced to the
|
|
570
|
+
* collector's 10 req/s burst. Sequential because parallel batches are how a cold backend
|
|
571
|
+
* gets stampeded by a replay. Retry + backoff live in the Sender (`sendWithRetry`).
|
|
572
|
+
*
|
|
573
|
+
* A call landing while a drain is in flight joins it rather than starting a second loop:
|
|
574
|
+
* the interval and the batch-full trigger both fire `flush()` unawaited, and two loops
|
|
575
|
+
* would interleave their sends and break the pacing.
|
|
225
576
|
*/
|
|
226
|
-
recordMetric(name: string, value: number, data?: Record<string, any>): Promise<void>;
|
|
227
577
|
flush(): Promise<void>;
|
|
578
|
+
private draining?;
|
|
579
|
+
/** Epoch ms before which no batch may be sent — a 429's `X-RateLimit-Reset` (§2.5). */
|
|
580
|
+
private holdUntil;
|
|
581
|
+
private drain;
|
|
582
|
+
/**
|
|
583
|
+
* §2.5's status table, for a batch the sender gave up on.
|
|
584
|
+
*
|
|
585
|
+
* | 4xx | dropped — no persist — booked `rejected`, one `__DEV__` warning per process |
|
|
586
|
+
* | 429 | requeued at the front; the drain halts until `X-RateLimit-Reset` |
|
|
587
|
+
* | 5xx / network | persisted through the sender, or requeued when it cannot persist |
|
|
588
|
+
*
|
|
589
|
+
* A wrong credential is the realistic 4xx, and persisting it would make it terminal: the
|
|
590
|
+
* drain halts at batch 1 on every launch forever while the store fills and evicts.
|
|
591
|
+
*/
|
|
592
|
+
private onSendFailure;
|
|
593
|
+
/**
|
|
594
|
+
* Book an acknowledged (2xx) batch. `session.sequence` orders a session's batches (#29),
|
|
595
|
+
* and it is persisted because a resumed session restarting at 0 would emit duplicate
|
|
596
|
+
* (session.id, session.sequence) pairs and stop ordering anything (#92).
|
|
597
|
+
*/
|
|
598
|
+
private ackBatch;
|
|
228
599
|
getQueue(): TelemetryEvent[];
|
|
229
600
|
shutdown(): Promise<void>;
|
|
230
601
|
getEventCount(): number;
|
|
231
|
-
|
|
602
|
+
/**
|
|
603
|
+
* A route change (§4.5): rung 2 of the name ladder. The two deprecated feeds it used to
|
|
604
|
+
* emit alongside — `navigation` and `screen.duration` — are gone in v5 (#163).
|
|
605
|
+
*/
|
|
606
|
+
recordRouteChange(to: string): Promise<void>;
|
|
607
|
+
/**
|
|
608
|
+
* Feed the name ladder (§4.5.1). Rungs 1 and 2 arrive unnormalized; rung 3's caller
|
|
609
|
+
* normalizes before calling. Whether this re-stamps the current view or mints a
|
|
610
|
+
* successor is the ladder's decision, not the caller's.
|
|
611
|
+
*/
|
|
612
|
+
enterView(name: string, source: ViewNameSource): Promise<void>;
|
|
232
613
|
}
|
|
233
|
-
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
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
|
+
* A primitive rides as itself; anything else is stringified and truncated. A value that
|
|
10
|
+
* cannot be stringified — a cycle, a throwing `toJSON` — drops the key rather than the
|
|
11
|
+
* process. Consumer keys pass through **verbatim, casing included** (§4.10): the SDK
|
|
12
|
+
* imposes no normalization here, so an over-long key is dropped, never truncated.
|
|
13
|
+
*/
|
|
14
|
+
export declare function customValue(value: unknown): string | number | boolean | undefined;
|
|
15
|
+
/**
|
|
16
|
+
* The wire keys for `user.profile.update`. `user.id` is not here — it rides the Context
|
|
17
|
+
* block, where it is present on this event by construction.
|
|
18
|
+
*/
|
|
19
|
+
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
|
-
import { TelemetryNative } from './
|
|
1
|
+
import { TelemetryNative } from './telemetryNative.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,13 @@ 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;
|
|
17
|
+
enabled?: boolean;
|
|
18
|
+
autoTrackTaps?: boolean;
|
|
10
19
|
};
|
|
11
20
|
export declare function assertApiKey(apiKey?: string): void;
|
|
12
21
|
/**
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import { TelemetryWeb } from './
|
|
1
|
+
import { TelemetryWeb } from './telemetryWeb.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,12 @@ 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;
|
|
17
|
+
enabled?: boolean;
|
|
10
18
|
};
|
|
11
19
|
export declare function assertApiKey(apiKey?: string): void;
|
|
12
20
|
/**
|