@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
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { ONE_KIBI_BYTE, computeBytesCount } from '../../tools/utils/byteUtils'
|
|
2
|
+
import { throttle } from '../../tools/utils/functionUtils'
|
|
3
|
+
import type { Context } from '../../tools/serialisation/context'
|
|
4
|
+
import { jsonStringify } from '../../tools/serialisation/jsonStringify'
|
|
5
|
+
import { display } from '../../tools/display'
|
|
6
|
+
import { isEmptyObject } from '../../tools/utils/objectUtils'
|
|
7
|
+
import type { CustomerDataType } from './contextConstants'
|
|
8
|
+
|
|
9
|
+
// RUM and logs batch bytes limit is 16KB
|
|
10
|
+
// ensure that we leave room for other event attributes and maintain a decent amount of event per batch
|
|
11
|
+
// (3KB (customer data) + 1KB (other attributes)) * 4 (events per batch) = 16KB
|
|
12
|
+
export const CUSTOMER_DATA_BYTES_LIMIT = 3 * ONE_KIBI_BYTE
|
|
13
|
+
|
|
14
|
+
// We observed that the compression ratio is around 8 in general, but we also want to keep a margin
|
|
15
|
+
// because some data might not be compressed (ex: last view update on page exit). We chose 16KiB
|
|
16
|
+
// because it is also the limit of the 'batchBytesCount' that we use for RUM and Logs data, but this
|
|
17
|
+
// is a bit arbitrary.
|
|
18
|
+
export const CUSTOMER_COMPRESSED_DATA_BYTES_LIMIT = 16 * ONE_KIBI_BYTE
|
|
19
|
+
|
|
20
|
+
export const BYTES_COMPUTATION_THROTTLING_DELAY = 200
|
|
21
|
+
|
|
22
|
+
export type CustomerDataTracker = ReturnType<typeof createCustomerDataTracker>
|
|
23
|
+
export type CustomerDataTrackerManager = ReturnType<typeof createCustomerDataTrackerManager>
|
|
24
|
+
|
|
25
|
+
export const enum CustomerDataCompressionStatus {
|
|
26
|
+
Unknown,
|
|
27
|
+
Enabled,
|
|
28
|
+
Disabled,
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export function createCustomerDataTrackerManager(
|
|
32
|
+
compressionStatus: CustomerDataCompressionStatus = CustomerDataCompressionStatus.Disabled
|
|
33
|
+
) {
|
|
34
|
+
const customerDataTrackers = new Map<CustomerDataType, CustomerDataTracker>()
|
|
35
|
+
|
|
36
|
+
let alreadyWarned = false
|
|
37
|
+
function checkCustomerDataLimit(initialBytesCount = 0) {
|
|
38
|
+
if (alreadyWarned || compressionStatus === CustomerDataCompressionStatus.Unknown) {
|
|
39
|
+
return
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const bytesCountLimit =
|
|
43
|
+
compressionStatus === CustomerDataCompressionStatus.Disabled
|
|
44
|
+
? CUSTOMER_DATA_BYTES_LIMIT
|
|
45
|
+
: CUSTOMER_COMPRESSED_DATA_BYTES_LIMIT
|
|
46
|
+
|
|
47
|
+
let bytesCount = initialBytesCount
|
|
48
|
+
customerDataTrackers.forEach((tracker) => {
|
|
49
|
+
bytesCount += tracker.getBytesCount()
|
|
50
|
+
})
|
|
51
|
+
|
|
52
|
+
if (bytesCount > bytesCountLimit) {
|
|
53
|
+
displayCustomerDataLimitReachedWarning(bytesCountLimit)
|
|
54
|
+
alreadyWarned = true
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return {
|
|
59
|
+
/**
|
|
60
|
+
* Creates a detached tracker. The manager will not store a reference to that tracker, and the
|
|
61
|
+
* bytes count will be counted independently from other detached trackers.
|
|
62
|
+
*
|
|
63
|
+
* This is particularly useful when we don't know when the tracker will be unused, so we don't
|
|
64
|
+
* leak memory (ex: when used in Logger instances).
|
|
65
|
+
*/
|
|
66
|
+
createDetachedTracker: () => {
|
|
67
|
+
const tracker = createCustomerDataTracker(() => checkCustomerDataLimit(tracker.getBytesCount()))
|
|
68
|
+
return tracker
|
|
69
|
+
},
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Creates a tracker if it doesn't exist, and returns it.
|
|
73
|
+
*/
|
|
74
|
+
getOrCreateTracker: (type: CustomerDataType) => {
|
|
75
|
+
if (!customerDataTrackers.has(type)) {
|
|
76
|
+
customerDataTrackers.set(type, createCustomerDataTracker(checkCustomerDataLimit))
|
|
77
|
+
}
|
|
78
|
+
return customerDataTrackers.get(type)!
|
|
79
|
+
},
|
|
80
|
+
|
|
81
|
+
setCompressionStatus: (newCompressionStatus: CustomerDataCompressionStatus) => {
|
|
82
|
+
if (compressionStatus === CustomerDataCompressionStatus.Unknown) {
|
|
83
|
+
compressionStatus = newCompressionStatus
|
|
84
|
+
checkCustomerDataLimit()
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
|
|
88
|
+
getCompressionStatus: () => compressionStatus,
|
|
89
|
+
|
|
90
|
+
stop: () => {
|
|
91
|
+
customerDataTrackers.forEach((tracker) => tracker.stop())
|
|
92
|
+
customerDataTrackers.clear()
|
|
93
|
+
},
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export function createCustomerDataTracker(checkCustomerDataLimit: () => void) {
|
|
98
|
+
let bytesCountCache = 0
|
|
99
|
+
|
|
100
|
+
// Throttle the bytes computation to minimize the impact on performance.
|
|
101
|
+
// Especially useful if the user call context APIs synchronously multiple times in a row
|
|
102
|
+
const { throttled: computeBytesCountThrottled, cancel: cancelComputeBytesCount } = throttle((context: Context) => {
|
|
103
|
+
bytesCountCache = computeBytesCount(jsonStringify(context)!)
|
|
104
|
+
checkCustomerDataLimit()
|
|
105
|
+
}, BYTES_COMPUTATION_THROTTLING_DELAY)
|
|
106
|
+
|
|
107
|
+
const resetBytesCount = () => {
|
|
108
|
+
cancelComputeBytesCount()
|
|
109
|
+
bytesCountCache = 0
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
return {
|
|
113
|
+
updateCustomerData: (context: Context) => {
|
|
114
|
+
if (isEmptyObject(context)) {
|
|
115
|
+
resetBytesCount()
|
|
116
|
+
} else {
|
|
117
|
+
computeBytesCountThrottled(context)
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
resetCustomerData: resetBytesCount,
|
|
121
|
+
getBytesCount: () => bytesCountCache,
|
|
122
|
+
stop: () => {
|
|
123
|
+
cancelComputeBytesCount()
|
|
124
|
+
},
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
function displayCustomerDataLimitReachedWarning(bytesCountLimit: number) {
|
|
129
|
+
display.warn(
|
|
130
|
+
`Customer data exceeds the recommended ${
|
|
131
|
+
bytesCountLimit / ONE_KIBI_BYTE
|
|
132
|
+
}KiB threshold. More details: https://docs.datadoghq.com/real_user_monitoring/browser/troubleshooting/#customer-data-exceeds-the-recommended-threshold-warning`
|
|
133
|
+
)
|
|
134
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { addEventListener, DOM_EVENT } from '../../browser/addEventListener'
|
|
2
|
+
import type { Context } from '../../tools/serialisation/context'
|
|
3
|
+
import type { Configuration } from '../configuration'
|
|
4
|
+
import { combine } from '../../tools/mergeInto'
|
|
5
|
+
import type { ContextManager } from './contextManager'
|
|
6
|
+
import type { CustomerDataType } from './contextConstants'
|
|
7
|
+
|
|
8
|
+
const CONTEXT_STORE_KEY_PREFIX = '_oo_c'
|
|
9
|
+
|
|
10
|
+
const storageListeners: Array<{ stop: () => void }> = []
|
|
11
|
+
|
|
12
|
+
export function storeContextManager(
|
|
13
|
+
configuration: Configuration,
|
|
14
|
+
contextManager: ContextManager,
|
|
15
|
+
productKey: string,
|
|
16
|
+
customerDataType: CustomerDataType
|
|
17
|
+
) {
|
|
18
|
+
const storageKey = buildStorageKey(productKey, customerDataType)
|
|
19
|
+
|
|
20
|
+
storageListeners.push(
|
|
21
|
+
addEventListener(configuration, window, DOM_EVENT.STORAGE, ({ key }) => {
|
|
22
|
+
if (storageKey === key) {
|
|
23
|
+
synchronizeWithStorage()
|
|
24
|
+
}
|
|
25
|
+
})
|
|
26
|
+
)
|
|
27
|
+
contextManager.changeObservable.subscribe(dumpToStorage)
|
|
28
|
+
|
|
29
|
+
contextManager.setContext(combine(getFromStorage(), contextManager.getContext()))
|
|
30
|
+
|
|
31
|
+
function synchronizeWithStorage() {
|
|
32
|
+
contextManager.setContext(getFromStorage())
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function dumpToStorage() {
|
|
36
|
+
localStorage.setItem(storageKey, JSON.stringify(contextManager.getContext()))
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function getFromStorage() {
|
|
40
|
+
const rawContext = localStorage.getItem(storageKey)
|
|
41
|
+
return rawContext !== null ? (JSON.parse(rawContext) as Context) : {}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export function buildStorageKey(productKey: string, customerDataType: CustomerDataType) {
|
|
46
|
+
return `${CONTEXT_STORE_KEY_PREFIX}_${productKey}_${customerDataType}`
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export function removeStorageListeners() {
|
|
50
|
+
storageListeners.map((listener) => listener.stop())
|
|
51
|
+
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { Encoder } from '../../tools/encoder'
|
|
2
|
+
|
|
1
3
|
export type DeflateWorkerAction =
|
|
2
4
|
// Action to send when creating the worker to check if the communication is working correctly.
|
|
3
5
|
// The worker should respond with a 'initialized' response.
|
|
@@ -39,3 +41,15 @@ export type DeflateWorkerResponse =
|
|
|
39
41
|
streamId?: number
|
|
40
42
|
error: Error | string
|
|
41
43
|
}
|
|
44
|
+
|
|
45
|
+
export interface DeflateWorker extends Worker {
|
|
46
|
+
postMessage(message: DeflateWorkerAction): void
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export type DeflateEncoder = Encoder<Uint8Array> & { stop: () => void }
|
|
50
|
+
|
|
51
|
+
export const enum DeflateEncoderStreamId {
|
|
52
|
+
REPLAY = 1,
|
|
53
|
+
RUM = 2,
|
|
54
|
+
RUM_REPLICA = 3,
|
|
55
|
+
}
|
|
@@ -1,11 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cross-browser stack trace computation.
|
|
3
|
+
*
|
|
4
|
+
* Reference implementation: https://github.com/csnover/TraceKit/blob/04530298073c3823de72deb0b97e7b38ca7bcb59/tracekit.js
|
|
5
|
+
*/
|
|
6
|
+
|
|
1
7
|
import { startsWith } from '../../tools/utils/polyfills'
|
|
2
|
-
|
|
8
|
+
|
|
9
|
+
export interface StackFrame {
|
|
10
|
+
url?: string
|
|
11
|
+
func?: string
|
|
12
|
+
/** The arguments passed to the function, if known. */
|
|
13
|
+
args?: string[]
|
|
14
|
+
line?: number
|
|
15
|
+
column?: number
|
|
16
|
+
/** An array of source code lines; the middle element corresponds to the correct line. */
|
|
17
|
+
context?: string[]
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface StackTrace {
|
|
21
|
+
name?: string
|
|
22
|
+
message?: string
|
|
23
|
+
url?: string
|
|
24
|
+
stack: StackFrame[]
|
|
25
|
+
incomplete?: boolean
|
|
26
|
+
partial?: boolean
|
|
27
|
+
}
|
|
3
28
|
|
|
4
29
|
const UNKNOWN_FUNCTION = '?'
|
|
5
30
|
|
|
6
|
-
/**
|
|
7
|
-
* Computes a stack trace for an exception.
|
|
8
|
-
*/
|
|
9
31
|
export function computeStackTrace(ex: unknown): StackTrace {
|
|
10
32
|
const stack: StackFrame[] = []
|
|
11
33
|
|
|
@@ -139,3 +161,26 @@ function tryToGetString(candidate: unknown, property: string) {
|
|
|
139
161
|
const value = (candidate as { [k: string]: unknown })[property]
|
|
140
162
|
return typeof value === 'string' ? value : undefined
|
|
141
163
|
}
|
|
164
|
+
|
|
165
|
+
export function computeStackTraceFromOnErrorMessage(messageObj: unknown, url?: string, line?: number, column?: number) {
|
|
166
|
+
const stack = [{ url, column, line }]
|
|
167
|
+
const { name, message } = tryToParseMessage(messageObj)
|
|
168
|
+
return {
|
|
169
|
+
name,
|
|
170
|
+
message,
|
|
171
|
+
stack,
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error#Error_types
|
|
176
|
+
const ERROR_TYPES_RE =
|
|
177
|
+
/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?([\s\S]*)$/
|
|
178
|
+
|
|
179
|
+
function tryToParseMessage(messageObj: unknown) {
|
|
180
|
+
let name
|
|
181
|
+
let message
|
|
182
|
+
if ({}.toString.call(messageObj) === '[object String]') {
|
|
183
|
+
;[, name, message] = ERROR_TYPES_RE.exec(messageObj as string)!
|
|
184
|
+
}
|
|
185
|
+
return { name, message }
|
|
186
|
+
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import type { StackTrace } from '../tracekit'
|
|
2
|
-
import { computeStackTrace } from '../tracekit'
|
|
3
1
|
import { callMonitored } from '../../tools/monitor'
|
|
4
2
|
import { sanitize } from '../../tools/serialisation/sanitize'
|
|
5
3
|
import type { ClocksState } from '../../tools/utils/timeUtils'
|
|
6
4
|
import { noop } from '../../tools/utils/functionUtils'
|
|
7
5
|
import { jsonStringify } from '../../tools/serialisation/jsonStringify'
|
|
8
6
|
import type { ErrorSource, ErrorHandling, RawError, RawErrorCause, ErrorWithCause, NonErrorPrefix } from './error.types'
|
|
7
|
+
import type { StackTrace } from './computeStackTrace'
|
|
8
|
+
import { computeStackTrace } from './computeStackTrace'
|
|
9
9
|
|
|
10
10
|
export const NO_ERROR_STACK_PRESENT_MESSAGE = 'No stack, consider using an instance of Error'
|
|
11
11
|
|
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
import type { ClocksState } from '../../tools/utils/timeUtils'
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
// TS v4.6 introduced Error.cause[1] typed as `Error`. TS v4.8 changed Error.cause to be
|
|
4
|
+
// `unknown`[2].
|
|
5
|
+
//
|
|
6
|
+
// Because we still support TS 3.8, we need to declare our own type. We can remove it once we drop
|
|
7
|
+
// support for TS v4.7 and before. The 'cause' property defined by TS needs to be omitted because
|
|
8
|
+
// we define it with a type `unknown` which is incompatible with TS 4.6 and 4.7.
|
|
9
|
+
//
|
|
10
|
+
// [1]: https://devblogs.microsoft.com/typescript/announcing-typescript-4-6/#target-es2022
|
|
11
|
+
// [2]: https://devblogs.microsoft.com/typescript/announcing-typescript-4-8/#lib-d-ts-updates
|
|
12
|
+
export interface ErrorWithCause extends Omit<Error, 'cause'> {
|
|
13
|
+
cause?: unknown
|
|
5
14
|
}
|
|
6
15
|
|
|
7
16
|
export type RawErrorCause = {
|
|
@@ -1,21 +1,53 @@
|
|
|
1
|
+
import { instrumentMethod } from '../../tools/instrumentMethod'
|
|
1
2
|
import type { Observable } from '../../tools/observable'
|
|
2
3
|
import { clocksNow } from '../../tools/utils/timeUtils'
|
|
3
|
-
import {
|
|
4
|
+
import type { StackTrace } from './computeStackTrace'
|
|
5
|
+
import { computeStackTrace, computeStackTraceFromOnErrorMessage } from './computeStackTrace'
|
|
4
6
|
import { computeRawError } from './error'
|
|
5
7
|
import type { RawError } from './error.types'
|
|
6
8
|
import { ErrorHandling, ErrorSource, NonErrorPrefix } from './error.types'
|
|
7
9
|
|
|
10
|
+
export type UnhandledErrorCallback = (stackTrace: StackTrace, originalError?: any) => any
|
|
11
|
+
|
|
8
12
|
export function trackRuntimeError(errorObservable: Observable<RawError>) {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
13
|
+
const handleRuntimeError = (stackTrace: StackTrace, originalError?: any) => {
|
|
14
|
+
const test = computeRawError({
|
|
15
|
+
stackTrace,
|
|
16
|
+
originalError,
|
|
17
|
+
startClocks: clocksNow(),
|
|
18
|
+
nonErrorPrefix: NonErrorPrefix.UNCAUGHT,
|
|
19
|
+
source: ErrorSource.SOURCE,
|
|
20
|
+
handling: ErrorHandling.UNHANDLED,
|
|
21
|
+
})
|
|
22
|
+
errorObservable.notify(test)
|
|
23
|
+
}
|
|
24
|
+
const { stop: stopInstrumentingOnError } = instrumentOnError(handleRuntimeError)
|
|
25
|
+
const { stop: stopInstrumentingOnUnhandledRejection } = instrumentUnhandledRejection(handleRuntimeError)
|
|
26
|
+
|
|
27
|
+
return {
|
|
28
|
+
stop: () => {
|
|
29
|
+
stopInstrumentingOnError()
|
|
30
|
+
stopInstrumentingOnUnhandledRejection()
|
|
31
|
+
},
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export function instrumentOnError(callback: UnhandledErrorCallback) {
|
|
36
|
+
return instrumentMethod(window, 'onerror', ({ parameters: [messageObj, url, line, column, errorObj] }) => {
|
|
37
|
+
let stackTrace
|
|
38
|
+
if (errorObj instanceof Error) {
|
|
39
|
+
stackTrace = computeStackTrace(errorObj)
|
|
40
|
+
} else {
|
|
41
|
+
stackTrace = computeStackTraceFromOnErrorMessage(messageObj, url, line, column)
|
|
42
|
+
}
|
|
43
|
+
callback(stackTrace, errorObj ?? messageObj)
|
|
44
|
+
})
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export function instrumentUnhandledRejection(callback: UnhandledErrorCallback) {
|
|
48
|
+
return instrumentMethod(window, 'onunhandledrejection', ({ parameters: [e] }) => {
|
|
49
|
+
const reason = e.reason || 'Empty reason'
|
|
50
|
+
const stack = computeStackTrace(reason)
|
|
51
|
+
callback(stack, reason)
|
|
20
52
|
})
|
|
21
53
|
}
|
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
export type ReportType = DeprecationReport['type'] | InterventionReport['type']
|
|
2
2
|
|
|
3
|
+
interface Report {
|
|
4
|
+
type: ReportType
|
|
5
|
+
url: string
|
|
6
|
+
body: DeprecationReportBody | InterventionReportBody
|
|
7
|
+
toJSON(): any
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
interface ReportBody {
|
|
11
|
+
toJSON(): any
|
|
12
|
+
}
|
|
13
|
+
|
|
3
14
|
export interface DeprecationReport extends Report {
|
|
4
15
|
type: 'deprecation'
|
|
5
16
|
body: DeprecationReportBody
|
|
@@ -17,6 +28,7 @@ export interface InterventionReport extends Report {
|
|
|
17
28
|
type: 'intervention'
|
|
18
29
|
body: InterventionReportBody
|
|
19
30
|
}
|
|
31
|
+
|
|
20
32
|
export interface InterventionReportBody extends ReportBody {
|
|
21
33
|
id: string
|
|
22
34
|
message: string
|
|
@@ -19,6 +19,7 @@ export interface RawReport {
|
|
|
19
19
|
type: RawReportType
|
|
20
20
|
subtype: string
|
|
21
21
|
message: string
|
|
22
|
+
originalReport: SecurityPolicyViolationEvent | DeprecationReport | InterventionReport
|
|
22
23
|
stack?: string
|
|
23
24
|
}
|
|
24
25
|
|
|
@@ -38,7 +39,7 @@ export function initReportObservable(configuration: Configuration, apis: RawRepo
|
|
|
38
39
|
}
|
|
39
40
|
|
|
40
41
|
function createReportObservable(reportTypes: ReportType[]) {
|
|
41
|
-
|
|
42
|
+
return new Observable<RawReport>((observable) => {
|
|
42
43
|
if (!window.ReportingObserver) {
|
|
43
44
|
return
|
|
44
45
|
}
|
|
@@ -59,26 +60,26 @@ function createReportObservable(reportTypes: ReportType[]) {
|
|
|
59
60
|
observer.disconnect()
|
|
60
61
|
}
|
|
61
62
|
})
|
|
62
|
-
|
|
63
|
-
return observable
|
|
64
63
|
}
|
|
65
64
|
|
|
66
65
|
function createCspViolationReportObservable(configuration: Configuration) {
|
|
67
|
-
|
|
66
|
+
return new Observable<RawReport>((observable) => {
|
|
68
67
|
const { stop } = addEventListener(configuration, document, DOM_EVENT.SECURITY_POLICY_VIOLATION, (event) => {
|
|
69
68
|
observable.notify(buildRawReportFromCspViolation(event))
|
|
70
69
|
})
|
|
71
70
|
|
|
72
71
|
return stop
|
|
73
72
|
})
|
|
74
|
-
return observable
|
|
75
73
|
}
|
|
76
74
|
|
|
77
|
-
function buildRawReportFromReport(
|
|
75
|
+
function buildRawReportFromReport(report: DeprecationReport | InterventionReport): RawReport {
|
|
76
|
+
const { type, body } = report
|
|
77
|
+
|
|
78
78
|
return {
|
|
79
79
|
type,
|
|
80
80
|
subtype: body.id,
|
|
81
81
|
message: `${type}: ${body.message}`,
|
|
82
|
+
originalReport: report,
|
|
82
83
|
stack: buildStack(body.id, body.message, body.sourceFile, body.lineNumber, body.columnNumber),
|
|
83
84
|
}
|
|
84
85
|
}
|
|
@@ -99,6 +100,7 @@ function buildRawReportFromCspViolation(event: SecurityPolicyViolationEvent): Ra
|
|
|
99
100
|
event.lineNumber,
|
|
100
101
|
event.columnNumber
|
|
101
102
|
),
|
|
103
|
+
originalReport: event,
|
|
102
104
|
}
|
|
103
105
|
}
|
|
104
106
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getInitCookie } from '../../browser/cookie'
|
|
2
2
|
import type { SessionStoreStrategy } from './storeStrategies/sessionStoreStrategy'
|
|
3
3
|
import { SESSION_STORE_KEY } from './storeStrategies/sessionStoreStrategy'
|
|
4
4
|
import type { SessionState } from './sessionState'
|
|
@@ -17,11 +17,11 @@ export const LOGS_SESSION_KEY = 'logs'
|
|
|
17
17
|
* to allow older sdk versions to be upgraded to newer versions without compatibility issues.
|
|
18
18
|
*/
|
|
19
19
|
export function tryOldCookiesMigration(cookieStoreStrategy: SessionStoreStrategy) {
|
|
20
|
-
const sessionString =
|
|
20
|
+
const sessionString = getInitCookie(SESSION_STORE_KEY)
|
|
21
21
|
if (!sessionString) {
|
|
22
|
-
const oldSessionId =
|
|
23
|
-
const oldRumType =
|
|
24
|
-
const oldLogsType =
|
|
22
|
+
const oldSessionId = getInitCookie(OLD_SESSION_COOKIE_NAME)
|
|
23
|
+
const oldRumType = getInitCookie(OLD_RUM_COOKIE_NAME)
|
|
24
|
+
const oldLogsType = getInitCookie(OLD_LOGS_COOKIE_NAME)
|
|
25
25
|
const session: SessionState = {}
|
|
26
26
|
|
|
27
27
|
if (oldSessionId) {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { setTimeout } from '../../tools/timer'
|
|
2
2
|
import { generateUUID } from '../../tools/utils/stringUtils'
|
|
3
|
-
import { isChromium } from '../../tools/utils/browserDetection'
|
|
4
3
|
import type { SessionStoreStrategy } from './storeStrategies/sessionStoreStrategy'
|
|
5
4
|
import type { SessionState } from './sessionState'
|
|
6
5
|
import { expandSessionState, isSessionInExpiredState } from './sessionState'
|
|
@@ -20,8 +19,7 @@ export function processSessionStoreOperations(
|
|
|
20
19
|
sessionStoreStrategy: SessionStoreStrategy,
|
|
21
20
|
numberOfRetries = 0
|
|
22
21
|
) {
|
|
23
|
-
const { retrieveSession, persistSession, clearSession } = sessionStoreStrategy
|
|
24
|
-
const lockEnabled = isLockEnabled()
|
|
22
|
+
const { isLockEnabled, retrieveSession, persistSession, clearSession } = sessionStoreStrategy
|
|
25
23
|
|
|
26
24
|
if (!ongoingOperations) {
|
|
27
25
|
ongoingOperations = operations
|
|
@@ -30,13 +28,13 @@ export function processSessionStoreOperations(
|
|
|
30
28
|
bufferedOperations.push(operations)
|
|
31
29
|
return
|
|
32
30
|
}
|
|
33
|
-
if (
|
|
31
|
+
if (isLockEnabled && numberOfRetries >= LOCK_MAX_TRIES) {
|
|
34
32
|
next(sessionStoreStrategy)
|
|
35
33
|
return
|
|
36
34
|
}
|
|
37
35
|
let currentLock: string
|
|
38
36
|
let currentSession = retrieveSession()
|
|
39
|
-
if (
|
|
37
|
+
if (isLockEnabled) {
|
|
40
38
|
// if someone has lock, retry later
|
|
41
39
|
if (currentSession.lock) {
|
|
42
40
|
retryLater(operations, sessionStoreStrategy, numberOfRetries)
|
|
@@ -54,7 +52,7 @@ export function processSessionStoreOperations(
|
|
|
54
52
|
}
|
|
55
53
|
}
|
|
56
54
|
let processedSession = operations.process(currentSession)
|
|
57
|
-
if (
|
|
55
|
+
if (isLockEnabled) {
|
|
58
56
|
// if lock corrupted after process, retry later
|
|
59
57
|
currentSession = retrieveSession()
|
|
60
58
|
if (currentSession.lock !== currentLock!) {
|
|
@@ -70,7 +68,7 @@ export function processSessionStoreOperations(
|
|
|
70
68
|
persistSession(processedSession)
|
|
71
69
|
}
|
|
72
70
|
}
|
|
73
|
-
if (
|
|
71
|
+
if (isLockEnabled) {
|
|
74
72
|
// correctly handle lock around expiration would require to handle this case properly at several levels
|
|
75
73
|
// since we don't have evidence of lock issues around expiration, let's just not do the corruption check for it
|
|
76
74
|
if (!(processedSession && isSessionInExpiredState(processedSession))) {
|
|
@@ -91,12 +89,6 @@ export function processSessionStoreOperations(
|
|
|
91
89
|
next(sessionStoreStrategy)
|
|
92
90
|
}
|
|
93
91
|
|
|
94
|
-
/**
|
|
95
|
-
* Lock strategy allows mitigating issues due to concurrent access to cookie.
|
|
96
|
-
* This issue concerns only chromium browsers and enabling this on firefox increases cookie write failures.
|
|
97
|
-
*/
|
|
98
|
-
export const isLockEnabled = () => isChromium()
|
|
99
|
-
|
|
100
92
|
function retryLater(operations: Operations, sessionStore: SessionStoreStrategy, currentNumberOfRetries: number) {
|
|
101
93
|
setTimeout(() => {
|
|
102
94
|
processSessionStoreOperations(operations, sessionStore, currentNumberOfRetries + 1)
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { isChromium } from '../../../tools/utils/browserDetection'
|
|
1
2
|
import type { CookieOptions } from '../../../browser/cookie'
|
|
2
3
|
import { getCurrentSite, areCookiesAuthorized, deleteCookie, getCookie, setCookie } from '../../../browser/cookie'
|
|
3
4
|
import type { InitConfiguration } from '../../configuration'
|
|
@@ -15,6 +16,11 @@ export function selectCookieStrategy(initConfiguration: InitConfiguration): Sess
|
|
|
15
16
|
|
|
16
17
|
export function initCookieStrategy(cookieOptions: CookieOptions): SessionStoreStrategy {
|
|
17
18
|
const cookieStore = {
|
|
19
|
+
/**
|
|
20
|
+
* Lock strategy allows mitigating issues due to concurrent access to cookie.
|
|
21
|
+
* This issue concerns only chromium browsers and enabling this on firefox increases cookie write failures.
|
|
22
|
+
*/
|
|
23
|
+
isLockEnabled: isChromium(),
|
|
18
24
|
persistSession: persistSessionCookie(cookieOptions),
|
|
19
25
|
retrieveSession: retrieveSessionCookie,
|
|
20
26
|
clearSession: deleteSessionCookie(cookieOptions),
|
|
@@ -45,8 +51,13 @@ function deleteSessionCookie(options: CookieOptions) {
|
|
|
45
51
|
export function buildCookieOptions(initConfiguration: InitConfiguration) {
|
|
46
52
|
const cookieOptions: CookieOptions = {}
|
|
47
53
|
|
|
48
|
-
cookieOptions.secure =
|
|
49
|
-
|
|
54
|
+
cookieOptions.secure =
|
|
55
|
+
!!initConfiguration.useSecureSessionCookie ||
|
|
56
|
+
!!initConfiguration.usePartitionedCrossSiteSessionCookie ||
|
|
57
|
+
!!initConfiguration.useCrossSiteSessionCookie
|
|
58
|
+
cookieOptions.crossSite =
|
|
59
|
+
!!initConfiguration.usePartitionedCrossSiteSessionCookie || !!initConfiguration.useCrossSiteSessionCookie
|
|
60
|
+
cookieOptions.partitioned = !!initConfiguration.usePartitionedCrossSiteSessionCookie
|
|
50
61
|
|
|
51
62
|
if (initConfiguration.trackSessionAcrossSubdomains) {
|
|
52
63
|
cookieOptions.domain = getCurrentSite()
|
|
@@ -21,6 +21,7 @@ export function selectLocalStorageStrategy(): SessionStoreStrategyType | undefin
|
|
|
21
21
|
|
|
22
22
|
export function initLocalStorageStrategy(): SessionStoreStrategy {
|
|
23
23
|
return {
|
|
24
|
+
isLockEnabled: false,
|
|
24
25
|
persistSession: persistInLocalStorage,
|
|
25
26
|
retrieveSession: retrieveSessionFromLocalStorage,
|
|
26
27
|
clearSession: clearSessionFromLocalStorage,
|
|
@@ -6,6 +6,7 @@ export const SESSION_STORE_KEY = '_oo_s'
|
|
|
6
6
|
export type SessionStoreStrategyType = { type: 'Cookie'; cookieOptions: CookieOptions } | { type: 'LocalStorage' }
|
|
7
7
|
|
|
8
8
|
export interface SessionStoreStrategy {
|
|
9
|
+
isLockEnabled: boolean
|
|
9
10
|
persistSession: (session: SessionState) => void
|
|
10
11
|
retrieveSession: () => SessionState
|
|
11
12
|
clearSession: () => void
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getInitCookie } from '../../browser/cookie'
|
|
2
2
|
|
|
3
3
|
export const SYNTHETICS_TEST_ID_COOKIE_NAME = 'openobserve-synthetics-public-id'
|
|
4
4
|
export const SYNTHETICS_RESULT_ID_COOKIE_NAME = 'openobserve-synthetics-result-id'
|
|
@@ -12,16 +12,16 @@ export interface BrowserWindow extends Window {
|
|
|
12
12
|
|
|
13
13
|
export function willSyntheticsInjectRum(): boolean {
|
|
14
14
|
return Boolean(
|
|
15
|
-
(window as BrowserWindow)._OO_SYNTHETICS_INJECTS_RUM ||
|
|
15
|
+
(window as BrowserWindow)._OO_SYNTHETICS_INJECTS_RUM || getInitCookie(SYNTHETICS_INJECTS_RUM_COOKIE_NAME)
|
|
16
16
|
)
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
export function getSyntheticsTestId(): string | undefined {
|
|
20
|
-
const value = (window as BrowserWindow)._OO_SYNTHETICS_PUBLIC_ID ||
|
|
20
|
+
const value = (window as BrowserWindow)._OO_SYNTHETICS_PUBLIC_ID || getInitCookie(SYNTHETICS_TEST_ID_COOKIE_NAME)
|
|
21
21
|
return typeof value === 'string' ? value : undefined
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
export function getSyntheticsResultId(): string | undefined {
|
|
25
|
-
const value = (window as BrowserWindow)._OO_SYNTHETICS_RESULT_ID ||
|
|
25
|
+
const value = (window as BrowserWindow)._OO_SYNTHETICS_RESULT_ID || getInitCookie(SYNTHETICS_RESULT_ID_COOKIE_NAME)
|
|
26
26
|
return typeof value === 'string' ? value : undefined
|
|
27
27
|
}
|
|
@@ -10,5 +10,10 @@ export const enum StatusType {
|
|
|
10
10
|
error = 'error',
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
+
export interface RuntimeEnvInfo {
|
|
14
|
+
is_local_file: boolean
|
|
15
|
+
is_worker: boolean
|
|
16
|
+
}
|
|
17
|
+
|
|
13
18
|
export type RawTelemetryEvent = TelemetryEvent['telemetry']
|
|
14
19
|
export type RawTelemetryConfiguration = TelemetryConfigurationEvent['telemetry']['configuration']
|