@openobserve/browser-core 0.2.10 → 0.2.11-rc1
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/cjs/boot/init.js +1 -1
- package/cjs/boot/init.js.map +1 -1
- package/cjs/browser/addEventListener.d.ts +12 -4
- package/cjs/browser/addEventListener.js +50 -8
- package/cjs/browser/addEventListener.js.map +1 -1
- package/cjs/browser/cookie.d.ts +7 -0
- package/cjs/browser/cookie.js +19 -2
- package/cjs/browser/cookie.js.map +1 -1
- package/cjs/browser/fetchObservable.js +14 -19
- package/cjs/browser/fetchObservable.js.map +1 -1
- package/cjs/browser/pageExitObservable.js +6 -7
- package/cjs/browser/pageExitObservable.js.map +1 -1
- package/cjs/browser/runOnReadyState.js +1 -1
- package/cjs/browser/runOnReadyState.js.map +1 -1
- package/cjs/browser/xhrObservable.d.ts +1 -2
- package/cjs/browser/xhrObservable.js +26 -34
- package/cjs/browser/xhrObservable.js.map +1 -1
- package/cjs/domain/configuration/configuration.d.ts +17 -12
- package/cjs/domain/configuration/configuration.js +8 -9
- package/cjs/domain/configuration/configuration.js.map +1 -1
- package/cjs/domain/configuration/endpointBuilder.d.ts +6 -10
- package/cjs/domain/configuration/endpointBuilder.js +23 -33
- package/cjs/domain/configuration/endpointBuilder.js.map +1 -1
- package/cjs/domain/configuration/index.d.ts +2 -1
- package/cjs/domain/configuration/index.js +3 -1
- package/cjs/domain/configuration/index.js.map +1 -1
- package/cjs/domain/configuration/tags.js.map +1 -1
- package/cjs/domain/configuration/transportConfiguration.js +1 -1
- package/cjs/domain/configuration/transportConfiguration.js.map +1 -1
- package/cjs/domain/connectivity/connectivity.d.ts +13 -0
- package/cjs/domain/connectivity/connectivity.js +14 -0
- package/cjs/domain/connectivity/connectivity.js.map +1 -0
- package/cjs/domain/connectivity/index.d.ts +1 -0
- package/cjs/domain/{deflate → connectivity}/index.js +1 -1
- package/cjs/domain/connectivity/index.js.map +1 -0
- package/cjs/domain/console/consoleObservable.js +4 -7
- package/cjs/domain/console/consoleObservable.js.map +1 -1
- package/cjs/domain/context/contextConstants.d.ts +5 -0
- package/cjs/domain/{tracekit/types.js → context/contextConstants.js} +1 -1
- package/cjs/domain/context/contextConstants.js.map +1 -0
- package/cjs/domain/context/contextManager.d.ts +12 -0
- package/cjs/domain/context/contextManager.js +43 -0
- package/cjs/domain/context/contextManager.js.map +1 -0
- package/cjs/domain/context/customerDataTracker.d.ts +45 -0
- package/cjs/domain/context/customerDataTracker.js +107 -0
- package/cjs/domain/context/customerDataTracker.js.map +1 -0
- package/cjs/domain/context/storeContextManager.d.ts +6 -0
- package/cjs/domain/context/storeContextManager.js +38 -0
- package/cjs/domain/context/storeContextManager.js.map +1 -0
- package/cjs/domain/deflate/types.d.ts +0 -26
- package/cjs/domain/error/computeStackTrace.d.ts +33 -0
- package/cjs/domain/{tracekit → error}/computeStackTrace.js +28 -4
- package/cjs/domain/error/computeStackTrace.js.map +1 -0
- package/cjs/domain/error/error.d.ts +1 -1
- package/cjs/domain/error/error.js +3 -3
- package/cjs/domain/error/error.js.map +1 -1
- package/cjs/domain/error/error.types.d.ts +2 -2
- package/cjs/domain/error/error.types.js.map +1 -1
- package/cjs/domain/error/trackRuntimeError.d.ts +8 -0
- package/cjs/domain/error/trackRuntimeError.js +39 -6
- package/cjs/domain/error/trackRuntimeError.js.map +1 -1
- package/cjs/domain/eventRateLimiter/createEventRateLimiter.js.map +1 -1
- package/cjs/domain/report/browser.types.d.ts +10 -0
- package/cjs/domain/report/reportObservable.d.ts +2 -0
- package/cjs/domain/report/reportObservable.js +7 -7
- package/cjs/domain/report/reportObservable.js.map +1 -1
- package/cjs/domain/session/oldCookiesMigration.js +4 -4
- package/cjs/domain/session/oldCookiesMigration.js.map +1 -1
- package/cjs/domain/session/sessionManager.js +2 -2
- package/cjs/domain/session/sessionManager.js.map +1 -1
- package/cjs/domain/session/sessionState.js.map +1 -1
- package/cjs/domain/session/sessionStore.js.map +1 -1
- package/cjs/domain/session/sessionStoreOperations.d.ts +0 -5
- package/cjs/domain/session/sessionStoreOperations.js +6 -14
- package/cjs/domain/session/sessionStoreOperations.js.map +1 -1
- package/cjs/domain/session/storeStrategies/sessionInCookie.js +13 -2
- package/cjs/domain/session/storeStrategies/sessionInCookie.js.map +1 -1
- package/cjs/domain/session/storeStrategies/sessionInLocalStorage.js +1 -0
- package/cjs/domain/session/storeStrategies/sessionInLocalStorage.js.map +1 -1
- package/cjs/domain/session/storeStrategies/sessionStoreStrategy.d.ts +1 -0
- package/cjs/domain/synthetics/syntheticsWorkerValues.js +3 -3
- package/cjs/domain/synthetics/syntheticsWorkerValues.js.map +1 -1
- package/cjs/domain/telemetry/rawTelemetryEvent.types.d.ts +4 -0
- package/cjs/domain/telemetry/telemetry.d.ts +5 -1
- package/cjs/domain/telemetry/telemetry.js +17 -6
- package/cjs/domain/telemetry/telemetry.js.map +1 -1
- package/cjs/domain/telemetry/telemetryEvent.types.d.ts +18 -2
- package/cjs/domain/user/user.js.map +1 -1
- package/cjs/tools/abstractLifeCycle.js.map +1 -1
- package/cjs/tools/boundedBuffer.js.map +1 -1
- package/cjs/tools/catchUserErrors.js.map +1 -1
- package/cjs/tools/display.d.ts +2 -2
- package/cjs/tools/display.js +13 -17
- package/cjs/tools/display.js.map +1 -1
- package/cjs/tools/encoder.d.ts +53 -0
- package/cjs/tools/encoder.js +41 -0
- package/cjs/tools/encoder.js.map +1 -0
- package/cjs/tools/experimentalFeatures.d.ts +3 -5
- package/cjs/tools/experimentalFeatures.js +2 -4
- package/cjs/tools/experimentalFeatures.js.map +1 -1
- package/cjs/tools/getGlobalObject.js.map +1 -1
- package/cjs/tools/getZoneJsOriginalValue.js.map +1 -1
- package/cjs/tools/instrumentMethod.d.ts +50 -10
- package/cjs/tools/instrumentMethod.js +59 -36
- package/cjs/tools/instrumentMethod.js.map +1 -1
- package/cjs/tools/matchOption.js.map +1 -1
- package/cjs/tools/mergeInto.js.map +1 -1
- package/cjs/tools/monitor.d.ts +1 -2
- package/cjs/tools/monitor.js +6 -6
- package/cjs/tools/monitor.js.map +1 -1
- package/cjs/tools/observable.d.ts +1 -1
- package/cjs/tools/observable.js +2 -3
- package/cjs/tools/observable.js.map +1 -1
- package/cjs/tools/readBytesFromStream.js.map +1 -1
- package/cjs/tools/sendToExtension.js.map +1 -1
- package/cjs/tools/serialisation/jsonStringify.d.ts +1 -2
- package/cjs/tools/serialisation/jsonStringify.js.map +1 -1
- package/cjs/tools/serialisation/sanitize.js.map +1 -1
- package/cjs/tools/utils/browserDetection.d.ts +8 -0
- package/cjs/tools/utils/browserDetection.js +33 -3
- package/cjs/tools/utils/browserDetection.js.map +1 -1
- package/cjs/tools/utils/byteUtils.js.map +1 -1
- package/cjs/tools/utils/functionUtils.js.map +1 -1
- package/cjs/tools/utils/objectUtils.js.map +1 -1
- package/cjs/tools/utils/polyfills.js.map +1 -1
- package/cjs/tools/utils/responseUtils.js.map +1 -1
- package/cjs/tools/utils/stringUtils.d.ts +1 -0
- package/cjs/tools/utils/stringUtils.js +31 -4
- package/cjs/tools/utils/stringUtils.js.map +1 -1
- package/cjs/tools/utils/timeUtils.js.map +1 -1
- package/cjs/tools/utils/typeUtils.js.map +1 -1
- package/cjs/tools/utils/urlPolyfill.js.map +1 -1
- package/cjs/tools/valueHistory.js.map +1 -1
- package/cjs/transport/batch.d.ts +5 -3
- package/cjs/transport/batch.js +73 -29
- package/cjs/transport/batch.js.map +1 -1
- package/cjs/transport/eventBridge.js.map +1 -1
- package/cjs/transport/flushController.d.ts +12 -2
- package/cjs/transport/flushController.js +22 -7
- package/cjs/transport/flushController.js.map +1 -1
- package/cjs/transport/httpRequest.d.ts +3 -2
- package/cjs/transport/httpRequest.js +21 -17
- package/cjs/transport/httpRequest.js.map +1 -1
- package/cjs/transport/sendWithRetryStrategy.d.ts +2 -2
- package/cjs/transport/sendWithRetryStrategy.js +9 -9
- package/cjs/transport/sendWithRetryStrategy.js.map +1 -1
- package/cjs/transport/startBatchWithReplica.d.ts +9 -4
- package/cjs/transport/startBatchWithReplica.js +9 -4
- package/cjs/transport/startBatchWithReplica.js.map +1 -1
- package/esm/boot/init.js +1 -1
- package/esm/boot/init.js.map +1 -1
- package/esm/browser/addEventListener.d.ts +12 -4
- package/esm/browser/addEventListener.js +49 -7
- package/esm/browser/addEventListener.js.map +1 -1
- package/esm/browser/cookie.d.ts +7 -0
- package/esm/browser/cookie.js +17 -2
- package/esm/browser/cookie.js.map +1 -1
- package/esm/browser/fetchObservable.js +15 -20
- package/esm/browser/fetchObservable.js.map +1 -1
- package/esm/browser/pageExitObservable.js +7 -8
- package/esm/browser/pageExitObservable.js.map +1 -1
- package/esm/browser/runOnReadyState.js +2 -2
- package/esm/browser/runOnReadyState.js.map +1 -1
- package/esm/browser/xhrObservable.d.ts +1 -2
- package/esm/browser/xhrObservable.js +28 -36
- package/esm/browser/xhrObservable.js.map +1 -1
- package/esm/domain/configuration/configuration.d.ts +17 -12
- package/esm/domain/configuration/configuration.js +8 -9
- package/esm/domain/configuration/configuration.js.map +1 -1
- package/esm/domain/configuration/endpointBuilder.d.ts +6 -10
- package/esm/domain/configuration/endpointBuilder.js +22 -32
- package/esm/domain/configuration/endpointBuilder.js.map +1 -1
- package/esm/domain/configuration/index.d.ts +2 -1
- package/esm/domain/configuration/index.js +1 -0
- package/esm/domain/configuration/index.js.map +1 -1
- package/esm/domain/configuration/tags.js.map +1 -1
- package/esm/domain/configuration/transportConfiguration.js +1 -1
- package/esm/domain/configuration/transportConfiguration.js.map +1 -1
- package/esm/domain/connectivity/connectivity.d.ts +13 -0
- package/esm/domain/connectivity/connectivity.js +10 -0
- package/esm/domain/connectivity/connectivity.js.map +1 -0
- package/esm/domain/connectivity/index.d.ts +1 -0
- package/esm/domain/connectivity/index.js +2 -0
- package/esm/domain/connectivity/index.js.map +1 -0
- package/esm/domain/console/consoleObservable.js +2 -5
- package/esm/domain/console/consoleObservable.js.map +1 -1
- package/esm/domain/context/contextConstants.d.ts +5 -0
- package/esm/domain/context/contextConstants.js +2 -0
- package/esm/domain/context/contextConstants.js.map +1 -0
- package/esm/domain/context/contextManager.d.ts +12 -0
- package/esm/domain/context/contextManager.js +39 -0
- package/esm/domain/context/contextManager.js.map +1 -0
- package/esm/domain/context/customerDataTracker.d.ts +45 -0
- package/esm/domain/context/customerDataTracker.js +102 -0
- package/esm/domain/context/customerDataTracker.js.map +1 -0
- package/esm/domain/context/storeContextManager.d.ts +6 -0
- package/esm/domain/context/storeContextManager.js +32 -0
- package/esm/domain/context/storeContextManager.js.map +1 -0
- package/esm/domain/deflate/types.d.ts +12 -0
- package/esm/domain/error/computeStackTrace.d.ts +33 -0
- package/esm/domain/{tracekit → error}/computeStackTrace.js +26 -3
- package/esm/domain/error/computeStackTrace.js.map +1 -0
- package/esm/domain/error/error.d.ts +1 -1
- package/esm/domain/error/error.js +1 -1
- package/esm/domain/error/error.js.map +1 -1
- package/esm/domain/error/error.types.d.ts +2 -2
- package/esm/domain/error/error.types.js.map +1 -1
- package/esm/domain/error/trackRuntimeError.d.ts +8 -0
- package/esm/domain/error/trackRuntimeError.js +35 -4
- package/esm/domain/error/trackRuntimeError.js.map +1 -1
- package/esm/domain/eventRateLimiter/createEventRateLimiter.js.map +1 -1
- package/esm/domain/report/browser.types.d.ts +10 -0
- package/esm/domain/report/reportObservable.d.ts +2 -0
- package/esm/domain/report/reportObservable.js +8 -8
- package/esm/domain/report/reportObservable.js.map +1 -1
- package/esm/domain/session/oldCookiesMigration.js +5 -5
- package/esm/domain/session/oldCookiesMigration.js.map +1 -1
- package/esm/domain/session/sessionManager.js +3 -3
- package/esm/domain/session/sessionManager.js.map +1 -1
- package/esm/domain/session/sessionState.js.map +1 -1
- package/esm/domain/session/sessionStore.js.map +1 -1
- package/esm/domain/session/sessionStoreOperations.d.ts +0 -5
- package/esm/domain/session/sessionStoreOperations.js +5 -12
- package/esm/domain/session/sessionStoreOperations.js.map +1 -1
- package/esm/domain/session/storeStrategies/sessionInCookie.js +13 -2
- package/esm/domain/session/storeStrategies/sessionInCookie.js.map +1 -1
- package/esm/domain/session/storeStrategies/sessionInLocalStorage.js +1 -0
- package/esm/domain/session/storeStrategies/sessionInLocalStorage.js.map +1 -1
- package/esm/domain/session/storeStrategies/sessionStoreStrategy.d.ts +1 -0
- package/esm/domain/synthetics/syntheticsWorkerValues.js +4 -4
- package/esm/domain/synthetics/syntheticsWorkerValues.js.map +1 -1
- package/esm/domain/telemetry/rawTelemetryEvent.types.d.ts +4 -0
- package/esm/domain/telemetry/telemetry.d.ts +5 -1
- package/esm/domain/telemetry/telemetry.js +16 -5
- package/esm/domain/telemetry/telemetry.js.map +1 -1
- package/esm/domain/telemetry/telemetryEvent.types.d.ts +18 -2
- package/esm/domain/user/user.js.map +1 -1
- package/esm/index.d.ts +9 -5
- package/esm/index.js +8 -5
- package/esm/index.js.map +1 -1
- package/esm/tools/abstractLifeCycle.js.map +1 -1
- package/esm/tools/boundedBuffer.js.map +1 -1
- package/esm/tools/catchUserErrors.js.map +1 -1
- package/esm/tools/display.d.ts +2 -2
- package/esm/tools/display.js +12 -15
- package/esm/tools/display.js.map +1 -1
- package/esm/tools/encoder.d.ts +53 -0
- package/esm/tools/encoder.js +37 -0
- package/esm/tools/encoder.js.map +1 -0
- package/esm/tools/experimentalFeatures.d.ts +3 -5
- package/esm/tools/experimentalFeatures.js +2 -4
- package/esm/tools/experimentalFeatures.js.map +1 -1
- package/esm/tools/getGlobalObject.js.map +1 -1
- package/esm/tools/getZoneJsOriginalValue.js.map +1 -1
- package/esm/tools/instrumentMethod.d.ts +50 -10
- package/esm/tools/instrumentMethod.js +58 -34
- package/esm/tools/instrumentMethod.js.map +1 -1
- package/esm/tools/matchOption.js.map +1 -1
- package/esm/tools/mergeInto.js.map +1 -1
- package/esm/tools/monitor.d.ts +1 -2
- package/esm/tools/monitor.js +7 -7
- package/esm/tools/monitor.js.map +1 -1
- package/esm/tools/observable.d.ts +1 -1
- package/esm/tools/observable.js +2 -3
- package/esm/tools/observable.js.map +1 -1
- package/esm/tools/readBytesFromStream.js.map +1 -1
- package/esm/tools/sendToExtension.js.map +1 -1
- package/esm/tools/serialisation/jsonStringify.d.ts +1 -2
- package/esm/tools/serialisation/jsonStringify.js.map +1 -1
- package/esm/tools/serialisation/sanitize.js.map +1 -1
- package/esm/tools/utils/browserDetection.d.ts +8 -0
- package/esm/tools/utils/browserDetection.js +30 -2
- package/esm/tools/utils/browserDetection.js.map +1 -1
- package/esm/tools/utils/byteUtils.js.map +1 -1
- package/esm/tools/utils/functionUtils.js.map +1 -1
- package/esm/tools/utils/objectUtils.js.map +1 -1
- package/esm/tools/utils/polyfills.js.map +1 -1
- package/esm/tools/utils/responseUtils.js.map +1 -1
- package/esm/tools/utils/stringUtils.d.ts +1 -0
- package/esm/tools/utils/stringUtils.js +29 -3
- package/esm/tools/utils/stringUtils.js.map +1 -1
- package/esm/tools/utils/timeUtils.js.map +1 -1
- package/esm/tools/utils/typeUtils.js.map +1 -1
- package/esm/tools/utils/urlPolyfill.js.map +1 -1
- package/esm/tools/valueHistory.js.map +1 -1
- package/esm/transport/batch.d.ts +5 -3
- package/esm/transport/batch.js +73 -29
- package/esm/transport/batch.js.map +1 -1
- package/esm/transport/eventBridge.js.map +1 -1
- package/esm/transport/flushController.d.ts +12 -2
- package/esm/transport/flushController.js +22 -7
- package/esm/transport/flushController.js.map +1 -1
- package/esm/transport/httpRequest.d.ts +3 -2
- package/esm/transport/httpRequest.js +21 -17
- package/esm/transport/httpRequest.js.map +1 -1
- package/esm/transport/sendWithRetryStrategy.d.ts +2 -2
- package/esm/transport/sendWithRetryStrategy.js +9 -9
- package/esm/transport/sendWithRetryStrategy.js.map +1 -1
- package/esm/transport/startBatchWithReplica.d.ts +9 -4
- package/esm/transport/startBatchWithReplica.js +9 -4
- package/esm/transport/startBatchWithReplica.js.map +1 -1
- package/package.json +1 -1
- package/src/browser/addEventListener.ts +37 -31
- package/src/browser/cookie.ts +21 -2
- package/src/browser/fetchObservable.ts +21 -25
- package/src/browser/pageExitObservable.ts +1 -3
- package/src/browser/xhrObservable.ts +31 -37
- package/src/domain/configuration/configuration.ts +24 -22
- package/src/domain/configuration/endpointBuilder.ts +33 -46
- package/src/domain/configuration/index.ts +2 -1
- package/src/domain/configuration/transportConfiguration.ts +1 -1
- package/src/domain/connectivity/connectivity.ts +27 -0
- package/src/domain/connectivity/index.ts +1 -0
- package/src/domain/console/consoleObservable.ts +3 -7
- package/src/domain/context/contextConstants.ts +5 -0
- package/src/domain/context/contextManager.ts +48 -0
- package/src/domain/context/customerDataTracker.ts +134 -0
- package/src/domain/context/storeContextManager.ts +51 -0
- package/src/domain/deflate/types.ts +14 -0
- package/src/domain/{tracekit → error}/computeStackTrace.ts +49 -4
- package/src/domain/error/error.ts +2 -2
- package/src/domain/error/error.types.ts +11 -2
- package/src/domain/error/trackRuntimeError.ts +44 -12
- package/src/domain/report/browser.types.ts +12 -0
- package/src/domain/report/reportObservable.ts +8 -6
- package/src/domain/session/oldCookiesMigration.ts +5 -5
- package/src/domain/session/sessionStoreOperations.ts +5 -13
- package/src/domain/session/storeStrategies/sessionInCookie.ts +13 -2
- package/src/domain/session/storeStrategies/sessionInLocalStorage.ts +1 -0
- package/src/domain/session/storeStrategies/sessionStoreStrategy.ts +1 -0
- package/src/domain/synthetics/syntheticsWorkerValues.ts +4 -4
- package/src/domain/telemetry/rawTelemetryEvent.types.ts +5 -0
- package/src/domain/telemetry/telemetry.ts +22 -7
- package/src/domain/telemetry/telemetryEvent.types.ts +18 -2
- package/src/index.ts +13 -7
- package/src/tools/display.ts +14 -13
- package/src/tools/encoder.ts +102 -0
- package/src/tools/experimentalFeatures.ts +2 -4
- package/src/tools/instrumentMethod.ts +103 -59
- package/src/tools/mergeInto.ts +16 -16
- package/src/tools/monitor.ts +5 -5
- package/src/tools/observable.ts +3 -5
- package/src/tools/utils/browserDetection.ts +43 -2
- package/src/tools/utils/polyfills.ts +1 -4
- package/src/tools/utils/stringUtils.ts +30 -4
- package/src/transport/batch.ts +86 -31
- package/src/transport/flushController.ts +22 -7
- package/src/transport/httpRequest.ts +23 -16
- package/src/transport/sendWithRetryStrategy.ts +10 -10
- package/src/transport/startBatchWithReplica.ts +22 -6
- package/cjs/domain/deflate/index.d.ts +0 -1
- package/cjs/domain/deflate/index.js.map +0 -1
- package/cjs/domain/tracekit/computeStackTrace.d.ts +0 -5
- package/cjs/domain/tracekit/computeStackTrace.js.map +0 -1
- package/cjs/domain/tracekit/index.d.ts +0 -3
- package/cjs/domain/tracekit/index.js +0 -8
- package/cjs/domain/tracekit/index.js.map +0 -1
- package/cjs/domain/tracekit/tracekit.d.ts +0 -35
- package/cjs/domain/tracekit/tracekit.js +0 -95
- package/cjs/domain/tracekit/tracekit.js.map +0 -1
- package/cjs/domain/tracekit/types.d.ts +0 -44
- package/cjs/domain/tracekit/types.js.map +0 -1
- package/cjs/index.d.ts +0 -63
- package/cjs/index.js +0 -155
- package/cjs/index.js.map +0 -1
- package/cjs/tools/serialisation/contextManager.d.ts +0 -21
- package/cjs/tools/serialisation/contextManager.js +0 -70
- package/cjs/tools/serialisation/contextManager.js.map +0 -1
- package/cjs/tools/serialisation/heavyCustomerDataWarning.d.ts +0 -8
- package/cjs/tools/serialisation/heavyCustomerDataWarning.js +0 -18
- package/cjs/tools/serialisation/heavyCustomerDataWarning.js.map +0 -1
- package/esm/domain/tracekit/computeStackTrace.d.ts +0 -5
- package/esm/domain/tracekit/computeStackTrace.js.map +0 -1
- package/esm/domain/tracekit/index.d.ts +0 -3
- package/esm/domain/tracekit/index.js +0 -3
- package/esm/domain/tracekit/index.js.map +0 -1
- package/esm/domain/tracekit/tracekit.d.ts +0 -35
- package/esm/domain/tracekit/tracekit.js +0 -91
- package/esm/domain/tracekit/tracekit.js.map +0 -1
- package/esm/domain/tracekit/types.d.ts +0 -44
- package/esm/domain/tracekit/types.js +0 -2
- package/esm/domain/tracekit/types.js.map +0 -1
- package/esm/tools/serialisation/contextManager.d.ts +0 -21
- package/esm/tools/serialisation/contextManager.js +0 -66
- package/esm/tools/serialisation/contextManager.js.map +0 -1
- package/esm/tools/serialisation/heavyCustomerDataWarning.d.ts +0 -8
- package/esm/tools/serialisation/heavyCustomerDataWarning.js +0 -14
- package/esm/tools/serialisation/heavyCustomerDataWarning.js.map +0 -1
- package/src/domain/tracekit/index.ts +0 -3
- package/src/domain/tracekit/tracekit.ts +0 -96
- package/src/domain/tracekit/types.ts +0 -47
- package/src/tools/serialisation/contextManager.ts +0 -79
- package/src/tools/serialisation/heavyCustomerDataWarning.ts +0 -26
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import { instrumentMethodAndCallOriginal } from '../../tools/instrumentMethod';
|
|
2
|
-
import { computeStackTrace } from './computeStackTrace';
|
|
3
|
-
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error#Error_types
|
|
4
|
-
var ERROR_TYPES_RE = /^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?([\s\S]*)$/;
|
|
5
|
-
/**
|
|
6
|
-
* Cross-browser collection of unhandled errors
|
|
7
|
-
*
|
|
8
|
-
* Supports:
|
|
9
|
-
* - Firefox: full stack trace with line numbers, plus column number
|
|
10
|
-
* on top frame; column number is not guaranteed
|
|
11
|
-
* - Opera: full stack trace with line and column numbers
|
|
12
|
-
* - Chrome: full stack trace with line and column numbers
|
|
13
|
-
* - Safari: line and column number for the top frame only; some frames
|
|
14
|
-
* may be missing, and column number is not guaranteed
|
|
15
|
-
* - IE: line and column number for the top frame only; some frames
|
|
16
|
-
* may be missing, and column number is not guaranteed
|
|
17
|
-
*
|
|
18
|
-
* In theory, TraceKit should work on all of the following versions:
|
|
19
|
-
* - IE5.5+ (only 8.0 tested)
|
|
20
|
-
* - Firefox 0.9+ (only 3.5+ tested)
|
|
21
|
-
* - Opera 7+ (only 10.50 tested; versions 9 and earlier may require
|
|
22
|
-
* Exceptions Have Stacktrace to be enabled in opera:config)
|
|
23
|
-
* - Safari 3+ (only 4+ tested)
|
|
24
|
-
* - Chrome 1+ (only 5+ tested)
|
|
25
|
-
* - Konqueror 3.5+ (untested)
|
|
26
|
-
*
|
|
27
|
-
* Tries to catch all unhandled errors and report them to the
|
|
28
|
-
* callback.
|
|
29
|
-
*
|
|
30
|
-
* Callbacks receive a StackTrace object as described in the
|
|
31
|
-
* computeStackTrace docs.
|
|
32
|
-
*
|
|
33
|
-
* @memberof TraceKit
|
|
34
|
-
* @namespace
|
|
35
|
-
*/
|
|
36
|
-
export function startUnhandledErrorCollection(callback) {
|
|
37
|
-
var stopInstrumentingOnError = instrumentOnError(callback).stop;
|
|
38
|
-
var stopInstrumentingOnUnhandledRejection = instrumentUnhandledRejection(callback).stop;
|
|
39
|
-
return {
|
|
40
|
-
stop: function () {
|
|
41
|
-
stopInstrumentingOnError();
|
|
42
|
-
stopInstrumentingOnUnhandledRejection();
|
|
43
|
-
},
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Install a global onerror handler
|
|
48
|
-
*/
|
|
49
|
-
function instrumentOnError(callback) {
|
|
50
|
-
return instrumentMethodAndCallOriginal(window, 'onerror', {
|
|
51
|
-
before: function (messageObj, url, line, column, errorObj) {
|
|
52
|
-
var stackTrace;
|
|
53
|
-
if (errorObj instanceof Error) {
|
|
54
|
-
stackTrace = computeStackTrace(errorObj);
|
|
55
|
-
}
|
|
56
|
-
else {
|
|
57
|
-
var stack = [{ url: url, column: column, line: line }];
|
|
58
|
-
var _a = tryToParseMessage(messageObj), name_1 = _a.name, message = _a.message;
|
|
59
|
-
stackTrace = {
|
|
60
|
-
name: name_1,
|
|
61
|
-
message: message,
|
|
62
|
-
stack: stack,
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
callback(stackTrace, errorObj !== null && errorObj !== void 0 ? errorObj : messageObj);
|
|
66
|
-
},
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
function tryToParseMessage(messageObj) {
|
|
70
|
-
var _a;
|
|
71
|
-
var name;
|
|
72
|
-
var message;
|
|
73
|
-
if ({}.toString.call(messageObj) === '[object String]') {
|
|
74
|
-
;
|
|
75
|
-
_a = ERROR_TYPES_RE.exec(messageObj), name = _a[1], message = _a[2];
|
|
76
|
-
}
|
|
77
|
-
return { name: name, message: message };
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* Install a global onunhandledrejection handler
|
|
81
|
-
*/
|
|
82
|
-
function instrumentUnhandledRejection(callback) {
|
|
83
|
-
return instrumentMethodAndCallOriginal(window, 'onunhandledrejection', {
|
|
84
|
-
before: function (e) {
|
|
85
|
-
var reason = e.reason || 'Empty reason';
|
|
86
|
-
var stack = computeStackTrace(reason);
|
|
87
|
-
callback(stack, reason);
|
|
88
|
-
},
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
//# sourceMappingURL=tracekit.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tracekit.js","sourceRoot":"","sources":["../../../src/domain/tracekit/tracekit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,+BAA+B,EAAE,MAAM,8BAA8B,CAAA;AAC9E,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AAGvD,qGAAqG;AACrG,IAAM,cAAc,GAClB,8GAA8G,CAAA;AAEhH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH,MAAM,UAAU,6BAA6B,CAAC,QAAgC;IACpE,IAAM,wBAAwB,GAAK,iBAAiB,CAAC,QAAQ,CAAC,KAAhC,CAAgC;IAC9D,IAAM,qCAAqC,GAAK,4BAA4B,CAAC,QAAQ,CAAC,KAA3C,CAA2C;IAE9F,OAAO;QACL,IAAI,EAAE;YACJ,wBAAwB,EAAE,CAAA;YAC1B,qCAAqC,EAAE,CAAA;QACzC,CAAC;KACF,CAAA;AACH,CAAC;AAED;;GAEG;AACH,SAAS,iBAAiB,CAAC,QAAgC;IACzD,OAAO,+BAA+B,CAAC,MAAM,EAAE,SAAS,EAAE;QACxD,MAAM,YAAY,UAAmB,EAAE,GAAY,EAAE,IAAa,EAAE,MAAe,EAAE,QAAkB;YACrG,IAAI,UAAsB,CAAA;YAC1B,IAAI,QAAQ,YAAY,KAAK,EAAE;gBAC7B,UAAU,GAAG,iBAAiB,CAAC,QAAQ,CAAC,CAAA;aACzC;iBAAM;gBACL,IAAM,KAAK,GAAG,CAAC,EAAE,GAAG,KAAA,EAAE,MAAM,QAAA,EAAE,IAAI,MAAA,EAAE,CAAC,CAAA;gBAC/B,IAAA,KAAoB,iBAAiB,CAAC,UAAU,CAAC,EAA/C,MAAI,UAAA,EAAE,OAAO,aAAkC,CAAA;gBACvD,UAAU,GAAG;oBACX,IAAI,QAAA;oBACJ,OAAO,SAAA;oBACP,KAAK,OAAA;iBACN,CAAA;aACF;YACD,QAAQ,CAAC,UAAU,EAAE,QAAQ,aAAR,QAAQ,cAAR,QAAQ,GAAI,UAAU,CAAC,CAAA;QAC9C,CAAC;KACF,CAAC,CAAA;AACJ,CAAC;AAED,SAAS,iBAAiB,CAAC,UAAmB;;IAC5C,IAAI,IAAI,CAAA;IACR,IAAI,OAAO,CAAA;IACX,IAAI,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,iBAAiB,EAAE;QACtD,CAAC;QAAA,KAAoB,cAAc,CAAC,IAAI,CAAC,UAAoB,CAAE,EAA3D,IAAI,QAAA,EAAE,OAAO,QAAA,CAA8C;KAChE;IACD,OAAO,EAAE,IAAI,MAAA,EAAE,OAAO,SAAA,EAAE,CAAA;AAC1B,CAAC;AAED;;GAEG;AACH,SAAS,4BAA4B,CAAC,QAAgC;IACpE,OAAO,+BAA+B,CAAC,MAAM,EAAE,sBAAsB,EAAE;QACrE,MAAM,YAAC,CAAwB;YAC7B,IAAM,MAAM,GAAG,CAAC,CAAC,MAAM,IAAI,cAAc,CAAA;YACzC,IAAM,KAAK,GAAG,iBAAiB,CAAC,MAAM,CAAC,CAAA;YACvC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,CAAA;QACzB,CAAC;KACF,CAAC,CAAA;AACJ,CAAC"}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
export interface BrowserError extends Error {
|
|
2
|
-
sourceURL?: string;
|
|
3
|
-
fileName?: string;
|
|
4
|
-
line?: string | number;
|
|
5
|
-
lineNumber?: string | number;
|
|
6
|
-
description?: string;
|
|
7
|
-
}
|
|
8
|
-
export type UnhandledErrorCallback = (stack: StackTrace, errorObject?: any) => any;
|
|
9
|
-
/**
|
|
10
|
-
* An object representing a single stack frame.
|
|
11
|
-
* @typedef {Object} StackFrame
|
|
12
|
-
* @property {string=} url The JavaScript or HTML file URL.
|
|
13
|
-
* @property {string=} func The function name, or empty for anonymous functions (if guessing did not work).
|
|
14
|
-
* @property {string[]=} args The arguments passed to the function, if known.
|
|
15
|
-
* @property {number=} line The line number, if known.
|
|
16
|
-
* @property {number=} column The column number, if known.
|
|
17
|
-
* @property {string[]=} context An array of source code lines; the middle element corresponds to the correct line#.
|
|
18
|
-
* @memberof TraceKit
|
|
19
|
-
*/
|
|
20
|
-
export interface StackFrame {
|
|
21
|
-
url?: string;
|
|
22
|
-
func?: string;
|
|
23
|
-
args?: string[];
|
|
24
|
-
line?: number;
|
|
25
|
-
column?: number;
|
|
26
|
-
context?: string[];
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* An object representing a JavaScript stack trace.
|
|
30
|
-
* @typedef {Object} StackTrace
|
|
31
|
-
* @property {string=} name The name of the thrown exception.
|
|
32
|
-
* @property {string} message The exception error message.
|
|
33
|
-
* @property {StackFrame[]} stack An array of stack frames.
|
|
34
|
-
* -- method used to collect the stack trace.
|
|
35
|
-
* @memberof TraceKit
|
|
36
|
-
*/
|
|
37
|
-
export interface StackTrace {
|
|
38
|
-
name?: string;
|
|
39
|
-
message?: string;
|
|
40
|
-
url?: string;
|
|
41
|
-
stack: StackFrame[];
|
|
42
|
-
incomplete?: boolean;
|
|
43
|
-
partial?: boolean;
|
|
44
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/domain/tracekit/types.ts"],"names":[],"mappings":""}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { computeBytesCount } from '../utils/byteUtils';
|
|
2
|
-
import type { CustomerDataType } from './heavyCustomerDataWarning';
|
|
3
|
-
import type { Context } from './context';
|
|
4
|
-
export declare const BYTES_COMPUTATION_THROTTLING_DELAY = 200;
|
|
5
|
-
export type ContextManager = ReturnType<typeof createContextManager>;
|
|
6
|
-
export declare function createContextManager(customerDataType: CustomerDataType, computeBytesCountImpl?: typeof computeBytesCount): {
|
|
7
|
-
getBytesCount: () => number;
|
|
8
|
-
/** @deprecated use getContext instead */
|
|
9
|
-
get: () => Context;
|
|
10
|
-
/** @deprecated use setContextProperty instead */
|
|
11
|
-
add: (key: string, value: any) => void;
|
|
12
|
-
/** @deprecated renamed to removeContextProperty */
|
|
13
|
-
remove: (key: string) => void;
|
|
14
|
-
/** @deprecated use setContext instead */
|
|
15
|
-
set: (newContext: object) => void;
|
|
16
|
-
getContext: () => Context;
|
|
17
|
-
setContext: (newContext: Context) => void;
|
|
18
|
-
setContextProperty: (key: string, property: any) => void;
|
|
19
|
-
removeContextProperty: (key: string) => void;
|
|
20
|
-
clearContext: () => void;
|
|
21
|
-
};
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { computeBytesCount } from '../utils/byteUtils';
|
|
2
|
-
import { throttle } from '../utils/functionUtils';
|
|
3
|
-
import { deepClone } from '../mergeInto';
|
|
4
|
-
import { getType } from '../utils/typeUtils';
|
|
5
|
-
import { jsonStringify } from './jsonStringify';
|
|
6
|
-
import { sanitize } from './sanitize';
|
|
7
|
-
import { warnIfCustomerDataLimitReached } from './heavyCustomerDataWarning';
|
|
8
|
-
export var BYTES_COMPUTATION_THROTTLING_DELAY = 200;
|
|
9
|
-
export function createContextManager(customerDataType, computeBytesCountImpl) {
|
|
10
|
-
if (computeBytesCountImpl === void 0) { computeBytesCountImpl = computeBytesCount; }
|
|
11
|
-
var context = {};
|
|
12
|
-
var bytesCountCache;
|
|
13
|
-
var alreadyWarned = false;
|
|
14
|
-
// Throttle the bytes computation to minimize the impact on performance.
|
|
15
|
-
// Especially useful if the user call context APIs synchronously multiple times in a row
|
|
16
|
-
var computeBytesCountThrottled = throttle(function (context) {
|
|
17
|
-
bytesCountCache = computeBytesCountImpl(jsonStringify(context));
|
|
18
|
-
if (!alreadyWarned) {
|
|
19
|
-
alreadyWarned = warnIfCustomerDataLimitReached(bytesCountCache, customerDataType);
|
|
20
|
-
}
|
|
21
|
-
}, BYTES_COMPUTATION_THROTTLING_DELAY).throttled;
|
|
22
|
-
var contextManager = {
|
|
23
|
-
getBytesCount: function () { return bytesCountCache; },
|
|
24
|
-
/** @deprecated use getContext instead */
|
|
25
|
-
get: function () { return context; },
|
|
26
|
-
/** @deprecated use setContextProperty instead */
|
|
27
|
-
add: function (key, value) {
|
|
28
|
-
context[key] = value;
|
|
29
|
-
computeBytesCountThrottled(context);
|
|
30
|
-
},
|
|
31
|
-
/** @deprecated renamed to removeContextProperty */
|
|
32
|
-
remove: function (key) {
|
|
33
|
-
delete context[key];
|
|
34
|
-
computeBytesCountThrottled(context);
|
|
35
|
-
},
|
|
36
|
-
/** @deprecated use setContext instead */
|
|
37
|
-
set: function (newContext) {
|
|
38
|
-
context = newContext;
|
|
39
|
-
computeBytesCountThrottled(context);
|
|
40
|
-
},
|
|
41
|
-
getContext: function () { return deepClone(context); },
|
|
42
|
-
setContext: function (newContext) {
|
|
43
|
-
if (getType(newContext) === 'object') {
|
|
44
|
-
context = sanitize(newContext);
|
|
45
|
-
computeBytesCountThrottled(context);
|
|
46
|
-
}
|
|
47
|
-
else {
|
|
48
|
-
contextManager.clearContext();
|
|
49
|
-
}
|
|
50
|
-
},
|
|
51
|
-
setContextProperty: function (key, property) {
|
|
52
|
-
context[key] = sanitize(property);
|
|
53
|
-
computeBytesCountThrottled(context);
|
|
54
|
-
},
|
|
55
|
-
removeContextProperty: function (key) {
|
|
56
|
-
delete context[key];
|
|
57
|
-
computeBytesCountThrottled(context);
|
|
58
|
-
},
|
|
59
|
-
clearContext: function () {
|
|
60
|
-
context = {};
|
|
61
|
-
bytesCountCache = 0;
|
|
62
|
-
},
|
|
63
|
-
};
|
|
64
|
-
return contextManager;
|
|
65
|
-
}
|
|
66
|
-
//# sourceMappingURL=contextManager.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"contextManager.js","sourceRoot":"","sources":["../../../src/tools/serialisation/contextManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAA;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAA;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AACrC,OAAO,EAAE,8BAA8B,EAAE,MAAM,4BAA4B,CAAA;AAI3E,MAAM,CAAC,IAAM,kCAAkC,GAAG,GAAG,CAAA;AAIrD,MAAM,UAAU,oBAAoB,CAAC,gBAAkC,EAAE,qBAAyC;IAAzC,sCAAA,EAAA,yCAAyC;IAChH,IAAI,OAAO,GAAY,EAAE,CAAA;IACzB,IAAI,eAAuB,CAAA;IAC3B,IAAI,aAAa,GAAG,KAAK,CAAA;IAEzB,wEAAwE;IACxE,wFAAwF;IAChF,IAAW,0BAA0B,GAAK,QAAQ,CAAC,UAAC,OAAgB;QAC1E,eAAe,GAAG,qBAAqB,CAAC,aAAa,CAAC,OAAO,CAAE,CAAC,CAAA;QAChE,IAAI,CAAC,aAAa,EAAE;YAClB,aAAa,GAAG,8BAA8B,CAAC,eAAe,EAAE,gBAAgB,CAAC,CAAA;SAClF;IACH,CAAC,EAAE,kCAAkC,CAAC,UALO,CAKP;IAEtC,IAAM,cAAc,GAAG;QACrB,aAAa,EAAE,cAAM,OAAA,eAAe,EAAf,CAAe;QACpC,yCAAyC;QACzC,GAAG,EAAE,cAAM,OAAA,OAAO,EAAP,CAAO;QAElB,iDAAiD;QACjD,GAAG,EAAE,UAAC,GAAW,EAAE,KAAU;YAC3B,OAAO,CAAC,GAAG,CAAC,GAAG,KAAqB,CAAA;YACpC,0BAA0B,CAAC,OAAO,CAAC,CAAA;QACrC,CAAC;QAED,mDAAmD;QACnD,MAAM,EAAE,UAAC,GAAW;YAClB,OAAO,OAAO,CAAC,GAAG,CAAC,CAAA;YACnB,0BAA0B,CAAC,OAAO,CAAC,CAAA;QACrC,CAAC;QAED,yCAAyC;QACzC,GAAG,EAAE,UAAC,UAAkB;YACtB,OAAO,GAAG,UAAqB,CAAA;YAC/B,0BAA0B,CAAC,OAAO,CAAC,CAAA;QACrC,CAAC;QAED,UAAU,EAAE,cAAM,OAAA,SAAS,CAAC,OAAO,CAAC,EAAlB,CAAkB;QAEpC,UAAU,EAAE,UAAC,UAAmB;YAC9B,IAAI,OAAO,CAAC,UAAU,CAAC,KAAK,QAAQ,EAAE;gBACpC,OAAO,GAAG,QAAQ,CAAC,UAAU,CAAC,CAAA;gBAC9B,0BAA0B,CAAC,OAAO,CAAC,CAAA;aACpC;iBAAM;gBACL,cAAc,CAAC,YAAY,EAAE,CAAA;aAC9B;QACH,CAAC;QAED,kBAAkB,EAAE,UAAC,GAAW,EAAE,QAAa;YAC7C,OAAO,CAAC,GAAG,CAAC,GAAG,QAAQ,CAAC,QAAQ,CAAC,CAAA;YACjC,0BAA0B,CAAC,OAAO,CAAC,CAAA;QACrC,CAAC;QAED,qBAAqB,EAAE,UAAC,GAAW;YACjC,OAAO,OAAO,CAAC,GAAG,CAAC,CAAA;YACnB,0BAA0B,CAAC,OAAO,CAAC,CAAA;QACrC,CAAC;QAED,YAAY,EAAE;YACZ,OAAO,GAAG,EAAE,CAAA;YACZ,eAAe,GAAG,CAAC,CAAA;QACrB,CAAC;KACF,CAAA;IACD,OAAO,cAAc,CAAA;AACvB,CAAC"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export declare const CUSTOMER_DATA_BYTES_LIMIT: number;
|
|
2
|
-
export declare const enum CustomerDataType {
|
|
3
|
-
FeatureFlag = "feature flag evaluation",
|
|
4
|
-
User = "user",
|
|
5
|
-
GlobalContext = "global context",
|
|
6
|
-
LoggerContext = "logger context"
|
|
7
|
-
}
|
|
8
|
-
export declare function warnIfCustomerDataLimitReached(bytesCount: number, customerDataType: CustomerDataType): boolean;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { ONE_KIBI_BYTE } from '../utils/byteUtils';
|
|
2
|
-
import { display } from '../display';
|
|
3
|
-
// RUM and logs batch bytes limit is 16KB
|
|
4
|
-
// ensure that we leave room for other event attributes and maintain a decent amount of event per batch
|
|
5
|
-
// (3KB (customer data) + 1KB (other attributes)) * 4 (events per batch) = 16KB
|
|
6
|
-
export var CUSTOMER_DATA_BYTES_LIMIT = 3 * ONE_KIBI_BYTE;
|
|
7
|
-
export function warnIfCustomerDataLimitReached(bytesCount, customerDataType) {
|
|
8
|
-
if (bytesCount > CUSTOMER_DATA_BYTES_LIMIT) {
|
|
9
|
-
display.warn("The ".concat(customerDataType, " data exceeds the recommended ").concat(CUSTOMER_DATA_BYTES_LIMIT / ONE_KIBI_BYTE, "KiB threshold. More details: https://docs.datadoghq.com/real_user_monitoring/browser/troubleshooting/#customer-data-exceeds-the-recommended-3kib-warning"));
|
|
10
|
-
return true;
|
|
11
|
-
}
|
|
12
|
-
return false;
|
|
13
|
-
}
|
|
14
|
-
//# sourceMappingURL=heavyCustomerDataWarning.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"heavyCustomerDataWarning.js","sourceRoot":"","sources":["../../../src/tools/serialisation/heavyCustomerDataWarning.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AAEpC,yCAAyC;AACzC,uGAAuG;AACvG,+EAA+E;AAC/E,MAAM,CAAC,IAAM,yBAAyB,GAAG,CAAC,GAAG,aAAa,CAAA;AAS1D,MAAM,UAAU,8BAA8B,CAAC,UAAkB,EAAE,gBAAkC;IACnG,IAAI,UAAU,GAAG,yBAAyB,EAAE;QAC1C,OAAO,CAAC,IAAI,CACV,cAAO,gBAAgB,2CACrB,yBAAyB,GAAG,aAAa,6JAC+G,CAC3J,CAAA;QACD,OAAO,IAAI,CAAA;KACZ;IACD,OAAO,KAAK,CAAA;AACd,CAAC"}
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
import { instrumentMethodAndCallOriginal } from '../../tools/instrumentMethod'
|
|
2
|
-
import { computeStackTrace } from './computeStackTrace'
|
|
3
|
-
import type { UnhandledErrorCallback, StackTrace } from './types'
|
|
4
|
-
|
|
5
|
-
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error#Error_types
|
|
6
|
-
const ERROR_TYPES_RE =
|
|
7
|
-
/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?([\s\S]*)$/
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Cross-browser collection of unhandled errors
|
|
11
|
-
*
|
|
12
|
-
* Supports:
|
|
13
|
-
* - Firefox: full stack trace with line numbers, plus column number
|
|
14
|
-
* on top frame; column number is not guaranteed
|
|
15
|
-
* - Opera: full stack trace with line and column numbers
|
|
16
|
-
* - Chrome: full stack trace with line and column numbers
|
|
17
|
-
* - Safari: line and column number for the top frame only; some frames
|
|
18
|
-
* may be missing, and column number is not guaranteed
|
|
19
|
-
* - IE: line and column number for the top frame only; some frames
|
|
20
|
-
* may be missing, and column number is not guaranteed
|
|
21
|
-
*
|
|
22
|
-
* In theory, TraceKit should work on all of the following versions:
|
|
23
|
-
* - IE5.5+ (only 8.0 tested)
|
|
24
|
-
* - Firefox 0.9+ (only 3.5+ tested)
|
|
25
|
-
* - Opera 7+ (only 10.50 tested; versions 9 and earlier may require
|
|
26
|
-
* Exceptions Have Stacktrace to be enabled in opera:config)
|
|
27
|
-
* - Safari 3+ (only 4+ tested)
|
|
28
|
-
* - Chrome 1+ (only 5+ tested)
|
|
29
|
-
* - Konqueror 3.5+ (untested)
|
|
30
|
-
*
|
|
31
|
-
* Tries to catch all unhandled errors and report them to the
|
|
32
|
-
* callback.
|
|
33
|
-
*
|
|
34
|
-
* Callbacks receive a StackTrace object as described in the
|
|
35
|
-
* computeStackTrace docs.
|
|
36
|
-
*
|
|
37
|
-
* @memberof TraceKit
|
|
38
|
-
* @namespace
|
|
39
|
-
*/
|
|
40
|
-
|
|
41
|
-
export function startUnhandledErrorCollection(callback: UnhandledErrorCallback) {
|
|
42
|
-
const { stop: stopInstrumentingOnError } = instrumentOnError(callback)
|
|
43
|
-
const { stop: stopInstrumentingOnUnhandledRejection } = instrumentUnhandledRejection(callback)
|
|
44
|
-
|
|
45
|
-
return {
|
|
46
|
-
stop: () => {
|
|
47
|
-
stopInstrumentingOnError()
|
|
48
|
-
stopInstrumentingOnUnhandledRejection()
|
|
49
|
-
},
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* Install a global onerror handler
|
|
55
|
-
*/
|
|
56
|
-
function instrumentOnError(callback: UnhandledErrorCallback) {
|
|
57
|
-
return instrumentMethodAndCallOriginal(window, 'onerror', {
|
|
58
|
-
before(this: any, messageObj: unknown, url?: string, line?: number, column?: number, errorObj?: unknown) {
|
|
59
|
-
let stackTrace: StackTrace
|
|
60
|
-
if (errorObj instanceof Error) {
|
|
61
|
-
stackTrace = computeStackTrace(errorObj)
|
|
62
|
-
} else {
|
|
63
|
-
const stack = [{ url, column, line }]
|
|
64
|
-
const { name, message } = tryToParseMessage(messageObj)
|
|
65
|
-
stackTrace = {
|
|
66
|
-
name,
|
|
67
|
-
message,
|
|
68
|
-
stack,
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
callback(stackTrace, errorObj ?? messageObj)
|
|
72
|
-
},
|
|
73
|
-
})
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
function tryToParseMessage(messageObj: unknown) {
|
|
77
|
-
let name
|
|
78
|
-
let message
|
|
79
|
-
if ({}.toString.call(messageObj) === '[object String]') {
|
|
80
|
-
;[, name, message] = ERROR_TYPES_RE.exec(messageObj as string)!
|
|
81
|
-
}
|
|
82
|
-
return { name, message }
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* Install a global onunhandledrejection handler
|
|
87
|
-
*/
|
|
88
|
-
function instrumentUnhandledRejection(callback: UnhandledErrorCallback) {
|
|
89
|
-
return instrumentMethodAndCallOriginal(window, 'onunhandledrejection', {
|
|
90
|
-
before(e: PromiseRejectionEvent) {
|
|
91
|
-
const reason = e.reason || 'Empty reason'
|
|
92
|
-
const stack = computeStackTrace(reason)
|
|
93
|
-
callback(stack, reason)
|
|
94
|
-
},
|
|
95
|
-
})
|
|
96
|
-
}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
export interface BrowserError extends Error {
|
|
2
|
-
sourceURL?: string
|
|
3
|
-
fileName?: string
|
|
4
|
-
line?: string | number
|
|
5
|
-
lineNumber?: string | number
|
|
6
|
-
description?: string
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export type UnhandledErrorCallback = (stack: StackTrace, errorObject?: any) => any
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* An object representing a single stack frame.
|
|
13
|
-
* @typedef {Object} StackFrame
|
|
14
|
-
* @property {string=} url The JavaScript or HTML file URL.
|
|
15
|
-
* @property {string=} func The function name, or empty for anonymous functions (if guessing did not work).
|
|
16
|
-
* @property {string[]=} args The arguments passed to the function, if known.
|
|
17
|
-
* @property {number=} line The line number, if known.
|
|
18
|
-
* @property {number=} column The column number, if known.
|
|
19
|
-
* @property {string[]=} context An array of source code lines; the middle element corresponds to the correct line#.
|
|
20
|
-
* @memberof TraceKit
|
|
21
|
-
*/
|
|
22
|
-
export interface StackFrame {
|
|
23
|
-
url?: string
|
|
24
|
-
func?: string
|
|
25
|
-
args?: string[]
|
|
26
|
-
line?: number
|
|
27
|
-
column?: number
|
|
28
|
-
context?: string[]
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* An object representing a JavaScript stack trace.
|
|
33
|
-
* @typedef {Object} StackTrace
|
|
34
|
-
* @property {string=} name The name of the thrown exception.
|
|
35
|
-
* @property {string} message The exception error message.
|
|
36
|
-
* @property {StackFrame[]} stack An array of stack frames.
|
|
37
|
-
* -- method used to collect the stack trace.
|
|
38
|
-
* @memberof TraceKit
|
|
39
|
-
*/
|
|
40
|
-
export interface StackTrace {
|
|
41
|
-
name?: string
|
|
42
|
-
message?: string
|
|
43
|
-
url?: string
|
|
44
|
-
stack: StackFrame[]
|
|
45
|
-
incomplete?: boolean
|
|
46
|
-
partial?: boolean
|
|
47
|
-
}
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import { computeBytesCount } from '../utils/byteUtils'
|
|
2
|
-
import { throttle } from '../utils/functionUtils'
|
|
3
|
-
import { deepClone } from '../mergeInto'
|
|
4
|
-
import { getType } from '../utils/typeUtils'
|
|
5
|
-
import { jsonStringify } from './jsonStringify'
|
|
6
|
-
import { sanitize } from './sanitize'
|
|
7
|
-
import { warnIfCustomerDataLimitReached } from './heavyCustomerDataWarning'
|
|
8
|
-
import type { CustomerDataType } from './heavyCustomerDataWarning'
|
|
9
|
-
import type { Context, ContextValue } from './context'
|
|
10
|
-
|
|
11
|
-
export const BYTES_COMPUTATION_THROTTLING_DELAY = 200
|
|
12
|
-
|
|
13
|
-
export type ContextManager = ReturnType<typeof createContextManager>
|
|
14
|
-
|
|
15
|
-
export function createContextManager(customerDataType: CustomerDataType, computeBytesCountImpl = computeBytesCount) {
|
|
16
|
-
let context: Context = {}
|
|
17
|
-
let bytesCountCache: number
|
|
18
|
-
let alreadyWarned = false
|
|
19
|
-
|
|
20
|
-
// Throttle the bytes computation to minimize the impact on performance.
|
|
21
|
-
// Especially useful if the user call context APIs synchronously multiple times in a row
|
|
22
|
-
const { throttled: computeBytesCountThrottled } = throttle((context: Context) => {
|
|
23
|
-
bytesCountCache = computeBytesCountImpl(jsonStringify(context)!)
|
|
24
|
-
if (!alreadyWarned) {
|
|
25
|
-
alreadyWarned = warnIfCustomerDataLimitReached(bytesCountCache, customerDataType)
|
|
26
|
-
}
|
|
27
|
-
}, BYTES_COMPUTATION_THROTTLING_DELAY)
|
|
28
|
-
|
|
29
|
-
const contextManager = {
|
|
30
|
-
getBytesCount: () => bytesCountCache,
|
|
31
|
-
/** @deprecated use getContext instead */
|
|
32
|
-
get: () => context,
|
|
33
|
-
|
|
34
|
-
/** @deprecated use setContextProperty instead */
|
|
35
|
-
add: (key: string, value: any) => {
|
|
36
|
-
context[key] = value as ContextValue
|
|
37
|
-
computeBytesCountThrottled(context)
|
|
38
|
-
},
|
|
39
|
-
|
|
40
|
-
/** @deprecated renamed to removeContextProperty */
|
|
41
|
-
remove: (key: string) => {
|
|
42
|
-
delete context[key]
|
|
43
|
-
computeBytesCountThrottled(context)
|
|
44
|
-
},
|
|
45
|
-
|
|
46
|
-
/** @deprecated use setContext instead */
|
|
47
|
-
set: (newContext: object) => {
|
|
48
|
-
context = newContext as Context
|
|
49
|
-
computeBytesCountThrottled(context)
|
|
50
|
-
},
|
|
51
|
-
|
|
52
|
-
getContext: () => deepClone(context),
|
|
53
|
-
|
|
54
|
-
setContext: (newContext: Context) => {
|
|
55
|
-
if (getType(newContext) === 'object') {
|
|
56
|
-
context = sanitize(newContext)
|
|
57
|
-
computeBytesCountThrottled(context)
|
|
58
|
-
} else {
|
|
59
|
-
contextManager.clearContext()
|
|
60
|
-
}
|
|
61
|
-
},
|
|
62
|
-
|
|
63
|
-
setContextProperty: (key: string, property: any) => {
|
|
64
|
-
context[key] = sanitize(property)
|
|
65
|
-
computeBytesCountThrottled(context)
|
|
66
|
-
},
|
|
67
|
-
|
|
68
|
-
removeContextProperty: (key: string) => {
|
|
69
|
-
delete context[key]
|
|
70
|
-
computeBytesCountThrottled(context)
|
|
71
|
-
},
|
|
72
|
-
|
|
73
|
-
clearContext: () => {
|
|
74
|
-
context = {}
|
|
75
|
-
bytesCountCache = 0
|
|
76
|
-
},
|
|
77
|
-
}
|
|
78
|
-
return contextManager
|
|
79
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { ONE_KIBI_BYTE } from '../utils/byteUtils'
|
|
2
|
-
import { display } from '../display'
|
|
3
|
-
|
|
4
|
-
// RUM and logs batch bytes limit is 16KB
|
|
5
|
-
// ensure that we leave room for other event attributes and maintain a decent amount of event per batch
|
|
6
|
-
// (3KB (customer data) + 1KB (other attributes)) * 4 (events per batch) = 16KB
|
|
7
|
-
export const CUSTOMER_DATA_BYTES_LIMIT = 3 * ONE_KIBI_BYTE
|
|
8
|
-
|
|
9
|
-
export const enum CustomerDataType {
|
|
10
|
-
FeatureFlag = 'feature flag evaluation',
|
|
11
|
-
User = 'user',
|
|
12
|
-
GlobalContext = 'global context',
|
|
13
|
-
LoggerContext = 'logger context',
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export function warnIfCustomerDataLimitReached(bytesCount: number, customerDataType: CustomerDataType): boolean {
|
|
17
|
-
if (bytesCount > CUSTOMER_DATA_BYTES_LIMIT) {
|
|
18
|
-
display.warn(
|
|
19
|
-
`The ${customerDataType} data exceeds the recommended ${
|
|
20
|
-
CUSTOMER_DATA_BYTES_LIMIT / ONE_KIBI_BYTE
|
|
21
|
-
}KiB threshold. More details: https://docs.datadoghq.com/real_user_monitoring/browser/troubleshooting/#customer-data-exceeds-the-recommended-3kib-warning`
|
|
22
|
-
)
|
|
23
|
-
return true
|
|
24
|
-
}
|
|
25
|
-
return false
|
|
26
|
-
}
|