@openobserve/browser-core 0.2.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +3 -0
- package/cjs/boot/init.d.ts +5 -0
- package/cjs/boot/init.js +36 -0
- package/cjs/boot/init.js.map +1 -0
- package/cjs/browser/addEventListener.d.ts +76 -0
- package/cjs/browser/addEventListener.js +52 -0
- package/cjs/browser/addEventListener.js.map +1 -0
- package/cjs/browser/cookie.d.ts +10 -0
- package/cjs/browser/cookie.js +69 -0
- package/cjs/browser/cookie.js.map +1 -0
- package/cjs/browser/fetchObservable.d.ts +23 -0
- package/cjs/browser/fetchObservable.js +74 -0
- package/cjs/browser/fetchObservable.js.map +1 -0
- package/cjs/browser/pageExitObservable.d.ts +14 -0
- package/cjs/browser/pageExitObservable.js +58 -0
- package/cjs/browser/pageExitObservable.js.map +1 -0
- package/cjs/browser/runOnReadyState.d.ts +2 -0
- package/cjs/browser/runOnReadyState.js +15 -0
- package/cjs/browser/runOnReadyState.js.map +1 -0
- package/cjs/browser/types.d.ts +19 -0
- package/cjs/browser/types.js +6 -0
- package/cjs/browser/types.js.map +1 -0
- package/cjs/browser/xhrObservable.d.ts +22 -0
- package/cjs/browser/xhrObservable.js +93 -0
- package/cjs/browser/xhrObservable.js.map +1 -0
- package/cjs/domain/configuration/configuration.d.ts +67 -0
- package/cjs/domain/configuration/configuration.js +95 -0
- package/cjs/domain/configuration/configuration.js.map +1 -0
- package/cjs/domain/configuration/endpointBuilder.d.ts +14 -0
- package/cjs/domain/configuration/endpointBuilder.js +94 -0
- package/cjs/domain/configuration/endpointBuilder.js.map +1 -0
- package/cjs/domain/configuration/index.d.ts +3 -0
- package/cjs/domain/configuration/index.js +25 -0
- package/cjs/domain/configuration/index.js.map +1 -0
- package/cjs/domain/configuration/intakeSites.d.ts +5 -0
- package/cjs/domain/configuration/intakeSites.js +9 -0
- package/cjs/domain/configuration/intakeSites.js.map +1 -0
- package/cjs/domain/configuration/tags.d.ts +4 -0
- package/cjs/domain/configuration/tags.js +39 -0
- package/cjs/domain/configuration/tags.js.map +1 -0
- package/cjs/domain/configuration/transportConfiguration.d.ts +16 -0
- package/cjs/domain/configuration/transportConfiguration.js +42 -0
- package/cjs/domain/configuration/transportConfiguration.js.map +1 -0
- package/cjs/domain/console/consoleObservable.d.ts +11 -0
- package/cjs/domain/console/consoleObservable.js +75 -0
- package/cjs/domain/console/consoleObservable.js.map +1 -0
- package/cjs/domain/deflate/index.d.ts +1 -0
- package/cjs/domain/deflate/index.js +18 -0
- package/cjs/domain/deflate/index.js.map +1 -0
- package/cjs/domain/deflate/types.d.ts +26 -0
- package/cjs/domain/deflate/types.js +3 -0
- package/cjs/domain/deflate/types.js.map +1 -0
- package/cjs/domain/error/error.d.ts +28 -0
- package/cjs/domain/error/error.js +131 -0
- package/cjs/domain/error/error.js.map +1 -0
- package/cjs/domain/error/error.types.d.ts +40 -0
- package/cjs/domain/error/error.types.js +13 -0
- package/cjs/domain/error/error.types.js.map +1 -0
- package/cjs/domain/error/trackRuntimeError.d.ts +5 -0
- package/cjs/domain/error/trackRuntimeError.js +21 -0
- package/cjs/domain/error/trackRuntimeError.js.map +1 -0
- package/cjs/domain/eventRateLimiter/createEventRateLimiter.d.ts +5 -0
- package/cjs/domain/eventRateLimiter/createEventRateLimiter.js +40 -0
- package/cjs/domain/eventRateLimiter/createEventRateLimiter.js.map +1 -0
- package/cjs/domain/report/browser.types.d.ts +24 -0
- package/cjs/domain/report/browser.types.js +3 -0
- package/cjs/domain/report/browser.types.js.map +1 -0
- package/cjs/domain/report/reportObservable.d.ts +15 -0
- package/cjs/domain/report/reportObservable.js +94 -0
- package/cjs/domain/report/reportObservable.js.map +1 -0
- package/cjs/domain/resourceUtils.d.ts +16 -0
- package/cjs/domain/resourceUtils.js +3 -0
- package/cjs/domain/resourceUtils.js.map +1 -0
- package/cjs/domain/session/oldCookiesMigration.d.ts +11 -0
- package/cjs/domain/session/oldCookiesMigration.js +40 -0
- package/cjs/domain/session/oldCookiesMigration.js.map +1 -0
- package/cjs/domain/session/sessionConstants.d.ts +2 -0
- package/cjs/domain/session/sessionConstants.js +7 -0
- package/cjs/domain/session/sessionConstants.js.map +1 -0
- package/cjs/domain/session/sessionManager.d.ts +20 -0
- package/cjs/domain/session/sessionManager.js +65 -0
- package/cjs/domain/session/sessionManager.js.map +1 -0
- package/cjs/domain/session/sessionState.d.ts +11 -0
- package/cjs/domain/session/sessionState.js +45 -0
- package/cjs/domain/session/sessionState.js.map +1 -0
- package/cjs/domain/session/sessionStore.d.ts +34 -0
- package/cjs/domain/session/sessionStore.js +144 -0
- package/cjs/domain/session/sessionStore.js.map +1 -0
- package/cjs/domain/session/sessionStoreOperations.d.ts +15 -0
- package/cjs/domain/session/sessionStoreOperations.js +104 -0
- package/cjs/domain/session/sessionStoreOperations.js.map +1 -0
- package/cjs/domain/session/storeStrategies/sessionInCookie.d.ts +6 -0
- package/cjs/domain/session/storeStrategies/sessionInCookie.js +48 -0
- package/cjs/domain/session/storeStrategies/sessionInCookie.js.map +1 -0
- package/cjs/domain/session/storeStrategies/sessionInLocalStorage.d.ts +3 -0
- package/cjs/domain/session/storeStrategies/sessionInLocalStorage.js +40 -0
- package/cjs/domain/session/storeStrategies/sessionInLocalStorage.js.map +1 -0
- package/cjs/domain/session/storeStrategies/sessionStoreStrategy.d.ts +14 -0
- package/cjs/domain/session/storeStrategies/sessionStoreStrategy.js +5 -0
- package/cjs/domain/session/storeStrategies/sessionStoreStrategy.js.map +1 -0
- package/cjs/domain/synthetics/syntheticsWorkerValues.d.ts +11 -0
- package/cjs/domain/synthetics/syntheticsWorkerValues.js +22 -0
- package/cjs/domain/synthetics/syntheticsWorkerValues.js.map +1 -0
- package/cjs/domain/telemetry/index.d.ts +3 -0
- package/cjs/domain/telemetry/index.js +28 -0
- package/cjs/domain/telemetry/index.js.map +1 -0
- package/cjs/domain/telemetry/rawTelemetryEvent.types.d.ts +11 -0
- package/cjs/domain/telemetry/rawTelemetryEvent.types.js +8 -0
- package/cjs/domain/telemetry/rawTelemetryEvent.types.js.map +1 -0
- package/cjs/domain/telemetry/telemetry.d.ts +112 -0
- package/cjs/domain/telemetry/telemetry.js +146 -0
- package/cjs/domain/telemetry/telemetry.js.map +1 -0
- package/cjs/domain/telemetry/telemetryEvent.types.d.ts +375 -0
- package/cjs/domain/telemetry/telemetryEvent.types.js +7 -0
- package/cjs/domain/telemetry/telemetryEvent.types.js.map +1 -0
- package/cjs/domain/tracekit/computeStackTrace.d.ts +5 -0
- package/cjs/domain/tracekit/computeStackTrace.js +118 -0
- package/cjs/domain/tracekit/computeStackTrace.js.map +1 -0
- package/cjs/domain/tracekit/index.d.ts +3 -0
- package/cjs/domain/tracekit/index.js +8 -0
- package/cjs/domain/tracekit/index.js.map +1 -0
- package/cjs/domain/tracekit/tracekit.d.ts +35 -0
- package/cjs/domain/tracekit/tracekit.js +95 -0
- package/cjs/domain/tracekit/tracekit.js.map +1 -0
- package/cjs/domain/tracekit/types.d.ts +44 -0
- package/cjs/domain/tracekit/types.js +3 -0
- package/cjs/domain/tracekit/types.js.map +1 -0
- package/cjs/domain/user/index.d.ts +2 -0
- package/cjs/domain/user/index.js +19 -0
- package/cjs/domain/user/index.js.map +1 -0
- package/cjs/domain/user/user.d.ts +12 -0
- package/cjs/domain/user/user.js +35 -0
- package/cjs/domain/user/user.js.map +1 -0
- package/cjs/domain/user/user.types.d.ts +6 -0
- package/cjs/domain/user/user.types.js +3 -0
- package/cjs/domain/user/user.types.js.map +1 -0
- package/cjs/index.d.ts +63 -0
- package/cjs/index.js +155 -0
- package/cjs/index.js.map +1 -0
- package/cjs/tools/abstractLifeCycle.d.ts +23 -0
- package/cjs/tools/abstractLifeCycle.js +29 -0
- package/cjs/tools/abstractLifeCycle.js.map +1 -0
- package/cjs/tools/boundedBuffer.d.ts +5 -0
- package/cjs/tools/boundedBuffer.js +22 -0
- package/cjs/tools/boundedBuffer.js.map +1 -0
- package/cjs/tools/catchUserErrors.d.ts +1 -0
- package/cjs/tools/catchUserErrors.js +20 -0
- package/cjs/tools/catchUserErrors.js.map +1 -0
- package/cjs/tools/display.d.ts +35 -0
- package/cjs/tools/display.js +45 -0
- package/cjs/tools/display.js.map +1 -0
- package/cjs/tools/experimentalFeatures.d.ts +24 -0
- package/cjs/tools/experimentalFeatures.js +47 -0
- package/cjs/tools/experimentalFeatures.js.map +1 -0
- package/cjs/tools/getGlobalObject.d.ts +4 -0
- package/cjs/tools/getGlobalObject.js +37 -0
- package/cjs/tools/getGlobalObject.js.map +1 -0
- package/cjs/tools/getZoneJsOriginalValue.d.ts +19 -0
- package/cjs/tools/getZoneJsOriginalValue.js +30 -0
- package/cjs/tools/getZoneJsOriginalValue.js.map +1 -0
- package/cjs/tools/instrumentMethod.d.ts +19 -0
- package/cjs/tools/instrumentMethod.js +83 -0
- package/cjs/tools/instrumentMethod.js.map +1 -0
- package/cjs/tools/matchOption.d.ts +8 -0
- package/cjs/tools/matchOption.js +38 -0
- package/cjs/tools/matchOption.js.map +1 -0
- package/cjs/tools/mergeInto.d.ts +25 -0
- package/cjs/tools/mergeInto.js +105 -0
- package/cjs/tools/mergeInto.js.map +1 -0
- package/cjs/tools/monitor.d.ts +9 -0
- package/cjs/tools/monitor.js +76 -0
- package/cjs/tools/monitor.js.map +1 -0
- package/cjs/tools/observable.d.ts +12 -0
- package/cjs/tools/observable.js +44 -0
- package/cjs/tools/observable.js.map +1 -0
- package/cjs/tools/readBytesFromStream.d.ts +11 -0
- package/cjs/tools/readBytesFromStream.js +64 -0
- package/cjs/tools/readBytesFromStream.js.map +1 -0
- package/cjs/tools/sendToExtension.d.ts +3 -0
- package/cjs/tools/sendToExtension.js +11 -0
- package/cjs/tools/sendToExtension.js.map +1 -0
- package/cjs/tools/serialisation/context.d.ts +6 -0
- package/cjs/tools/serialisation/context.js +3 -0
- package/cjs/tools/serialisation/context.js.map +1 -0
- package/cjs/tools/serialisation/contextManager.d.ts +21 -0
- package/cjs/tools/serialisation/contextManager.js +70 -0
- package/cjs/tools/serialisation/contextManager.js.map +1 -0
- package/cjs/tools/serialisation/heavyCustomerDataWarning.d.ts +8 -0
- package/cjs/tools/serialisation/heavyCustomerDataWarning.js +18 -0
- package/cjs/tools/serialisation/heavyCustomerDataWarning.js.map +1 -0
- package/cjs/tools/serialisation/jsonStringify.d.ts +14 -0
- package/cjs/tools/serialisation/jsonStringify.js +49 -0
- package/cjs/tools/serialisation/jsonStringify.js.map +1 -0
- package/cjs/tools/serialisation/sanitize.d.ts +18 -0
- package/cjs/tools/serialisation/sanitize.js +185 -0
- package/cjs/tools/serialisation/sanitize.js.map +1 -0
- package/cjs/tools/timer.d.ts +5 -0
- package/cjs/tools/timer.js +23 -0
- package/cjs/tools/timer.js.map +1 -0
- package/cjs/tools/utils/arrayUtils.d.ts +1 -0
- package/cjs/tools/utils/arrayUtils.js +11 -0
- package/cjs/tools/utils/arrayUtils.js.map +1 -0
- package/cjs/tools/utils/browserDetection.d.ts +2 -0
- package/cjs/tools/utils/browserDetection.js +12 -0
- package/cjs/tools/utils/browserDetection.js.map +1 -0
- package/cjs/tools/utils/byteUtils.d.ts +4 -0
- package/cjs/tools/utils/byteUtils.js +31 -0
- package/cjs/tools/utils/byteUtils.js.map +1 -0
- package/cjs/tools/utils/functionUtils.d.ts +9 -0
- package/cjs/tools/utils/functionUtils.js +48 -0
- package/cjs/tools/utils/functionUtils.js.map +1 -0
- package/cjs/tools/utils/numberUtils.d.ts +8 -0
- package/cjs/tools/utils/numberUtils.js +24 -0
- package/cjs/tools/utils/numberUtils.js.map +1 -0
- package/cjs/tools/utils/objectUtils.d.ts +10 -0
- package/cjs/tools/utils/objectUtils.js +26 -0
- package/cjs/tools/utils/objectUtils.js.map +1 -0
- package/cjs/tools/utils/polyfills.d.ts +24 -0
- package/cjs/tools/utils/polyfills.js +110 -0
- package/cjs/tools/utils/polyfills.js.map +1 -0
- package/cjs/tools/utils/responseUtils.d.ts +2 -0
- package/cjs/tools/utils/responseUtils.js +18 -0
- package/cjs/tools/utils/responseUtils.js.map +1 -0
- package/cjs/tools/utils/stringUtils.d.ts +7 -0
- package/cjs/tools/utils/stringUtils.js +32 -0
- package/cjs/tools/utils/stringUtils.js.map +1 -0
- package/cjs/tools/utils/timeUtils.d.ts +57 -0
- package/cjs/tools/utils/timeUtils.js +99 -0
- package/cjs/tools/utils/timeUtils.js.map +1 -0
- package/cjs/tools/utils/typeUtils.d.ts +4 -0
- package/cjs/tools/utils/typeUtils.js +17 -0
- package/cjs/tools/utils/typeUtils.js.map +1 -0
- package/cjs/tools/utils/urlPolyfill.d.ts +14 -0
- package/cjs/tools/utils/urlPolyfill.js +92 -0
- package/cjs/tools/utils/urlPolyfill.js.map +1 -0
- package/cjs/tools/valueHistory.d.ts +50 -0
- package/cjs/tools/valueHistory.js +106 -0
- package/cjs/tools/valueHistory.js.map +1 -0
- package/cjs/transport/batch.d.ts +19 -0
- package/cjs/transport/batch.js +79 -0
- package/cjs/transport/batch.js.map +1 -0
- package/cjs/transport/eventBridge.d.ts +12 -0
- package/cjs/transport/eventBridge.js +34 -0
- package/cjs/transport/eventBridge.js.map +1 -0
- package/cjs/transport/flushController.d.ts +48 -0
- package/cjs/transport/flushController.js +97 -0
- package/cjs/transport/flushController.js.map +1 -0
- package/cjs/transport/httpRequest.d.ts +37 -0
- package/cjs/transport/httpRequest.js +91 -0
- package/cjs/transport/httpRequest.js.map +1 -0
- package/cjs/transport/index.d.ts +4 -0
- package/cjs/transport/index.js +13 -0
- package/cjs/transport/index.js.map +1 -0
- package/cjs/transport/sendWithRetryStrategy.d.ts +39 -0
- package/cjs/transport/sendWithRetryStrategy.js +151 -0
- package/cjs/transport/sendWithRetryStrategy.js.map +1 -0
- package/cjs/transport/startBatchWithReplica.d.ts +15 -0
- package/cjs/transport/startBatchWithReplica.js +37 -0
- package/cjs/transport/startBatchWithReplica.js.map +1 -0
- package/esm/boot/init.d.ts +5 -0
- package/esm/boot/init.js +31 -0
- package/esm/boot/init.js.map +1 -0
- package/esm/browser/addEventListener.d.ts +76 -0
- package/esm/browser/addEventListener.js +47 -0
- package/esm/browser/addEventListener.js.map +1 -0
- package/esm/browser/cookie.d.ts +10 -0
- package/esm/browser/cookie.js +61 -0
- package/esm/browser/cookie.js.map +1 -0
- package/esm/browser/fetchObservable.d.ts +23 -0
- package/esm/browser/fetchObservable.js +70 -0
- package/esm/browser/fetchObservable.js.map +1 -0
- package/esm/browser/pageExitObservable.d.ts +14 -0
- package/esm/browser/pageExitObservable.js +53 -0
- package/esm/browser/pageExitObservable.js.map +1 -0
- package/esm/browser/runOnReadyState.d.ts +2 -0
- package/esm/browser/runOnReadyState.js +11 -0
- package/esm/browser/runOnReadyState.js.map +1 -0
- package/esm/browser/types.d.ts +19 -0
- package/esm/browser/types.js +5 -0
- package/esm/browser/types.js.map +1 -0
- package/esm/browser/xhrObservable.d.ts +22 -0
- package/esm/browser/xhrObservable.js +89 -0
- package/esm/browser/xhrObservable.js.map +1 -0
- package/esm/domain/configuration/configuration.d.ts +67 -0
- package/esm/domain/configuration/configuration.js +90 -0
- package/esm/domain/configuration/configuration.js.map +1 -0
- package/esm/domain/configuration/endpointBuilder.d.ts +14 -0
- package/esm/domain/configuration/endpointBuilder.js +90 -0
- package/esm/domain/configuration/endpointBuilder.js.map +1 -0
- package/esm/domain/configuration/index.d.ts +3 -0
- package/esm/domain/configuration/index.js +4 -0
- package/esm/domain/configuration/index.js.map +1 -0
- package/esm/domain/configuration/intakeSites.d.ts +5 -0
- package/esm/domain/configuration/intakeSites.js +6 -0
- package/esm/domain/configuration/intakeSites.js.map +1 -0
- package/esm/domain/configuration/tags.d.ts +4 -0
- package/esm/domain/configuration/tags.js +34 -0
- package/esm/domain/configuration/tags.js.map +1 -0
- package/esm/domain/configuration/transportConfiguration.d.ts +16 -0
- package/esm/domain/configuration/transportConfiguration.js +38 -0
- package/esm/domain/configuration/transportConfiguration.js.map +1 -0
- package/esm/domain/console/consoleObservable.d.ts +11 -0
- package/esm/domain/console/consoleObservable.js +70 -0
- package/esm/domain/console/consoleObservable.js.map +1 -0
- package/esm/domain/deflate/index.d.ts +1 -0
- package/esm/domain/deflate/index.js +2 -0
- package/esm/domain/deflate/index.js.map +1 -0
- package/esm/domain/deflate/types.d.ts +26 -0
- package/esm/domain/deflate/types.js +2 -0
- package/esm/domain/deflate/types.js.map +1 -0
- package/esm/domain/error/error.d.ts +28 -0
- package/esm/domain/error/error.js +121 -0
- package/esm/domain/error/error.js.map +1 -0
- package/esm/domain/error/error.types.d.ts +40 -0
- package/esm/domain/error/error.types.js +10 -0
- package/esm/domain/error/error.types.js.map +1 -0
- package/esm/domain/error/trackRuntimeError.d.ts +5 -0
- package/esm/domain/error/trackRuntimeError.js +17 -0
- package/esm/domain/error/trackRuntimeError.js.map +1 -0
- package/esm/domain/eventRateLimiter/createEventRateLimiter.d.ts +5 -0
- package/esm/domain/eventRateLimiter/createEventRateLimiter.js +36 -0
- package/esm/domain/eventRateLimiter/createEventRateLimiter.js.map +1 -0
- package/esm/domain/report/browser.types.d.ts +24 -0
- package/esm/domain/report/browser.types.js +2 -0
- package/esm/domain/report/browser.types.js.map +1 -0
- package/esm/domain/report/reportObservable.d.ts +15 -0
- package/esm/domain/report/reportObservable.js +90 -0
- package/esm/domain/report/reportObservable.js.map +1 -0
- package/esm/domain/resourceUtils.d.ts +16 -0
- package/esm/domain/resourceUtils.js +2 -0
- package/esm/domain/resourceUtils.js.map +1 -0
- package/esm/domain/session/oldCookiesMigration.d.ts +11 -0
- package/esm/domain/session/oldCookiesMigration.js +36 -0
- package/esm/domain/session/oldCookiesMigration.js.map +1 -0
- package/esm/domain/session/sessionConstants.d.ts +2 -0
- package/esm/domain/session/sessionConstants.js +4 -0
- package/esm/domain/session/sessionConstants.js.map +1 -0
- package/esm/domain/session/sessionManager.d.ts +20 -0
- package/esm/domain/session/sessionManager.js +60 -0
- package/esm/domain/session/sessionManager.js.map +1 -0
- package/esm/domain/session/sessionState.d.ts +11 -0
- package/esm/domain/session/sessionState.js +38 -0
- package/esm/domain/session/sessionState.js.map +1 -0
- package/esm/domain/session/sessionStore.d.ts +34 -0
- package/esm/domain/session/sessionStore.js +139 -0
- package/esm/domain/session/sessionStore.js.map +1 -0
- package/esm/domain/session/sessionStoreOperations.d.ts +15 -0
- package/esm/domain/session/sessionStoreOperations.js +99 -0
- package/esm/domain/session/sessionStoreOperations.js.map +1 -0
- package/esm/domain/session/storeStrategies/sessionInCookie.d.ts +6 -0
- package/esm/domain/session/storeStrategies/sessionInCookie.js +42 -0
- package/esm/domain/session/storeStrategies/sessionInCookie.js.map +1 -0
- package/esm/domain/session/storeStrategies/sessionInLocalStorage.d.ts +3 -0
- package/esm/domain/session/storeStrategies/sessionInLocalStorage.js +35 -0
- package/esm/domain/session/storeStrategies/sessionInLocalStorage.js.map +1 -0
- package/esm/domain/session/storeStrategies/sessionStoreStrategy.d.ts +14 -0
- package/esm/domain/session/storeStrategies/sessionStoreStrategy.js +2 -0
- package/esm/domain/session/storeStrategies/sessionStoreStrategy.js.map +1 -0
- package/esm/domain/synthetics/syntheticsWorkerValues.d.ts +11 -0
- package/esm/domain/synthetics/syntheticsWorkerValues.js +16 -0
- package/esm/domain/synthetics/syntheticsWorkerValues.js.map +1 -0
- package/esm/domain/telemetry/index.d.ts +3 -0
- package/esm/domain/telemetry/index.js +4 -0
- package/esm/domain/telemetry/index.js.map +1 -0
- package/esm/domain/telemetry/rawTelemetryEvent.types.d.ts +11 -0
- package/esm/domain/telemetry/rawTelemetryEvent.types.js +5 -0
- package/esm/domain/telemetry/rawTelemetryEvent.types.js.map +1 -0
- package/esm/domain/telemetry/telemetry.d.ts +112 -0
- package/esm/domain/telemetry/telemetry.js +134 -0
- package/esm/domain/telemetry/telemetry.js.map +1 -0
- package/esm/domain/telemetry/telemetryEvent.types.d.ts +375 -0
- package/esm/domain/telemetry/telemetryEvent.types.js +6 -0
- package/esm/domain/telemetry/telemetryEvent.types.js.map +1 -0
- package/esm/domain/tracekit/computeStackTrace.d.ts +5 -0
- package/esm/domain/tracekit/computeStackTrace.js +114 -0
- package/esm/domain/tracekit/computeStackTrace.js.map +1 -0
- package/esm/domain/tracekit/index.d.ts +3 -0
- package/esm/domain/tracekit/index.js +3 -0
- package/esm/domain/tracekit/index.js.map +1 -0
- package/esm/domain/tracekit/tracekit.d.ts +35 -0
- package/esm/domain/tracekit/tracekit.js +91 -0
- package/esm/domain/tracekit/tracekit.js.map +1 -0
- package/esm/domain/tracekit/types.d.ts +44 -0
- package/esm/domain/tracekit/types.js +2 -0
- package/esm/domain/tracekit/types.js.map +1 -0
- package/esm/domain/user/index.d.ts +2 -0
- package/esm/domain/user/index.js +3 -0
- package/esm/domain/user/index.js.map +1 -0
- package/esm/domain/user/user.d.ts +12 -0
- package/esm/domain/user/user.js +30 -0
- package/esm/domain/user/user.js.map +1 -0
- package/esm/domain/user/user.types.d.ts +6 -0
- package/esm/domain/user/user.types.js +2 -0
- package/esm/domain/user/user.types.js.map +1 -0
- package/esm/index.d.ts +63 -0
- package/esm/index.js +61 -0
- package/esm/index.js.map +1 -0
- package/esm/tools/abstractLifeCycle.d.ts +23 -0
- package/esm/tools/abstractLifeCycle.js +26 -0
- package/esm/tools/abstractLifeCycle.js.map +1 -0
- package/esm/tools/boundedBuffer.d.ts +5 -0
- package/esm/tools/boundedBuffer.js +19 -0
- package/esm/tools/boundedBuffer.js.map +1 -0
- package/esm/tools/catchUserErrors.d.ts +1 -0
- package/esm/tools/catchUserErrors.js +16 -0
- package/esm/tools/catchUserErrors.js.map +1 -0
- package/esm/tools/display.d.ts +35 -0
- package/esm/tools/display.js +41 -0
- package/esm/tools/display.js.map +1 -0
- package/esm/tools/experimentalFeatures.d.ts +24 -0
- package/esm/tools/experimentalFeatures.js +40 -0
- package/esm/tools/experimentalFeatures.js.map +1 -0
- package/esm/tools/getGlobalObject.d.ts +4 -0
- package/esm/tools/getGlobalObject.js +33 -0
- package/esm/tools/getGlobalObject.js.map +1 -0
- package/esm/tools/getZoneJsOriginalValue.d.ts +19 -0
- package/esm/tools/getZoneJsOriginalValue.js +26 -0
- package/esm/tools/getZoneJsOriginalValue.js.map +1 -0
- package/esm/tools/instrumentMethod.d.ts +19 -0
- package/esm/tools/instrumentMethod.js +77 -0
- package/esm/tools/instrumentMethod.js.map +1 -0
- package/esm/tools/matchOption.d.ts +8 -0
- package/esm/tools/matchOption.js +33 -0
- package/esm/tools/matchOption.js.map +1 -0
- package/esm/tools/mergeInto.d.ts +25 -0
- package/esm/tools/mergeInto.js +99 -0
- package/esm/tools/mergeInto.js.map +1 -0
- package/esm/tools/monitor.d.ts +9 -0
- package/esm/tools/monitor.js +66 -0
- package/esm/tools/monitor.js.map +1 -0
- package/esm/tools/observable.d.ts +12 -0
- package/esm/tools/observable.js +40 -0
- package/esm/tools/observable.js.map +1 -0
- package/esm/tools/readBytesFromStream.d.ts +11 -0
- package/esm/tools/readBytesFromStream.js +60 -0
- package/esm/tools/readBytesFromStream.js.map +1 -0
- package/esm/tools/sendToExtension.d.ts +3 -0
- package/esm/tools/sendToExtension.js +7 -0
- package/esm/tools/sendToExtension.js.map +1 -0
- package/esm/tools/serialisation/context.d.ts +6 -0
- package/esm/tools/serialisation/context.js +2 -0
- package/esm/tools/serialisation/context.js.map +1 -0
- package/esm/tools/serialisation/contextManager.d.ts +21 -0
- package/esm/tools/serialisation/contextManager.js +66 -0
- package/esm/tools/serialisation/contextManager.js.map +1 -0
- package/esm/tools/serialisation/heavyCustomerDataWarning.d.ts +8 -0
- package/esm/tools/serialisation/heavyCustomerDataWarning.js +14 -0
- package/esm/tools/serialisation/heavyCustomerDataWarning.js.map +1 -0
- package/esm/tools/serialisation/jsonStringify.d.ts +14 -0
- package/esm/tools/serialisation/jsonStringify.js +44 -0
- package/esm/tools/serialisation/jsonStringify.js.map +1 -0
- package/esm/tools/serialisation/sanitize.d.ts +18 -0
- package/esm/tools/serialisation/sanitize.js +181 -0
- package/esm/tools/serialisation/sanitize.js.map +1 -0
- package/esm/tools/timer.d.ts +5 -0
- package/esm/tools/timer.js +16 -0
- package/esm/tools/timer.js.map +1 -0
- package/esm/tools/utils/arrayUtils.d.ts +1 -0
- package/esm/tools/utils/arrayUtils.js +7 -0
- package/esm/tools/utils/arrayUtils.js.map +1 -0
- package/esm/tools/utils/browserDetection.d.ts +2 -0
- package/esm/tools/utils/browserDetection.js +7 -0
- package/esm/tools/utils/browserDetection.js.map +1 -0
- package/esm/tools/utils/byteUtils.d.ts +4 -0
- package/esm/tools/utils/byteUtils.js +26 -0
- package/esm/tools/utils/byteUtils.js.map +1 -0
- package/esm/tools/utils/functionUtils.d.ts +9 -0
- package/esm/tools/utils/functionUtils.js +43 -0
- package/esm/tools/utils/functionUtils.js.map +1 -0
- package/esm/tools/utils/numberUtils.d.ts +8 -0
- package/esm/tools/utils/numberUtils.js +17 -0
- package/esm/tools/utils/numberUtils.js.map +1 -0
- package/esm/tools/utils/objectUtils.d.ts +10 -0
- package/esm/tools/utils/objectUtils.js +19 -0
- package/esm/tools/utils/objectUtils.js.map +1 -0
- package/esm/tools/utils/polyfills.d.ts +24 -0
- package/esm/tools/utils/polyfills.js +95 -0
- package/esm/tools/utils/polyfills.js.map +1 -0
- package/esm/tools/utils/responseUtils.d.ts +2 -0
- package/esm/tools/utils/responseUtils.js +13 -0
- package/esm/tools/utils/responseUtils.js.map +1 -0
- package/esm/tools/utils/stringUtils.d.ts +7 -0
- package/esm/tools/utils/stringUtils.js +26 -0
- package/esm/tools/utils/stringUtils.js.map +1 -0
- package/esm/tools/utils/timeUtils.d.ts +57 -0
- package/esm/tools/utils/timeUtils.js +82 -0
- package/esm/tools/utils/timeUtils.js.map +1 -0
- package/esm/tools/utils/typeUtils.d.ts +4 -0
- package/esm/tools/utils/typeUtils.js +13 -0
- package/esm/tools/utils/typeUtils.js.map +1 -0
- package/esm/tools/utils/urlPolyfill.d.ts +14 -0
- package/esm/tools/utils/urlPolyfill.js +80 -0
- package/esm/tools/utils/urlPolyfill.js.map +1 -0
- package/esm/tools/valueHistory.d.ts +50 -0
- package/esm/tools/valueHistory.js +103 -0
- package/esm/tools/valueHistory.js.map +1 -0
- package/esm/transport/batch.d.ts +19 -0
- package/esm/transport/batch.js +76 -0
- package/esm/transport/batch.js.map +1 -0
- package/esm/transport/eventBridge.d.ts +12 -0
- package/esm/transport/eventBridge.js +29 -0
- package/esm/transport/eventBridge.js.map +1 -0
- package/esm/transport/flushController.d.ts +48 -0
- package/esm/transport/flushController.js +93 -0
- package/esm/transport/flushController.js.map +1 -0
- package/esm/transport/httpRequest.d.ts +37 -0
- package/esm/transport/httpRequest.js +85 -0
- package/esm/transport/httpRequest.js.map +1 -0
- package/esm/transport/index.d.ts +4 -0
- package/esm/transport/index.js +5 -0
- package/esm/transport/index.js.map +1 -0
- package/esm/transport/sendWithRetryStrategy.d.ts +39 -0
- package/esm/transport/sendWithRetryStrategy.js +146 -0
- package/esm/transport/sendWithRetryStrategy.js.map +1 -0
- package/esm/transport/startBatchWithReplica.d.ts +15 -0
- package/esm/transport/startBatchWithReplica.js +33 -0
- package/esm/transport/startBatchWithReplica.js.map +1 -0
- package/package.json +26 -0
- package/src/boot/init.ts +41 -0
- package/src/browser/addEventListener.ts +136 -0
- package/src/browser/cookie.ts +71 -0
- package/src/browser/fetchObservable.ts +112 -0
- package/src/browser/pageExitObservable.ts +69 -0
- package/src/browser/runOnReadyState.ts +15 -0
- package/src/browser/types.ts +40 -0
- package/src/browser/xhrObservable.ts +127 -0
- package/src/domain/configuration/configuration.ts +191 -0
- package/src/domain/configuration/endpointBuilder.ts +134 -0
- package/src/domain/configuration/index.ts +9 -0
- package/src/domain/configuration/intakeSites.ts +5 -0
- package/src/domain/configuration/tags.ts +43 -0
- package/src/domain/configuration/transportConfiguration.ts +71 -0
- package/src/domain/console/consoleObservable.ts +86 -0
- package/src/domain/deflate/index.ts +1 -0
- package/src/domain/deflate/types.ts +41 -0
- package/src/domain/error/error.ts +159 -0
- package/src/domain/error/error.types.ts +47 -0
- package/src/domain/error/trackRuntimeError.ts +21 -0
- package/src/domain/eventRateLimiter/createEventRateLimiter.ts +46 -0
- package/src/domain/report/browser.types.ts +26 -0
- package/src/domain/report/reportObservable.ts +126 -0
- package/src/domain/resourceUtils.ts +17 -0
- package/src/domain/session/oldCookiesMigration.ts +42 -0
- package/src/domain/session/sessionConstants.ts +4 -0
- package/src/domain/session/sessionManager.ts +98 -0
- package/src/domain/session/sessionState.ts +51 -0
- package/src/domain/session/sessionStore.ts +185 -0
- package/src/domain/session/sessionStoreOperations.ts +112 -0
- package/src/domain/session/storeStrategies/sessionInCookie.ts +56 -0
- package/src/domain/session/storeStrategies/sessionInLocalStorage.ts +41 -0
- package/src/domain/session/storeStrategies/sessionStoreStrategy.ts +12 -0
- package/src/domain/synthetics/syntheticsWorkerValues.ts +27 -0
- package/src/domain/telemetry/index.ts +14 -0
- package/src/domain/telemetry/rawTelemetryEvent.types.ts +14 -0
- package/src/domain/telemetry/telemetry.ts +195 -0
- package/src/domain/telemetry/telemetryEvent.types.ts +382 -0
- package/src/domain/tracekit/computeStackTrace.ts +141 -0
- package/src/domain/tracekit/index.ts +3 -0
- package/src/domain/tracekit/tracekit.ts +96 -0
- package/src/domain/tracekit/types.ts +47 -0
- package/src/domain/user/index.ts +2 -0
- package/src/domain/user/user.ts +33 -0
- package/src/domain/user/user.types.ts +6 -0
- package/src/index.ts +128 -0
- package/src/tools/abstractLifeCycle.ts +45 -0
- package/src/tools/boundedBuffer.ts +17 -0
- package/src/tools/catchUserErrors.ts +11 -0
- package/src/tools/display.ts +51 -0
- package/src/tools/experimentalFeatures.ts +43 -0
- package/src/tools/getGlobalObject.ts +31 -0
- package/src/tools/getZoneJsOriginalValue.ts +38 -0
- package/src/tools/instrumentMethod.ts +109 -0
- package/src/tools/matchOption.ts +32 -0
- package/src/tools/mergeInto.ts +177 -0
- package/src/tools/monitor.ts +68 -0
- package/src/tools/observable.ts +40 -0
- package/src/tools/readBytesFromStream.ts +77 -0
- package/src/tools/sendToExtension.ts +12 -0
- package/src/tools/serialisation/context.ts +8 -0
- package/src/tools/serialisation/contextManager.ts +79 -0
- package/src/tools/serialisation/heavyCustomerDataWarning.ts +26 -0
- package/src/tools/serialisation/jsonStringify.ts +53 -0
- package/src/tools/serialisation/sanitize.ts +255 -0
- package/src/tools/timer.ts +21 -0
- package/src/tools/utils/arrayUtils.ts +7 -0
- package/src/tools/utils/browserDetection.ts +7 -0
- package/src/tools/utils/byteUtils.ts +29 -0
- package/src/tools/utils/functionUtils.ts +47 -0
- package/src/tools/utils/numberUtils.ts +19 -0
- package/src/tools/utils/objectUtils.ts +21 -0
- package/src/tools/utils/polyfills.ts +127 -0
- package/src/tools/utils/responseUtils.ts +12 -0
- package/src/tools/utils/stringUtils.ts +28 -0
- package/src/tools/utils/timeUtils.ts +112 -0
- package/src/tools/utils/typeUtils.ts +12 -0
- package/src/tools/utils/urlPolyfill.ts +86 -0
- package/src/tools/valueHistory.ts +120 -0
- package/src/transport/batch.ts +92 -0
- package/src/transport/eventBridge.ts +42 -0
- package/src/transport/flushController.ts +129 -0
- package/src/transport/httpRequest.ts +150 -0
- package/src/transport/index.ts +4 -0
- package/src/transport/sendWithRetryStrategy.ts +203 -0
- package/src/transport/startBatchWithReplica.ts +52 -0
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import { catchUserErrors } from '../../tools/catchUserErrors'
|
|
2
|
+
import { display } from '../../tools/display'
|
|
3
|
+
import type { RawTelemetryConfiguration } from '../telemetry'
|
|
4
|
+
import { ExperimentalFeature, addExperimentalFeatures } from '../../tools/experimentalFeatures'
|
|
5
|
+
import type { Duration } from '../../tools/utils/timeUtils'
|
|
6
|
+
import { ONE_SECOND } from '../../tools/utils/timeUtils'
|
|
7
|
+
import { isPercentage } from '../../tools/utils/numberUtils'
|
|
8
|
+
import { ONE_KIBI_BYTE } from '../../tools/utils/byteUtils'
|
|
9
|
+
import { objectHasValue } from '../../tools/utils/objectUtils'
|
|
10
|
+
import { assign } from '../../tools/utils/polyfills'
|
|
11
|
+
import { selectSessionStoreStrategyType } from '../session/sessionStore'
|
|
12
|
+
import type { SessionStoreStrategyType } from '../session/storeStrategies/sessionStoreStrategy'
|
|
13
|
+
import type { TransportConfiguration } from './transportConfiguration'
|
|
14
|
+
import { computeTransportConfiguration } from './transportConfiguration'
|
|
15
|
+
|
|
16
|
+
export const DefaultPrivacyLevel = {
|
|
17
|
+
ALLOW: 'allow',
|
|
18
|
+
MASK: 'mask',
|
|
19
|
+
MASK_USER_INPUT: 'mask-user-input',
|
|
20
|
+
} as const
|
|
21
|
+
export type DefaultPrivacyLevel = (typeof DefaultPrivacyLevel)[keyof typeof DefaultPrivacyLevel]
|
|
22
|
+
|
|
23
|
+
export interface InitConfiguration {
|
|
24
|
+
// global options
|
|
25
|
+
clientToken: string
|
|
26
|
+
beforeSend?: GenericBeforeSendCallback | undefined
|
|
27
|
+
/**
|
|
28
|
+
* @deprecated use sessionSampleRate instead
|
|
29
|
+
*/
|
|
30
|
+
sampleRate?: number | undefined
|
|
31
|
+
sessionSampleRate?: number | undefined
|
|
32
|
+
telemetrySampleRate?: number | undefined
|
|
33
|
+
silentMultipleInit?: boolean | undefined
|
|
34
|
+
trackResources?: boolean | undefined
|
|
35
|
+
trackLongTasks?: boolean | undefined
|
|
36
|
+
|
|
37
|
+
// transport options
|
|
38
|
+
proxy?: string | undefined
|
|
39
|
+
/**
|
|
40
|
+
* @deprecated use `proxy` instead
|
|
41
|
+
*/
|
|
42
|
+
proxyUrl?: string | undefined
|
|
43
|
+
site?: string | undefined
|
|
44
|
+
|
|
45
|
+
// tag and context options
|
|
46
|
+
service: string | undefined
|
|
47
|
+
env: string | undefined
|
|
48
|
+
version: string | undefined
|
|
49
|
+
|
|
50
|
+
// cookie options
|
|
51
|
+
useCrossSiteSessionCookie?: boolean | undefined
|
|
52
|
+
useSecureSessionCookie?: boolean | undefined
|
|
53
|
+
trackSessionAcrossSubdomains?: boolean | undefined
|
|
54
|
+
|
|
55
|
+
// alternate storage option
|
|
56
|
+
allowFallbackToLocalStorage?: boolean | undefined
|
|
57
|
+
|
|
58
|
+
// internal options
|
|
59
|
+
enableExperimentalFeatures?: string[] | undefined
|
|
60
|
+
replica?: ReplicaUserConfiguration | undefined
|
|
61
|
+
datacenter?: string
|
|
62
|
+
internalAnalyticsSubdomain?: string
|
|
63
|
+
|
|
64
|
+
telemetryConfigurationSampleRate?: number
|
|
65
|
+
|
|
66
|
+
apiVersion: string
|
|
67
|
+
organizationIdentifier: string
|
|
68
|
+
insecureHTTP: boolean
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// This type is only used to build the core configuration. Logs and RUM SDKs are using a proper type
|
|
72
|
+
// for this option.
|
|
73
|
+
type GenericBeforeSendCallback = (event: any, context?: any) => unknown
|
|
74
|
+
|
|
75
|
+
interface ReplicaUserConfiguration {
|
|
76
|
+
applicationId?: string
|
|
77
|
+
clientToken: string
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export interface Configuration extends TransportConfiguration {
|
|
81
|
+
// Built from init configuration
|
|
82
|
+
beforeSend: GenericBeforeSendCallback | undefined
|
|
83
|
+
sessionStoreStrategyType: SessionStoreStrategyType | undefined
|
|
84
|
+
sessionSampleRate: number
|
|
85
|
+
telemetrySampleRate: number
|
|
86
|
+
telemetryConfigurationSampleRate: number
|
|
87
|
+
service: string | undefined
|
|
88
|
+
silentMultipleInit: boolean
|
|
89
|
+
|
|
90
|
+
// Event limits
|
|
91
|
+
eventRateLimiterThreshold: number // Limit the maximum number of actions, errors and logs per minutes
|
|
92
|
+
maxTelemetryEventsPerPage: number
|
|
93
|
+
|
|
94
|
+
// Batch configuration
|
|
95
|
+
batchBytesLimit: number
|
|
96
|
+
flushTimeout: Duration
|
|
97
|
+
batchMessagesLimit: number
|
|
98
|
+
messageBytesLimit: number
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export function validateAndBuildConfiguration(initConfiguration: InitConfiguration): Configuration | undefined {
|
|
102
|
+
if (!initConfiguration || !initConfiguration.clientToken) {
|
|
103
|
+
display.error('Client Token is not configured, we will not send any data.')
|
|
104
|
+
return
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
const sessionSampleRate = initConfiguration.sessionSampleRate ?? initConfiguration.sampleRate
|
|
108
|
+
if (sessionSampleRate !== undefined && !isPercentage(sessionSampleRate)) {
|
|
109
|
+
display.error('Session Sample Rate should be a number between 0 and 100')
|
|
110
|
+
return
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
if (initConfiguration.telemetrySampleRate !== undefined && !isPercentage(initConfiguration.telemetrySampleRate)) {
|
|
114
|
+
display.error('Telemetry Sample Rate should be a number between 0 and 100')
|
|
115
|
+
return
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
if (
|
|
119
|
+
initConfiguration.telemetryConfigurationSampleRate !== undefined &&
|
|
120
|
+
!isPercentage(initConfiguration.telemetryConfigurationSampleRate)
|
|
121
|
+
) {
|
|
122
|
+
display.error('Telemetry Configuration Sample Rate should be a number between 0 and 100')
|
|
123
|
+
return
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
// Set the experimental feature flags as early as possible, so we can use them in most places
|
|
127
|
+
if (Array.isArray(initConfiguration.enableExperimentalFeatures)) {
|
|
128
|
+
addExperimentalFeatures(
|
|
129
|
+
initConfiguration.enableExperimentalFeatures.filter((flag): flag is ExperimentalFeature =>
|
|
130
|
+
objectHasValue(ExperimentalFeature, flag)
|
|
131
|
+
)
|
|
132
|
+
)
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
return assign(
|
|
136
|
+
{
|
|
137
|
+
beforeSend:
|
|
138
|
+
initConfiguration.beforeSend && catchUserErrors(initConfiguration.beforeSend, 'beforeSend threw an error:'),
|
|
139
|
+
sessionStoreStrategyType: selectSessionStoreStrategyType(initConfiguration),
|
|
140
|
+
sessionSampleRate: sessionSampleRate ?? 100,
|
|
141
|
+
telemetrySampleRate: initConfiguration.telemetrySampleRate ?? 20,
|
|
142
|
+
telemetryConfigurationSampleRate: initConfiguration.telemetryConfigurationSampleRate ?? 5,
|
|
143
|
+
service: initConfiguration.service,
|
|
144
|
+
silentMultipleInit: !!initConfiguration.silentMultipleInit,
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* beacon payload max queue size implementation is 64kb
|
|
148
|
+
* ensure that we leave room for logs, rum and potential other users
|
|
149
|
+
*/
|
|
150
|
+
batchBytesLimit: 16 * ONE_KIBI_BYTE,
|
|
151
|
+
|
|
152
|
+
eventRateLimiterThreshold: 3000,
|
|
153
|
+
maxTelemetryEventsPerPage: 15,
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* flush automatically, aim to be lower than ALB connection timeout
|
|
157
|
+
* to maximize connection reuse.
|
|
158
|
+
*/
|
|
159
|
+
flushTimeout: (30 * ONE_SECOND) as Duration,
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* Logs intake limit
|
|
163
|
+
*/
|
|
164
|
+
batchMessagesLimit: 50,
|
|
165
|
+
messageBytesLimit: 256 * ONE_KIBI_BYTE,
|
|
166
|
+
|
|
167
|
+
apiVersion: initConfiguration.apiVersion ?? 'v1',
|
|
168
|
+
organizationIdentifier: initConfiguration.organizationIdentifier,
|
|
169
|
+
insecureHTTP: initConfiguration.insecureHTTP,
|
|
170
|
+
},
|
|
171
|
+
computeTransportConfiguration(initConfiguration)
|
|
172
|
+
)
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
export function serializeConfiguration(initConfiguration: InitConfiguration): Partial<RawTelemetryConfiguration> {
|
|
176
|
+
const proxy = initConfiguration.proxy ?? initConfiguration.proxyUrl
|
|
177
|
+
return {
|
|
178
|
+
session_sample_rate: initConfiguration.sessionSampleRate ?? initConfiguration.sampleRate,
|
|
179
|
+
telemetry_sample_rate: initConfiguration.telemetrySampleRate,
|
|
180
|
+
telemetry_configuration_sample_rate: initConfiguration.telemetryConfigurationSampleRate,
|
|
181
|
+
use_before_send: !!initConfiguration.beforeSend,
|
|
182
|
+
use_cross_site_session_cookie: initConfiguration.useCrossSiteSessionCookie,
|
|
183
|
+
use_secure_session_cookie: initConfiguration.useSecureSessionCookie,
|
|
184
|
+
use_proxy: proxy !== undefined ? !!proxy : undefined,
|
|
185
|
+
silent_multiple_init: initConfiguration.silentMultipleInit,
|
|
186
|
+
track_session_across_subdomains: initConfiguration.trackSessionAcrossSubdomains,
|
|
187
|
+
track_resources: initConfiguration.trackResources,
|
|
188
|
+
track_long_task: initConfiguration.trackLongTasks,
|
|
189
|
+
allow_fallback_to_local_storage: !!initConfiguration.allowFallbackToLocalStorage,
|
|
190
|
+
}
|
|
191
|
+
}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import type { RetryInfo, FlushReason } from '../../transport'
|
|
2
|
+
import { timeStampNow } from '../../tools/utils/timeUtils'
|
|
3
|
+
import { normalizeUrl } from '../../tools/utils/urlPolyfill'
|
|
4
|
+
import { ExperimentalFeature, isExperimentalFeatureEnabled } from '../../tools/experimentalFeatures'
|
|
5
|
+
import { generateUUID } from '../../tools/utils/stringUtils'
|
|
6
|
+
import type { InitConfiguration } from './configuration'
|
|
7
|
+
import { INTAKE_SITE_AP1, INTAKE_SITE_US1 } from './intakeSites'
|
|
8
|
+
|
|
9
|
+
// replaced at build time
|
|
10
|
+
declare const __BUILD_ENV__SDK_VERSION__: string
|
|
11
|
+
|
|
12
|
+
export const ENDPOINTS = {
|
|
13
|
+
logs: 'logs',
|
|
14
|
+
rum: 'rum',
|
|
15
|
+
sessionReplay: 'session-replay',
|
|
16
|
+
} as const
|
|
17
|
+
|
|
18
|
+
const INTAKE_TRACKS = {
|
|
19
|
+
logs: 'logs',
|
|
20
|
+
rum: 'rum',
|
|
21
|
+
sessionReplay: 'replay',
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export type EndpointType = keyof typeof ENDPOINTS
|
|
25
|
+
|
|
26
|
+
export type EndpointBuilder = ReturnType<typeof createEndpointBuilder>
|
|
27
|
+
|
|
28
|
+
export function createEndpointBuilder(
|
|
29
|
+
initConfiguration: InitConfiguration,
|
|
30
|
+
endpointType: EndpointType,
|
|
31
|
+
configurationTags: string[]
|
|
32
|
+
) {
|
|
33
|
+
const buildUrlWithParameters = createEndpointUrlWithParametersBuilder(initConfiguration, endpointType)
|
|
34
|
+
|
|
35
|
+
return {
|
|
36
|
+
build(api: 'xhr' | 'fetch' | 'beacon', flushReason?: FlushReason, retry?: RetryInfo) {
|
|
37
|
+
const parameters = buildEndpointParameters(
|
|
38
|
+
initConfiguration,
|
|
39
|
+
endpointType,
|
|
40
|
+
configurationTags,
|
|
41
|
+
api,
|
|
42
|
+
flushReason,
|
|
43
|
+
retry
|
|
44
|
+
)
|
|
45
|
+
return buildUrlWithParameters(parameters)
|
|
46
|
+
},
|
|
47
|
+
urlPrefix: buildUrlWithParameters(''),
|
|
48
|
+
endpointType,
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Create a function used to build a full endpoint url from provided parameters. The goal of this
|
|
54
|
+
* function is to pre-compute some parts of the URL to avoid re-computing everything on every
|
|
55
|
+
* request, as only parameters are changing.
|
|
56
|
+
*/
|
|
57
|
+
function createEndpointUrlWithParametersBuilder(
|
|
58
|
+
initConfiguration: InitConfiguration,
|
|
59
|
+
endpointType: EndpointType
|
|
60
|
+
): (parameters: string) => string {
|
|
61
|
+
const { proxy, proxyUrl, apiVersion, organizationIdentifier, insecureHTTP } = initConfiguration
|
|
62
|
+
|
|
63
|
+
const path = `/rum/${apiVersion}/${organizationIdentifier}/${INTAKE_TRACKS[endpointType]}`
|
|
64
|
+
|
|
65
|
+
if (proxy) {
|
|
66
|
+
const normalizedProxyUrl = normalizeUrl(proxy)
|
|
67
|
+
return (parameters) => `${normalizedProxyUrl}?ooforward=${encodeURIComponent(`${path}?${parameters}`)}`
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
const host = buildEndpointHost(initConfiguration, endpointType)
|
|
71
|
+
|
|
72
|
+
if (proxy === undefined && proxyUrl) {
|
|
73
|
+
// TODO: remove this in a future major.
|
|
74
|
+
const normalizedProxyUrl = normalizeUrl(proxyUrl)
|
|
75
|
+
return (parameters) =>
|
|
76
|
+
`${normalizedProxyUrl}?ooforward=${encodeURIComponent(`https://${host}${path}?${parameters}`)}`
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
const protocol = insecureHTTP ? 'http' : 'https'
|
|
80
|
+
|
|
81
|
+
return (parameters) => `${protocol}://${host}${path}?${parameters}`
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function buildEndpointHost(initConfiguration: InitConfiguration, endpointType: EndpointType) {
|
|
85
|
+
const { site = INTAKE_SITE_US1, internalAnalyticsSubdomain } = initConfiguration
|
|
86
|
+
|
|
87
|
+
return site;
|
|
88
|
+
if (internalAnalyticsSubdomain && site === INTAKE_SITE_US1) {
|
|
89
|
+
return `${internalAnalyticsSubdomain}.${INTAKE_SITE_US1}`
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
const domainParts = site.split('.')
|
|
93
|
+
const extension = domainParts.pop()
|
|
94
|
+
const subdomain = site !== INTAKE_SITE_AP1 ? `${ENDPOINTS[endpointType]}.` : ''
|
|
95
|
+
return `${subdomain}browser-intake-${domainParts.join('-')}.${extension!}`
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Build parameters to be used for an intake request. Parameters should be re-built for each
|
|
100
|
+
* request, as they change randomly.
|
|
101
|
+
*/
|
|
102
|
+
function buildEndpointParameters(
|
|
103
|
+
{ clientToken, internalAnalyticsSubdomain }: InitConfiguration,
|
|
104
|
+
endpointType: EndpointType,
|
|
105
|
+
configurationTags: string[],
|
|
106
|
+
api: 'xhr' | 'fetch' | 'beacon',
|
|
107
|
+
flushReason: FlushReason | undefined,
|
|
108
|
+
retry: RetryInfo | undefined
|
|
109
|
+
) {
|
|
110
|
+
const tags = [`sdk_version:${__BUILD_ENV__SDK_VERSION__}`, `api:${api}`].concat(configurationTags)
|
|
111
|
+
if (flushReason && isExperimentalFeatureEnabled(ExperimentalFeature.COLLECT_FLUSH_REASON)) {
|
|
112
|
+
tags.push(`flush_reason:${flushReason}`)
|
|
113
|
+
}
|
|
114
|
+
if (retry) {
|
|
115
|
+
tags.push(`retry_count:${retry.count}`, `retry_after:${retry.lastFailureStatus}`)
|
|
116
|
+
}
|
|
117
|
+
const parameters = [
|
|
118
|
+
'oosource=browser',
|
|
119
|
+
`ootags=${encodeURIComponent(tags.join(','))}`,
|
|
120
|
+
`oo-api-key=${clientToken}`,
|
|
121
|
+
`oo-evp-origin-version=${encodeURIComponent(__BUILD_ENV__SDK_VERSION__)}`,
|
|
122
|
+
'oo-evp-origin=browser',
|
|
123
|
+
`oo-request-id=${generateUUID()}`,
|
|
124
|
+
]
|
|
125
|
+
|
|
126
|
+
if (endpointType === 'rum') {
|
|
127
|
+
parameters.push(`batch_time=${timeStampNow()}`)
|
|
128
|
+
}
|
|
129
|
+
if (internalAnalyticsSubdomain) {
|
|
130
|
+
parameters.reverse()
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
return parameters.join('&')
|
|
134
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export {
|
|
2
|
+
Configuration,
|
|
3
|
+
InitConfiguration,
|
|
4
|
+
DefaultPrivacyLevel,
|
|
5
|
+
validateAndBuildConfiguration,
|
|
6
|
+
serializeConfiguration,
|
|
7
|
+
} from './configuration'
|
|
8
|
+
export { createEndpointBuilder, EndpointBuilder, EndpointType } from './endpointBuilder'
|
|
9
|
+
export * from './intakeSites'
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export const INTAKE_SITE_STAGING = 'alpha1-api.dev.zinclabs.dev'
|
|
2
|
+
export const INTAKE_SITE_US1 = 'api.openobserve.ai'
|
|
3
|
+
export const INTAKE_SITE_EU1 = 'api.openobserve.ai'
|
|
4
|
+
export const INTAKE_SITE_AP1 = 'api.openobserve.ai'
|
|
5
|
+
export const INTAKE_SITE_US1_FED = 'api.openobserve.ai'
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { display } from '../../tools/display'
|
|
2
|
+
import type { InitConfiguration } from './configuration'
|
|
3
|
+
|
|
4
|
+
export const TAG_SIZE_LIMIT = 200
|
|
5
|
+
|
|
6
|
+
export function buildTags(configuration: InitConfiguration): string[] {
|
|
7
|
+
const { env, service, version, datacenter } = configuration
|
|
8
|
+
const tags = []
|
|
9
|
+
|
|
10
|
+
if (env) {
|
|
11
|
+
tags.push(buildTag('env', env))
|
|
12
|
+
}
|
|
13
|
+
if (service) {
|
|
14
|
+
tags.push(buildTag('service', service))
|
|
15
|
+
}
|
|
16
|
+
if (version) {
|
|
17
|
+
tags.push(buildTag('version', version))
|
|
18
|
+
}
|
|
19
|
+
if (datacenter) {
|
|
20
|
+
tags.push(buildTag('datacenter', datacenter))
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
return tags
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const FORBIDDEN_CHARACTERS = /[^a-z0-9_:./-]/
|
|
27
|
+
|
|
28
|
+
export function buildTag(key: string, rawValue: string) {
|
|
29
|
+
// See https://docs.datadoghq.com/getting_started/tagging/#defining-tags for tags syntax. Note
|
|
30
|
+
// that the backend may not follow the exact same rules, so we only want to display an informal
|
|
31
|
+
// warning.
|
|
32
|
+
const valueSizeLimit = TAG_SIZE_LIMIT - key.length - 1
|
|
33
|
+
|
|
34
|
+
if (rawValue.length > valueSizeLimit || FORBIDDEN_CHARACTERS.test(rawValue)) {
|
|
35
|
+
display.warn(`${key} value doesn't meet tag requirements and will be sanitized`)
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// Let the backend do most of the sanitization, but still make sure multiple tags can't be crafted
|
|
39
|
+
// by forging a value containing commas.
|
|
40
|
+
const sanitizedValue = rawValue.replace(/,/g, '_')
|
|
41
|
+
|
|
42
|
+
return `${key}:${sanitizedValue}`
|
|
43
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { objectValues, assign } from '../../tools/utils/polyfills'
|
|
2
|
+
import type { InitConfiguration } from './configuration'
|
|
3
|
+
import type { EndpointBuilder } from './endpointBuilder'
|
|
4
|
+
import { createEndpointBuilder } from './endpointBuilder'
|
|
5
|
+
import { buildTags } from './tags'
|
|
6
|
+
import { INTAKE_SITE_US1 } from './intakeSites'
|
|
7
|
+
|
|
8
|
+
export interface TransportConfiguration {
|
|
9
|
+
logsEndpointBuilder: EndpointBuilder
|
|
10
|
+
rumEndpointBuilder: EndpointBuilder
|
|
11
|
+
sessionReplayEndpointBuilder: EndpointBuilder
|
|
12
|
+
isIntakeUrl: (url: string) => boolean
|
|
13
|
+
replica?: ReplicaConfiguration
|
|
14
|
+
site: string
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface ReplicaConfiguration {
|
|
18
|
+
applicationId?: string
|
|
19
|
+
logsEndpointBuilder: EndpointBuilder
|
|
20
|
+
rumEndpointBuilder: EndpointBuilder
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export function computeTransportConfiguration(initConfiguration: InitConfiguration): TransportConfiguration {
|
|
24
|
+
const tags = buildTags(initConfiguration)
|
|
25
|
+
|
|
26
|
+
const endpointBuilders = computeEndpointBuilders(initConfiguration, tags)
|
|
27
|
+
const intakeUrlPrefixes = objectValues(endpointBuilders).map((builder) => builder.urlPrefix)
|
|
28
|
+
|
|
29
|
+
const replicaConfiguration = computeReplicaConfiguration(initConfiguration, intakeUrlPrefixes, tags)
|
|
30
|
+
|
|
31
|
+
return assign(
|
|
32
|
+
{
|
|
33
|
+
isIntakeUrl: (url: string) => intakeUrlPrefixes.some((intakeEndpoint) => url.indexOf(intakeEndpoint) === 0),
|
|
34
|
+
replica: replicaConfiguration,
|
|
35
|
+
site: initConfiguration.site || INTAKE_SITE_US1,
|
|
36
|
+
},
|
|
37
|
+
endpointBuilders
|
|
38
|
+
)
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function computeEndpointBuilders(initConfiguration: InitConfiguration, tags: string[]) {
|
|
42
|
+
return {
|
|
43
|
+
logsEndpointBuilder: createEndpointBuilder(initConfiguration, 'logs', tags),
|
|
44
|
+
rumEndpointBuilder: createEndpointBuilder(initConfiguration, 'rum', tags),
|
|
45
|
+
sessionReplayEndpointBuilder: createEndpointBuilder(initConfiguration, 'sessionReplay', tags),
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function computeReplicaConfiguration(
|
|
50
|
+
initConfiguration: InitConfiguration,
|
|
51
|
+
intakeUrlPrefixes: string[],
|
|
52
|
+
tags: string[]
|
|
53
|
+
): ReplicaConfiguration | undefined {
|
|
54
|
+
if (!initConfiguration.replica) {
|
|
55
|
+
return
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const replicaConfiguration: InitConfiguration = assign({}, initConfiguration, {
|
|
59
|
+
site: INTAKE_SITE_US1,
|
|
60
|
+
clientToken: initConfiguration.replica.clientToken,
|
|
61
|
+
})
|
|
62
|
+
|
|
63
|
+
const replicaEndpointBuilders = {
|
|
64
|
+
logsEndpointBuilder: createEndpointBuilder(replicaConfiguration, 'logs', tags),
|
|
65
|
+
rumEndpointBuilder: createEndpointBuilder(replicaConfiguration, 'rum', tags),
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
intakeUrlPrefixes.push(...objectValues(replicaEndpointBuilders).map((builder) => builder.urlPrefix))
|
|
69
|
+
|
|
70
|
+
return assign({ applicationId: initConfiguration.replica.applicationId }, replicaEndpointBuilders)
|
|
71
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { computeStackTrace } from '../tracekit'
|
|
2
|
+
import { createHandlingStack, formatErrorMessage, toStackTraceString, tryToGetFingerprint } from '../error/error'
|
|
3
|
+
import { mergeObservables, Observable } from '../../tools/observable'
|
|
4
|
+
import { ConsoleApiName, globalConsole } from '../../tools/display'
|
|
5
|
+
import { callMonitored } from '../../tools/monitor'
|
|
6
|
+
import { sanitize } from '../../tools/serialisation/sanitize'
|
|
7
|
+
import { find } from '../../tools/utils/polyfills'
|
|
8
|
+
import { jsonStringify } from '../../tools/serialisation/jsonStringify'
|
|
9
|
+
|
|
10
|
+
export interface ConsoleLog {
|
|
11
|
+
message: string
|
|
12
|
+
api: ConsoleApiName
|
|
13
|
+
stack?: string
|
|
14
|
+
handlingStack?: string
|
|
15
|
+
fingerprint?: string
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
let consoleObservablesByApi: { [k in ConsoleApiName]?: Observable<ConsoleLog> } = {}
|
|
19
|
+
|
|
20
|
+
export function initConsoleObservable(apis: ConsoleApiName[]) {
|
|
21
|
+
const consoleObservables = apis.map((api) => {
|
|
22
|
+
if (!consoleObservablesByApi[api]) {
|
|
23
|
+
consoleObservablesByApi[api] = createConsoleObservable(api)
|
|
24
|
+
}
|
|
25
|
+
return consoleObservablesByApi[api]!
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
return mergeObservables<ConsoleLog>(...consoleObservables)
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export function resetConsoleObservable() {
|
|
32
|
+
consoleObservablesByApi = {}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function createConsoleObservable(api: ConsoleApiName) {
|
|
36
|
+
const observable = new Observable<ConsoleLog>(() => {
|
|
37
|
+
const originalConsoleApi = globalConsole[api]
|
|
38
|
+
|
|
39
|
+
globalConsole[api] = (...params: unknown[]) => {
|
|
40
|
+
originalConsoleApi.apply(console, params)
|
|
41
|
+
const handlingStack = createHandlingStack()
|
|
42
|
+
|
|
43
|
+
callMonitored(() => {
|
|
44
|
+
observable.notify(buildConsoleLog(params, api, handlingStack))
|
|
45
|
+
})
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return () => {
|
|
49
|
+
globalConsole[api] = originalConsoleApi
|
|
50
|
+
}
|
|
51
|
+
})
|
|
52
|
+
|
|
53
|
+
return observable
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function buildConsoleLog(params: unknown[], api: ConsoleApiName, handlingStack: string): ConsoleLog {
|
|
57
|
+
// Todo: remove console error prefix in the next major version
|
|
58
|
+
let message = params.map((param) => formatConsoleParameters(param)).join(' ')
|
|
59
|
+
let stack
|
|
60
|
+
let fingerprint
|
|
61
|
+
|
|
62
|
+
if (api === ConsoleApiName.error) {
|
|
63
|
+
const firstErrorParam = find(params, (param: unknown): param is Error => param instanceof Error)
|
|
64
|
+
stack = firstErrorParam ? toStackTraceString(computeStackTrace(firstErrorParam)) : undefined
|
|
65
|
+
fingerprint = tryToGetFingerprint(firstErrorParam)
|
|
66
|
+
message = `console error: ${message}`
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return {
|
|
70
|
+
api,
|
|
71
|
+
message,
|
|
72
|
+
stack,
|
|
73
|
+
handlingStack,
|
|
74
|
+
fingerprint,
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function formatConsoleParameters(param: unknown) {
|
|
79
|
+
if (typeof param === 'string') {
|
|
80
|
+
return sanitize(param)
|
|
81
|
+
}
|
|
82
|
+
if (param instanceof Error) {
|
|
83
|
+
return formatErrorMessage(computeStackTrace(param))
|
|
84
|
+
}
|
|
85
|
+
return jsonStringify(sanitize(param), undefined, 2)
|
|
86
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './types'
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export type DeflateWorkerAction =
|
|
2
|
+
// Action to send when creating the worker to check if the communication is working correctly.
|
|
3
|
+
// The worker should respond with a 'initialized' response.
|
|
4
|
+
| {
|
|
5
|
+
action: 'init'
|
|
6
|
+
}
|
|
7
|
+
// Action to send when writing some unfinished data. The worker will respond with a 'wrote'
|
|
8
|
+
// response, with the same id and measurements of the wrote data bytes count.
|
|
9
|
+
| {
|
|
10
|
+
action: 'write'
|
|
11
|
+
id: number
|
|
12
|
+
streamId: number
|
|
13
|
+
data: string
|
|
14
|
+
}
|
|
15
|
+
// Action to send when all data has been written and the state of the stream needs to be reset.
|
|
16
|
+
| {
|
|
17
|
+
action: 'reset'
|
|
18
|
+
streamId: number
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export type DeflateWorkerResponse =
|
|
22
|
+
// Response to 'init' action
|
|
23
|
+
| {
|
|
24
|
+
type: 'initialized'
|
|
25
|
+
version: string
|
|
26
|
+
}
|
|
27
|
+
// Response to 'write' action
|
|
28
|
+
| {
|
|
29
|
+
type: 'wrote'
|
|
30
|
+
id: number
|
|
31
|
+
streamId: number
|
|
32
|
+
result: Uint8Array
|
|
33
|
+
trailer: Uint8Array
|
|
34
|
+
additionalBytesCount: number
|
|
35
|
+
}
|
|
36
|
+
// Could happen at any time when something goes wrong in the worker
|
|
37
|
+
| {
|
|
38
|
+
type: 'errored'
|
|
39
|
+
streamId?: number
|
|
40
|
+
error: Error | string
|
|
41
|
+
}
|