@datadog/mobile-react-native 2.14.0 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/DatadogSDKReactNative.podspec +6 -6
- package/README.md +23 -13
- package/android/build.gradle +10 -11
- package/android/gradle.properties +1 -1
- package/android/src/main/kotlin/com/datadog/reactnative/DatadogSDKWrapper.kt +36 -93
- package/android/src/main/kotlin/com/datadog/reactnative/DatadogWrapper.kt +46 -59
- package/android/src/main/kotlin/com/datadog/reactnative/DdLogsImplementation.kt +2 -1
- package/android/src/main/kotlin/com/datadog/reactnative/DdRumImplementation.kt +98 -0
- package/android/src/main/kotlin/com/datadog/reactnative/DdSdkConfiguration.kt +125 -75
- package/android/src/main/kotlin/com/datadog/reactnative/DdSdkConfigurationExt.kt +199 -90
- package/android/src/main/kotlin/com/datadog/reactnative/DdSdkImplementation.kt +151 -24
- package/android/src/main/kotlin/com/datadog/reactnative/DdSdkNativeInitialization.kt +57 -33
- package/android/src/main/kotlin/com/datadog/reactnative/DdSdkReactNativePackage.kt +2 -1
- package/android/src/main/kotlin/com/datadog/reactnative/DdTelemetry.kt +96 -0
- package/android/src/main/kotlin/com/datadog/reactnative/DdTraceImplementation.kt +20 -19
- package/android/src/main/kotlin/com/datadog/reactnative/SdkVersion.kt +1 -1
- package/android/src/newarch/kotlin/com/datadog/reactnative/DdRum.kt +100 -1
- package/android/src/newarch/kotlin/com/datadog/reactnative/DdSdk.kt +68 -14
- package/android/src/oldarch/kotlin/com/datadog/reactnative/DdRum.kt +94 -0
- package/android/src/oldarch/kotlin/com/datadog/reactnative/DdSdk.kt +70 -11
- package/android/src/test/kotlin/com/datadog/reactnative/DdRumTest.kt +58 -0
- package/android/src/test/kotlin/com/datadog/reactnative/DdSdkNativeInitializationTest.kt +63 -43
- package/android/src/test/kotlin/com/datadog/reactnative/DdSdkTest.kt +2024 -1199
- package/android/src/test/kotlin/com/datadog/reactnative/DdTraceTest.kt +44 -40
- package/android/src/test/kotlin/com/datadog/tools/unit/DdSdkConfigurationExt.kt +60 -91
- package/android/src/test/kotlin/com/datadog/tools/unit/MockRumMonitor.kt +34 -14
- package/android/src/test/kotlin/com/datadog/tools/unit/forge/DdSdkConfigurationForgeryFactory.kt +47 -43
- package/android/src/test/kotlin/com/datadog/tools/unit/forge/TelemetryConfigurationEventForgeryFactory.kt +0 -1
- package/android/src/test/resources/input/complete-configuration.json +32 -28
- package/android/src/test/resources/input/malformed-configuration.json +1 -1
- package/android/src/test/resources/input/minimal-configuration.json +4 -2
- package/datadog-configuration.schema.json +187 -139
- package/datadog-sourcemaps.gradle +2 -1
- package/ios/Sources/AnyEncodable.swift +14 -7
- package/ios/Sources/Attributes.swift +0 -7
- package/ios/Sources/DatadogSDKWrapper.swift +12 -128
- package/ios/Sources/DdLogsImplementation.swift +9 -39
- package/ios/Sources/DdRum.mm +89 -1
- package/ios/Sources/DdRumImplementation.swift +79 -0
- package/ios/Sources/DdSdk.mm +76 -11
- package/ios/Sources/DdSdkConfiguration.swift +159 -117
- package/ios/Sources/DdSdkImplementation.swift +235 -82
- package/ios/Sources/DdSdkNativeInitialization.swift +116 -80
- package/ios/Sources/DdTelemetry.swift +49 -0
- package/ios/Sources/GlobalState.swift +1 -1
- package/ios/Sources/RNDdSdkConfiguration.swift +334 -172
- package/ios/Sources/SdkVersion.swift +1 -1
- package/jest/mock.js +43 -4
- package/lib/commonjs/DdAttributes.js.map +1 -0
- package/lib/commonjs/DdSdkReactNative.js +159 -56
- package/lib/commonjs/DdSdkReactNative.js.map +1 -1
- package/lib/commonjs/InternalLog.js +1 -1
- package/lib/commonjs/config/DatadogProviderConfiguration.js +25 -0
- package/lib/commonjs/config/DatadogProviderConfiguration.js.map +1 -0
- package/lib/commonjs/config/FileBasedConfiguration.js +349 -0
- package/lib/commonjs/config/FileBasedConfiguration.js.map +1 -0
- package/lib/commonjs/config/FileBasedConfiguration.type.js +6 -0
- package/lib/commonjs/config/FileBasedConfiguration.type.js.map +1 -0
- package/lib/commonjs/config/async/AutoInstrumentationConfiguration.js +51 -0
- package/lib/commonjs/config/async/AutoInstrumentationConfiguration.js.map +1 -0
- package/lib/commonjs/config/async/PartialInitializationConfiguration.js +6 -0
- package/lib/commonjs/config/async/PartialInitializationConfiguration.js.map +1 -0
- package/lib/commonjs/config/async/asyncInitializationHelper.js +44 -0
- package/lib/commonjs/config/async/asyncInitializationHelper.js.map +1 -0
- package/lib/commonjs/config/features/CoreConfiguration.js +104 -0
- package/lib/commonjs/config/features/CoreConfiguration.js.map +1 -0
- package/lib/commonjs/config/features/CoreConfiguration.type.js +6 -0
- package/lib/commonjs/config/features/CoreConfiguration.type.js.map +1 -0
- package/lib/commonjs/config/features/CoreConfigurationNative.js +38 -0
- package/lib/commonjs/config/features/CoreConfigurationNative.js.map +1 -0
- package/lib/commonjs/config/features/LogsConfiguration.js +36 -0
- package/lib/commonjs/config/features/LogsConfiguration.js.map +1 -0
- package/lib/commonjs/config/features/LogsConfiguration.type.js +6 -0
- package/lib/commonjs/config/features/LogsConfiguration.type.js.map +1 -0
- package/lib/commonjs/config/features/LogsConfigurationNative.js +2 -0
- package/lib/commonjs/config/features/LogsConfigurationNative.js.map +1 -0
- package/lib/commonjs/config/features/RumConfiguration.js +120 -0
- package/lib/commonjs/config/features/RumConfiguration.js.map +1 -0
- package/lib/commonjs/config/features/RumConfiguration.type.js +6 -0
- package/lib/commonjs/config/features/RumConfiguration.type.js.map +1 -0
- package/lib/commonjs/config/features/RumConfigurationNative.js +2 -0
- package/lib/commonjs/config/features/RumConfigurationNative.js.map +1 -0
- package/lib/commonjs/config/features/TraceConfiguration.js +24 -0
- package/lib/commonjs/config/features/TraceConfiguration.js.map +1 -0
- package/lib/commonjs/config/features/TraceConfiguration.type.js +2 -0
- package/lib/commonjs/config/features/TraceConfiguration.type.js.map +1 -0
- package/lib/commonjs/config/features/TraceConfigurationNative.js +2 -0
- package/lib/commonjs/config/features/TraceConfigurationNative.js.map +1 -0
- package/lib/commonjs/config/types/BatchProcessingLevel.js +30 -0
- package/lib/commonjs/config/types/BatchProcessingLevel.js.map +1 -0
- package/lib/commonjs/config/types/BatchSize.js +31 -0
- package/lib/commonjs/config/types/BatchSize.js.map +1 -0
- package/lib/commonjs/config/types/InitializationMode.js +17 -0
- package/lib/commonjs/config/types/InitializationMode.js.map +1 -0
- package/lib/commonjs/config/types/InitializationModeForTelemetry.js +2 -0
- package/lib/commonjs/config/types/InitializationModeForTelemetry.js.map +1 -0
- package/lib/commonjs/{ProxyConfiguration.js → config/types/ProxyConfiguration.js} +6 -0
- package/lib/commonjs/config/types/ProxyConfiguration.js.map +1 -0
- package/lib/commonjs/config/types/SdkVerbosity.js.map +1 -0
- package/lib/commonjs/config/types/TrackingConsent.js.map +1 -0
- package/lib/commonjs/config/types/UploadFrequency.js +30 -0
- package/lib/commonjs/config/types/UploadFrequency.js.map +1 -0
- package/lib/commonjs/config/types/VitalsUpdateFrequency.js +19 -0
- package/lib/commonjs/config/types/VitalsUpdateFrequency.js.map +1 -0
- package/lib/commonjs/config/types/index.js +68 -0
- package/lib/commonjs/config/types/index.js.map +1 -0
- package/lib/commonjs/index.js +51 -21
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/logs/DdLogs.js +13 -9
- package/lib/commonjs/logs/DdLogs.js.map +1 -1
- package/lib/commonjs/logs/eventMapper.js +4 -1
- package/lib/commonjs/logs/eventMapper.js.map +1 -1
- package/lib/commonjs/metro/plugin/metroSerializer.js.map +1 -1
- package/lib/commonjs/nativeModulesTypes.js +0 -45
- package/lib/commonjs/nativeModulesTypes.js.map +1 -1
- package/lib/commonjs/rum/DdRum.js +56 -28
- package/lib/commonjs/rum/DdRum.js.map +1 -1
- package/lib/commonjs/rum/helper.js +63 -0
- package/lib/commonjs/rum/helper.js.map +1 -0
- package/lib/commonjs/rum/instrumentation/DdRumErrorTracking.js +14 -18
- package/lib/commonjs/rum/instrumentation/DdRumErrorTracking.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/interactionTracking/DdBabelInteractionTracking.js +16 -27
- package/lib/commonjs/rum/instrumentation/interactionTracking/DdBabelInteractionTracking.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/interactionTracking/DdEventsInterceptor.js +1 -1
- package/lib/commonjs/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.js +15 -5
- package/lib/commonjs/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/DdRumResourceTracking.js +34 -22
- package/lib/commonjs/rum/instrumentation/resourceTracking/DdRumResourceTracking.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/DatadogTracingContext.js +21 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/DatadogTracingContext.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/TracingIdentifier.js +16 -3
- package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/TracingIdentifier.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/distributedTracing.js +10 -12
- package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/distributedTracing.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingAttributes.js +6 -0
- package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingAttributes.js.map +1 -0
- package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingHeaders.js +41 -47
- package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingHeaders.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingSampling.js +62 -0
- package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingSampling.js.map +1 -0
- package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/firstPartyHosts.js +1 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/headers.js +36 -0
- package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/headers.js.map +1 -0
- package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/URLHostParser.js +1 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/XHRProxy.js +19 -8
- package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/XHRProxy.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/baggageHeaderUtils.js +90 -48
- package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/baggageHeaderUtils.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/responseSize.js +1 -1
- package/lib/commonjs/rum/types.js +1 -9
- package/lib/commonjs/rum/types.js.map +1 -1
- package/lib/commonjs/sdk/AccountInfoSingleton/AccountInfoSingleton.js +46 -0
- package/lib/commonjs/sdk/AccountInfoSingleton/AccountInfoSingleton.js.map +1 -0
- package/lib/commonjs/sdk/AccountInfoSingleton/types.js +2 -0
- package/lib/commonjs/sdk/AccountInfoSingleton/types.js.map +1 -0
- package/lib/commonjs/sdk/AttributesEncoding/attributesEncoding.js +51 -0
- package/lib/commonjs/sdk/AttributesEncoding/attributesEncoding.js.map +1 -0
- package/lib/commonjs/sdk/AttributesEncoding/defaultEncoders.js +140 -0
- package/lib/commonjs/sdk/AttributesEncoding/defaultEncoders.js.map +1 -0
- package/lib/commonjs/{utils → sdk/AttributesEncoding}/errorUtils.js +39 -22
- package/lib/commonjs/sdk/AttributesEncoding/errorUtils.js.map +1 -0
- package/lib/commonjs/sdk/AttributesEncoding/helpers.js +123 -0
- package/lib/commonjs/sdk/AttributesEncoding/helpers.js.map +1 -0
- package/lib/commonjs/sdk/AttributesEncoding/types.js +2 -0
- package/lib/commonjs/sdk/AttributesEncoding/types.js.map +1 -0
- package/lib/commonjs/sdk/AttributesEncoding/utils.js +36 -0
- package/lib/commonjs/sdk/AttributesEncoding/utils.js.map +1 -0
- package/lib/commonjs/sdk/AttributesSingleton/AttributesSingleton.js +27 -1
- package/lib/commonjs/sdk/AttributesSingleton/AttributesSingleton.js.map +1 -1
- package/lib/commonjs/sdk/DatadogInternalBridge/DdSdkInternalNativeBridge.js +3 -3
- package/lib/commonjs/sdk/DatadogInternalBridge/DdSdkInternalNativeBridge.js.map +1 -1
- package/lib/commonjs/sdk/DatadogInternalBridge/DdSdkInternalNativeBridgeEvent.js +1 -1
- package/lib/commonjs/sdk/DatadogProvider/Buffer/BoundedBuffer.js +4 -4
- package/lib/commonjs/sdk/DatadogProvider/Buffer/BoundedBuffer.js.map +1 -1
- package/lib/commonjs/sdk/DatadogProvider/DatadogProvider.js +10 -9
- package/lib/commonjs/sdk/DatadogProvider/DatadogProvider.js.map +1 -1
- package/lib/commonjs/sdk/DatadogProvider/DatadogProviderState.js +28 -0
- package/lib/commonjs/sdk/DatadogProvider/DatadogProviderState.js.map +1 -0
- package/lib/commonjs/sdk/DdSdk.js +4 -2
- package/lib/commonjs/sdk/DdSdk.js.map +1 -1
- package/lib/commonjs/sdk/DdSdkInternal.js +86 -0
- package/lib/commonjs/sdk/DdSdkInternal.js.map +1 -0
- package/lib/commonjs/sdk/EventMappers/EventMapper.js +6 -3
- package/lib/commonjs/sdk/EventMappers/EventMapper.js.map +1 -1
- package/lib/commonjs/sdk/GlobalState/GlobalState.js +5 -11
- package/lib/commonjs/sdk/GlobalState/GlobalState.js.map +1 -1
- package/lib/commonjs/sdk/UserInfoSingleton/UserInfoSingleton.js +6 -1
- package/lib/commonjs/sdk/UserInfoSingleton/UserInfoSingleton.js.map +1 -1
- package/lib/commonjs/specs/NativeDdRum.js.map +1 -1
- package/lib/commonjs/specs/NativeDdSdk.js.map +1 -1
- package/lib/commonjs/trace/DdTrace.js +7 -5
- package/lib/commonjs/trace/DdTrace.js.map +1 -1
- package/lib/commonjs/types.js +19 -46
- package/lib/commonjs/types.js.map +1 -1
- package/lib/commonjs/utils/longTasksUtils.js.map +1 -1
- package/lib/commonjs/utils/singletonUtils.js +21 -0
- package/lib/commonjs/utils/singletonUtils.js.map +1 -0
- package/lib/commonjs/version.js +1 -1
- package/lib/commonjs/version.js.map +1 -1
- package/lib/module/DdAttributes.js.map +1 -0
- package/lib/module/DdSdkReactNative.js +155 -52
- package/lib/module/DdSdkReactNative.js.map +1 -1
- package/lib/module/InternalLog.js +1 -1
- package/lib/module/InternalLog.js.map +1 -1
- package/lib/module/config/DatadogProviderConfiguration.js +18 -0
- package/lib/module/config/DatadogProviderConfiguration.js.map +1 -0
- package/lib/module/config/FileBasedConfiguration.js +341 -0
- package/lib/module/config/FileBasedConfiguration.js.map +1 -0
- package/lib/module/config/FileBasedConfiguration.type.js +2 -0
- package/lib/module/config/FileBasedConfiguration.type.js.map +1 -0
- package/lib/module/config/async/AutoInstrumentationConfiguration.js +45 -0
- package/lib/module/config/async/AutoInstrumentationConfiguration.js.map +1 -0
- package/lib/module/config/async/PartialInitializationConfiguration.js +2 -0
- package/lib/module/config/async/PartialInitializationConfiguration.js.map +1 -0
- package/lib/module/config/async/asyncInitializationHelper.js +36 -0
- package/lib/module/config/async/asyncInitializationHelper.js.map +1 -0
- package/lib/module/config/features/CoreConfiguration.js +98 -0
- package/lib/module/config/features/CoreConfiguration.js.map +1 -0
- package/lib/module/config/features/CoreConfiguration.type.js +2 -0
- package/lib/module/config/features/CoreConfiguration.type.js.map +1 -0
- package/lib/module/config/features/CoreConfigurationNative.js +31 -0
- package/lib/module/config/features/CoreConfigurationNative.js.map +1 -0
- package/lib/module/config/features/LogsConfiguration.js +30 -0
- package/lib/module/config/features/LogsConfiguration.js.map +1 -0
- package/lib/module/config/features/LogsConfiguration.type.js +2 -0
- package/lib/module/config/features/LogsConfiguration.type.js.map +1 -0
- package/lib/module/config/features/LogsConfigurationNative.js +2 -0
- package/lib/module/config/features/LogsConfigurationNative.js.map +1 -0
- package/lib/module/config/features/RumConfiguration.js +114 -0
- package/lib/module/config/features/RumConfiguration.js.map +1 -0
- package/lib/module/config/features/RumConfiguration.type.js +2 -0
- package/lib/module/config/features/RumConfiguration.type.js.map +1 -0
- package/lib/module/config/features/RumConfigurationNative.js +2 -0
- package/lib/module/config/features/RumConfigurationNative.js.map +1 -0
- package/lib/module/config/features/TraceConfiguration.js +18 -0
- package/lib/module/config/features/TraceConfiguration.js.map +1 -0
- package/lib/module/config/features/TraceConfiguration.type.js +2 -0
- package/lib/module/config/features/TraceConfiguration.type.js.map +1 -0
- package/lib/module/config/features/TraceConfigurationNative.js +2 -0
- package/lib/module/config/features/TraceConfigurationNative.js.map +1 -0
- package/lib/module/config/types/BatchProcessingLevel.js +25 -0
- package/lib/module/config/types/BatchProcessingLevel.js.map +1 -0
- package/lib/module/config/types/BatchSize.js +26 -0
- package/lib/module/config/types/BatchSize.js.map +1 -0
- package/lib/module/config/types/InitializationMode.js +11 -0
- package/lib/module/config/types/InitializationMode.js.map +1 -0
- package/lib/module/config/types/InitializationModeForTelemetry.js +2 -0
- package/lib/module/config/types/InitializationModeForTelemetry.js.map +1 -0
- package/lib/module/{ProxyConfiguration.js → config/types/ProxyConfiguration.js} +6 -0
- package/lib/module/config/types/ProxyConfiguration.js.map +1 -0
- package/lib/module/config/types/SdkVerbosity.js.map +1 -0
- package/lib/module/config/types/TrackingConsent.js.map +1 -0
- package/lib/module/config/types/UploadFrequency.js +25 -0
- package/lib/module/config/types/UploadFrequency.js.map +1 -0
- package/lib/module/config/types/VitalsUpdateFrequency.js +13 -0
- package/lib/module/config/types/VitalsUpdateFrequency.js.map +1 -0
- package/lib/module/config/types/index.js +15 -0
- package/lib/module/config/types/index.js.map +1 -0
- package/lib/module/index.js +13 -7
- package/lib/module/index.js.map +1 -1
- package/lib/module/logs/DdLogs.js +13 -9
- package/lib/module/logs/DdLogs.js.map +1 -1
- package/lib/module/logs/eventMapper.js +4 -1
- package/lib/module/logs/eventMapper.js.map +1 -1
- package/lib/module/metro/plugin/metroSerializer.js.map +1 -1
- package/lib/module/nativeModulesTypes.js +1 -43
- package/lib/module/nativeModulesTypes.js.map +1 -1
- package/lib/module/rum/DdRum.js +54 -26
- package/lib/module/rum/DdRum.js.map +1 -1
- package/lib/module/rum/helper.js +49 -0
- package/lib/module/rum/helper.js.map +1 -0
- package/lib/module/rum/instrumentation/DdRumErrorTracking.js +14 -18
- package/lib/module/rum/instrumentation/DdRumErrorTracking.js.map +1 -1
- package/lib/module/rum/instrumentation/interactionTracking/DdBabelInteractionTracking.js +16 -26
- package/lib/module/rum/instrumentation/interactionTracking/DdBabelInteractionTracking.js.map +1 -1
- package/lib/module/rum/instrumentation/interactionTracking/DdEventsInterceptor.js +1 -1
- package/lib/module/rum/instrumentation/interactionTracking/DdEventsInterceptor.js.map +1 -1
- package/lib/module/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.js +15 -5
- package/lib/module/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.js.map +1 -1
- package/lib/module/rum/instrumentation/resourceTracking/DdRumResourceTracking.js +33 -21
- package/lib/module/rum/instrumentation/resourceTracking/DdRumResourceTracking.js.map +1 -1
- package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/DatadogTracingContext.js +22 -1
- package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/DatadogTracingContext.js.map +1 -1
- package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/TracingIdentifier.js +13 -2
- package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/TracingIdentifier.js.map +1 -1
- package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/distributedTracing.js +10 -11
- package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/distributedTracing.js.map +1 -1
- package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingAttributes.js +2 -0
- package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingAttributes.js.map +1 -0
- package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingHeaders.js +27 -33
- package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingHeaders.js.map +1 -1
- package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingSampling.js +54 -0
- package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingSampling.js.map +1 -0
- package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/firstPartyHosts.js +1 -1
- package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/firstPartyHosts.js.map +1 -1
- package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/headers.js +30 -0
- package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/headers.js.map +1 -0
- package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/URLHostParser.js +1 -1
- package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/URLHostParser.js.map +1 -1
- package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/XHRProxy.js +14 -3
- package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/XHRProxy.js.map +1 -1
- package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/baggageHeaderUtils.js +90 -48
- package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/baggageHeaderUtils.js.map +1 -1
- package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/responseSize.js +1 -1
- package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/responseSize.js.map +1 -1
- package/lib/module/rum/types.js +0 -9
- package/lib/module/rum/types.js.map +1 -1
- package/lib/module/sdk/AccountInfoSingleton/AccountInfoSingleton.js +39 -0
- package/lib/module/sdk/AccountInfoSingleton/AccountInfoSingleton.js.map +1 -0
- package/lib/module/sdk/AccountInfoSingleton/types.js +2 -0
- package/lib/module/sdk/AccountInfoSingleton/types.js.map +1 -0
- package/lib/module/sdk/AttributesEncoding/attributesEncoding.js +46 -0
- package/lib/module/sdk/AttributesEncoding/attributesEncoding.js.map +1 -0
- package/lib/module/sdk/AttributesEncoding/defaultEncoders.js +134 -0
- package/lib/module/sdk/AttributesEncoding/defaultEncoders.js.map +1 -0
- package/lib/module/{utils → sdk/AttributesEncoding}/errorUtils.js +37 -20
- package/lib/module/sdk/AttributesEncoding/errorUtils.js.map +1 -0
- package/lib/module/sdk/AttributesEncoding/helpers.js +115 -0
- package/lib/module/sdk/AttributesEncoding/helpers.js.map +1 -0
- package/lib/module/sdk/AttributesEncoding/types.js +2 -0
- package/lib/module/sdk/AttributesEncoding/types.js.map +1 -0
- package/lib/module/sdk/AttributesEncoding/utils.js +28 -0
- package/lib/module/sdk/AttributesEncoding/utils.js.map +1 -0
- package/lib/module/sdk/AttributesSingleton/AttributesSingleton.js +27 -1
- package/lib/module/sdk/AttributesSingleton/AttributesSingleton.js.map +1 -1
- package/lib/module/sdk/DatadogInternalBridge/DdSdkInternalNativeBridge.js +2 -2
- package/lib/module/sdk/DatadogInternalBridge/DdSdkInternalNativeBridge.js.map +1 -1
- package/lib/module/sdk/DatadogInternalBridge/DdSdkInternalNativeBridgeEvent.js +1 -1
- package/lib/module/sdk/DatadogInternalBridge/DdSdkInternalNativeBridgeEvent.js.map +1 -1
- package/lib/module/sdk/DatadogProvider/Buffer/BoundedBuffer.js +4 -4
- package/lib/module/sdk/DatadogProvider/Buffer/BoundedBuffer.js.map +1 -1
- package/lib/module/sdk/DatadogProvider/DatadogProvider.js +9 -8
- package/lib/module/sdk/DatadogProvider/DatadogProvider.js.map +1 -1
- package/lib/module/sdk/DatadogProvider/DatadogProviderState.js +21 -0
- package/lib/module/sdk/DatadogProvider/DatadogProviderState.js.map +1 -0
- package/lib/module/sdk/DdSdk.js +4 -4
- package/lib/module/sdk/DdSdk.js.map +1 -1
- package/lib/module/sdk/DdSdkInternal.js +80 -0
- package/lib/module/sdk/DdSdkInternal.js.map +1 -0
- package/lib/module/sdk/EventMappers/EventMapper.js +6 -3
- package/lib/module/sdk/EventMappers/EventMapper.js.map +1 -1
- package/lib/module/sdk/GlobalState/GlobalState.js +5 -10
- package/lib/module/sdk/GlobalState/GlobalState.js.map +1 -1
- package/lib/module/sdk/UserInfoSingleton/UserInfoSingleton.js +6 -1
- package/lib/module/sdk/UserInfoSingleton/UserInfoSingleton.js.map +1 -1
- package/lib/module/specs/NativeDdRum.js.map +1 -1
- package/lib/module/specs/NativeDdSdk.js.map +1 -1
- package/lib/module/trace/DdTrace.js +7 -6
- package/lib/module/trace/DdTrace.js.map +1 -1
- package/lib/module/types.js +22 -42
- package/lib/module/types.js.map +1 -1
- package/lib/module/utils/longTasksUtils.js.map +1 -1
- package/lib/module/utils/singletonUtils.js +14 -0
- package/lib/module/utils/singletonUtils.js.map +1 -0
- package/lib/module/version.js +1 -1
- package/lib/module/version.js.map +1 -1
- package/lib/typescript/DdAttributes.d.ts.map +1 -0
- package/lib/typescript/DdSdkReactNative.d.ts +49 -12
- package/lib/typescript/DdSdkReactNative.d.ts.map +1 -1
- package/lib/typescript/InternalLog.d.ts +1 -1
- package/lib/typescript/InternalLog.d.ts.map +1 -1
- package/lib/typescript/config/DatadogProviderConfiguration.d.ts +12 -0
- package/lib/typescript/config/DatadogProviderConfiguration.d.ts.map +1 -0
- package/lib/typescript/config/FileBasedConfiguration.d.ts +17 -0
- package/lib/typescript/config/FileBasedConfiguration.d.ts.map +1 -0
- package/lib/typescript/config/FileBasedConfiguration.type.d.ts +52 -0
- package/lib/typescript/config/FileBasedConfiguration.type.d.ts.map +1 -0
- package/lib/typescript/config/async/AutoInstrumentationConfiguration.d.ts +60 -0
- package/lib/typescript/config/async/AutoInstrumentationConfiguration.d.ts.map +1 -0
- package/lib/typescript/config/async/PartialInitializationConfiguration.d.ts +47 -0
- package/lib/typescript/config/async/PartialInitializationConfiguration.d.ts.map +1 -0
- package/lib/typescript/config/async/asyncInitializationHelper.d.ts +5 -0
- package/lib/typescript/config/async/asyncInitializationHelper.d.ts.map +1 -0
- package/lib/typescript/config/features/CoreConfiguration.d.ts +52 -0
- package/lib/typescript/config/features/CoreConfiguration.d.ts.map +1 -0
- package/lib/typescript/config/features/CoreConfiguration.type.d.ts +90 -0
- package/lib/typescript/config/features/CoreConfiguration.type.d.ts.map +1 -0
- package/lib/typescript/config/features/CoreConfigurationNative.d.ts +54 -0
- package/lib/typescript/config/features/CoreConfigurationNative.d.ts.map +1 -0
- package/lib/typescript/config/features/LogsConfiguration.d.ts +17 -0
- package/lib/typescript/config/features/LogsConfiguration.d.ts.map +1 -0
- package/lib/typescript/config/features/LogsConfiguration.type.d.ts +24 -0
- package/lib/typescript/config/features/LogsConfiguration.type.d.ts.map +1 -0
- package/lib/typescript/config/features/LogsConfigurationNative.d.ts +6 -0
- package/lib/typescript/config/features/LogsConfigurationNative.d.ts.map +1 -0
- package/lib/typescript/config/features/RumConfiguration.d.ts +66 -0
- package/lib/typescript/config/features/RumConfiguration.d.ts.map +1 -0
- package/lib/typescript/config/features/RumConfiguration.type.d.ts +131 -0
- package/lib/typescript/config/features/RumConfiguration.type.d.ts.map +1 -0
- package/lib/typescript/config/features/RumConfigurationNative.d.ts +25 -0
- package/lib/typescript/config/features/RumConfigurationNative.d.ts.map +1 -0
- package/lib/typescript/config/features/TraceConfiguration.d.ts +10 -0
- package/lib/typescript/config/features/TraceConfiguration.d.ts.map +1 -0
- package/lib/typescript/config/features/TraceConfiguration.type.d.ts +11 -0
- package/lib/typescript/config/features/TraceConfiguration.type.d.ts.map +1 -0
- package/lib/typescript/config/features/TraceConfigurationNative.d.ts +4 -0
- package/lib/typescript/config/features/TraceConfigurationNative.d.ts.map +1 -0
- package/lib/typescript/config/types/BatchProcessingLevel.d.ts +18 -0
- package/lib/typescript/config/types/BatchProcessingLevel.d.ts.map +1 -0
- package/lib/typescript/config/types/BatchSize.d.ts +19 -0
- package/lib/typescript/config/types/BatchSize.d.ts.map +1 -0
- package/lib/typescript/config/types/InitializationMode.d.ts +5 -0
- package/lib/typescript/config/types/InitializationMode.d.ts.map +1 -0
- package/lib/typescript/config/types/InitializationModeForTelemetry.d.ts +2 -0
- package/lib/typescript/config/types/InitializationModeForTelemetry.d.ts.map +1 -0
- package/lib/typescript/config/types/ProxyConfiguration.d.ts.map +1 -0
- package/lib/typescript/config/types/SdkVerbosity.d.ts.map +1 -0
- package/lib/typescript/config/types/TrackingConsent.d.ts.map +1 -0
- package/lib/typescript/config/types/UploadFrequency.d.ts +18 -0
- package/lib/typescript/config/types/UploadFrequency.d.ts.map +1 -0
- package/lib/typescript/config/types/VitalsUpdateFrequency.d.ts +7 -0
- package/lib/typescript/config/types/VitalsUpdateFrequency.d.ts.map +1 -0
- package/lib/typescript/config/types/index.d.ts +10 -0
- package/lib/typescript/config/types/index.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +20 -9
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/logs/DdLogs.d.ts +2 -1
- package/lib/typescript/logs/DdLogs.d.ts.map +1 -1
- package/lib/typescript/logs/eventMapper.d.ts +3 -2
- package/lib/typescript/logs/eventMapper.d.ts.map +1 -1
- package/lib/typescript/logs/types.d.ts +1 -16
- package/lib/typescript/logs/types.d.ts.map +1 -1
- package/lib/typescript/nativeModulesTypes.d.ts +2 -15
- package/lib/typescript/nativeModulesTypes.d.ts.map +1 -1
- package/lib/typescript/rum/DdRum.d.ts +10 -1
- package/lib/typescript/rum/DdRum.d.ts.map +1 -1
- package/lib/typescript/rum/eventMappers/errorEventMapper.d.ts +1 -1
- package/lib/typescript/rum/eventMappers/errorEventMapper.d.ts.map +1 -1
- package/lib/typescript/rum/helper.d.ts +10 -0
- package/lib/typescript/rum/helper.d.ts.map +1 -0
- package/lib/typescript/rum/instrumentation/DdRumErrorTracking.d.ts.map +1 -1
- package/lib/typescript/rum/instrumentation/interactionTracking/DdBabelInteractionTracking.d.ts +6 -6
- package/lib/typescript/rum/instrumentation/interactionTracking/DdBabelInteractionTracking.d.ts.map +1 -1
- package/lib/typescript/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.d.ts +7 -0
- package/lib/typescript/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.d.ts.map +1 -1
- package/lib/typescript/rum/instrumentation/resourceTracking/DdRumResourceTracking.d.ts +12 -6
- package/lib/typescript/rum/instrumentation/resourceTracking/DdRumResourceTracking.d.ts.map +1 -1
- package/lib/typescript/rum/instrumentation/resourceTracking/distributedTracing/DatadogTracingContext.d.ts +1 -0
- package/lib/typescript/rum/instrumentation/resourceTracking/distributedTracing/DatadogTracingContext.d.ts.map +1 -1
- package/lib/typescript/rum/instrumentation/resourceTracking/distributedTracing/TracingIdentifier.d.ts +8 -0
- package/lib/typescript/rum/instrumentation/resourceTracking/distributedTracing/TracingIdentifier.d.ts.map +1 -1
- package/lib/typescript/rum/instrumentation/resourceTracking/distributedTracing/distributedTracing.d.ts +5 -17
- package/lib/typescript/rum/instrumentation/resourceTracking/distributedTracing/distributedTracing.d.ts.map +1 -1
- package/lib/typescript/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingAttributes.d.ts +20 -0
- package/lib/typescript/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingAttributes.d.ts.map +1 -0
- package/lib/typescript/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingHeaders.d.ts +3 -24
- package/lib/typescript/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingHeaders.d.ts.map +1 -1
- package/lib/typescript/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingSampling.d.ts +12 -0
- package/lib/typescript/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingSampling.d.ts.map +1 -0
- package/lib/typescript/rum/instrumentation/resourceTracking/distributedTracing/headers.d.ts +24 -0
- package/lib/typescript/rum/instrumentation/resourceTracking/distributedTracing/headers.d.ts.map +1 -0
- package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/XHRProxy.d.ts +2 -1
- package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/XHRProxy.d.ts.map +1 -1
- package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/baggageHeaderUtils.d.ts.map +1 -1
- package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/interfaces/RumResource.d.ts +1 -1
- package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/interfaces/RumResource.d.ts.map +1 -1
- package/lib/typescript/rum/types.d.ts +47 -7
- package/lib/typescript/rum/types.d.ts.map +1 -1
- package/lib/typescript/sdk/AccountInfoSingleton/AccountInfoSingleton.d.ts +15 -0
- package/lib/typescript/sdk/AccountInfoSingleton/AccountInfoSingleton.d.ts.map +1 -0
- package/lib/typescript/sdk/AccountInfoSingleton/types.d.ts +6 -0
- package/lib/typescript/sdk/AccountInfoSingleton/types.d.ts.map +1 -0
- package/lib/typescript/sdk/AttributesEncoding/attributesEncoding.d.ts +13 -0
- package/lib/typescript/sdk/AttributesEncoding/attributesEncoding.d.ts.map +1 -0
- package/lib/typescript/sdk/AttributesEncoding/defaultEncoders.d.ts +33 -0
- package/lib/typescript/sdk/AttributesEncoding/defaultEncoders.d.ts.map +1 -0
- package/lib/typescript/{utils → sdk/AttributesEncoding}/errorUtils.d.ts +4 -4
- package/lib/typescript/sdk/AttributesEncoding/errorUtils.d.ts.map +1 -0
- package/lib/typescript/sdk/AttributesEncoding/helpers.d.ts +17 -0
- package/lib/typescript/sdk/AttributesEncoding/helpers.d.ts.map +1 -0
- package/lib/typescript/sdk/AttributesEncoding/types.d.ts +21 -0
- package/lib/typescript/sdk/AttributesEncoding/types.d.ts.map +1 -0
- package/lib/typescript/sdk/AttributesEncoding/utils.d.ts +7 -0
- package/lib/typescript/sdk/AttributesEncoding/utils.d.ts.map +1 -0
- package/lib/typescript/sdk/AttributesSingleton/AttributesSingleton.d.ts +5 -1
- package/lib/typescript/sdk/AttributesSingleton/AttributesSingleton.d.ts.map +1 -1
- package/lib/typescript/sdk/DatadogProvider/DatadogProvider.d.ts +4 -3
- package/lib/typescript/sdk/DatadogProvider/DatadogProvider.d.ts.map +1 -1
- package/lib/typescript/sdk/DatadogProvider/DatadogProviderState.d.ts +9 -0
- package/lib/typescript/sdk/DatadogProvider/DatadogProviderState.d.ts.map +1 -0
- package/lib/typescript/sdk/DdSdk.d.ts +2 -3
- package/lib/typescript/sdk/DdSdk.d.ts.map +1 -1
- package/lib/typescript/sdk/DdSdkInternal.d.ts +39 -0
- package/lib/typescript/sdk/DdSdkInternal.d.ts.map +1 -0
- package/lib/typescript/sdk/EventMappers/EventMapper.d.ts +3 -1
- package/lib/typescript/sdk/EventMappers/EventMapper.d.ts.map +1 -1
- package/lib/typescript/sdk/GlobalState/GlobalState.d.ts +3 -3
- package/lib/typescript/sdk/GlobalState/GlobalState.d.ts.map +1 -1
- package/lib/typescript/sdk/UserInfoSingleton/UserInfoSingleton.d.ts +2 -1
- package/lib/typescript/sdk/UserInfoSingleton/UserInfoSingleton.d.ts.map +1 -1
- package/lib/typescript/sdk/UserInfoSingleton/types.d.ts +1 -2
- package/lib/typescript/sdk/UserInfoSingleton/types.d.ts.map +1 -1
- package/lib/typescript/specs/NativeDdRum.d.ts +45 -0
- package/lib/typescript/specs/NativeDdRum.d.ts.map +1 -1
- package/lib/typescript/specs/NativeDdSdk.d.ts +34 -6
- package/lib/typescript/specs/NativeDdSdk.d.ts.map +1 -1
- package/lib/typescript/trace/DdTrace.d.ts +1 -2
- package/lib/typescript/trace/DdTrace.d.ts.map +1 -1
- package/lib/typescript/types.d.ts +74 -92
- package/lib/typescript/types.d.ts.map +1 -1
- package/lib/typescript/utils/longTasksUtils.d.ts +1 -1
- package/lib/typescript/utils/longTasksUtils.d.ts.map +1 -1
- package/lib/typescript/utils/singletonUtils.d.ts +2 -0
- package/lib/typescript/utils/singletonUtils.d.ts.map +1 -0
- package/lib/typescript/version.d.ts +1 -1
- package/lib/typescript/version.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/DdSdkReactNative.tsx +246 -104
- package/src/InternalLog.tsx +1 -1
- package/src/__tests__/DdSdkReactNative.test.tsx +415 -207
- package/src/__tests__/DdSdkReactNativeConfiguration.test.ts +237 -153
- package/src/__tests__/InternalLog.test.tsx +1 -1
- package/src/__tests__/rum/instrumentation/DdEventsInterceptor.test.tsx +2 -2
- package/src/__tests__/rum/instrumentation/DdRumErrorTracking.test.tsx +139 -216
- package/src/__tests__/rum/instrumentation/DdRumUserInteractionTracking.test.tsx +10 -7
- package/src/config/DatadogProviderConfiguration.ts +17 -0
- package/src/config/FileBasedConfiguration.ts +464 -0
- package/src/config/FileBasedConfiguration.type.ts +66 -0
- package/src/config/__tests__/FileBasedConfiguration.test.ts +334 -0
- package/src/config/__tests__/__fixtures__/configuration-all-fields.json +57 -0
- package/src/config/__tests__/__fixtures__/malformed-configuration.json +4 -0
- package/src/config/async/AutoInstrumentationConfiguration.ts +126 -0
- package/src/config/async/PartialInitializationConfiguration.ts +58 -0
- package/src/config/async/asyncInitializationHelper.tsx +51 -0
- package/src/config/features/CoreConfiguration.ts +130 -0
- package/src/config/features/CoreConfiguration.type.ts +119 -0
- package/src/config/features/CoreConfigurationNative.ts +50 -0
- package/src/config/features/LogsConfiguration.ts +38 -0
- package/src/config/features/LogsConfiguration.type.ts +33 -0
- package/src/config/features/LogsConfigurationNative.ts +10 -0
- package/src/config/features/RumConfiguration.ts +137 -0
- package/src/config/features/RumConfiguration.type.ts +164 -0
- package/src/config/features/RumConfigurationNative.ts +26 -0
- package/src/config/features/TraceConfiguration.ts +24 -0
- package/src/config/features/TraceConfiguration.type.ts +17 -0
- package/src/config/features/TraceConfigurationNative.ts +8 -0
- package/src/config/types/BatchProcessingLevel.ts +23 -0
- package/src/config/types/BatchSize.ts +24 -0
- package/src/config/types/InitializationMode.ts +9 -0
- package/src/config/types/InitializationModeForTelemetry.ts +11 -0
- package/src/{ProxyConfiguration.tsx → config/types/ProxyConfiguration.ts} +6 -0
- package/src/config/types/UploadFrequency.tsx +23 -0
- package/src/config/types/VitalsUpdateFrequency.ts +11 -0
- package/src/config/types/index.ts +15 -0
- package/src/index.tsx +33 -16
- package/src/logs/DdLogs.ts +14 -13
- package/src/logs/__tests__/DdLogs.test.ts +60 -107
- package/src/logs/__tests__/eventMapper.test.ts +1 -1
- package/src/logs/eventMapper.ts +5 -4
- package/src/logs/types.ts +1 -20
- package/src/metro/plugin/metroSerializer.ts +3 -3
- package/src/nativeModulesTypes.ts +2 -17
- package/src/rum/DdRum.ts +139 -42
- package/src/rum/__tests__/DdRum.test.ts +217 -47
- package/src/rum/eventMappers/errorEventMapper.ts +1 -1
- package/src/rum/helper.ts +62 -0
- package/src/rum/instrumentation/DdRumErrorTracking.tsx +20 -38
- package/src/rum/instrumentation/interactionTracking/DdBabelInteractionTracking.ts +21 -35
- package/src/rum/instrumentation/interactionTracking/DdEventsInterceptor.tsx +1 -1
- package/src/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.tsx +18 -5
- package/src/rum/instrumentation/resourceTracking/DdRumResourceTracking.tsx +44 -23
- package/src/rum/instrumentation/resourceTracking/__tests__/DdRumResourceTracking.test.ts +2 -2
- package/src/rum/instrumentation/resourceTracking/__tests__/__utils__/XMLHttpRequestMock.ts +44 -23
- package/src/rum/instrumentation/resourceTracking/distributedTracing/DatadogTracingContext.ts +24 -1
- package/src/rum/instrumentation/resourceTracking/distributedTracing/TracingIdentifier.tsx +17 -2
- package/src/rum/instrumentation/resourceTracking/distributedTracing/__tests__/distributedTracing.test.ts +327 -1
- package/src/rum/instrumentation/resourceTracking/distributedTracing/distributedTracing.tsx +22 -31
- package/src/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingAttributes.ts +29 -0
- package/src/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingHeaders.ts +54 -35
- package/src/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingSampling.ts +80 -0
- package/src/rum/instrumentation/resourceTracking/distributedTracing/firstPartyHosts.ts +1 -1
- package/src/rum/instrumentation/resourceTracking/distributedTracing/headers.ts +29 -0
- package/src/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/URLHostParser.ts +1 -1
- package/src/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/XHRProxy.ts +19 -7
- package/src/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/__tests__/XHRProxy.test.ts +177 -119
- package/src/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/__tests__/baggageHeaderUtils.test.ts +85 -13
- package/src/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/baggageHeaderUtils.ts +110 -52
- package/src/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/responseSize.ts +1 -1
- package/src/rum/instrumentation/resourceTracking/requestProxy/interfaces/RumResource.ts +1 -1
- package/src/rum/types.ts +68 -8
- package/src/sdk/AccountInfoSingleton/AccountInfoSingleton.ts +49 -0
- package/src/sdk/AccountInfoSingleton/__tests__/AccountInfoSingleton.test.ts +90 -0
- package/src/sdk/AccountInfoSingleton/types.ts +11 -0
- package/src/sdk/AttributesEncoding/__tests__/attributesEncoding.test.ts +518 -0
- package/src/sdk/AttributesEncoding/__tests__/defaultEncoders.test.ts +198 -0
- package/src/sdk/AttributesEncoding/attributesEncoding.ts +56 -0
- package/src/sdk/AttributesEncoding/defaultEncoders.ts +175 -0
- package/src/{utils → sdk/AttributesEncoding}/errorUtils.ts +50 -22
- package/src/sdk/AttributesEncoding/helpers.ts +176 -0
- package/src/sdk/AttributesEncoding/types.ts +33 -0
- package/src/sdk/AttributesEncoding/utils.ts +31 -0
- package/src/sdk/AttributesSingleton/AttributesSingleton.ts +25 -1
- package/src/sdk/AttributesSingleton/__tests__/AttributesSingleton.test.ts +52 -8
- package/src/sdk/DatadogInternalBridge/DdSdkInternalNativeBridge.tsx +2 -2
- package/src/sdk/DatadogInternalBridge/DdSdkInternalNativeBridgeEvent.tsx +1 -1
- package/src/sdk/DatadogInternalBridge/__tests__/DdSdkNativeBridge.test.tsx +1 -1
- package/src/sdk/DatadogProvider/Buffer/BoundedBuffer.ts +4 -4
- package/src/sdk/DatadogProvider/Buffer/__tests__/BoundedBuffer.test.ts +5 -5
- package/src/sdk/DatadogProvider/DatadogProvider.tsx +12 -16
- package/src/sdk/DatadogProvider/DatadogProviderState.ts +30 -0
- package/src/sdk/DatadogProvider/__tests__/__utils__/renderWithProvider.tsx +18 -7
- package/src/sdk/DatadogProvider/__tests__/initialization.test.tsx +59 -33
- package/src/sdk/DatadogProvider/__tests__/initializationModes.test.tsx +26 -10
- package/src/sdk/DdSdk.ts +8 -5
- package/src/sdk/DdSdkInternal.ts +121 -0
- package/src/sdk/EventMappers/EventMapper.ts +9 -4
- package/src/sdk/EventMappers/__tests__/EventMapper.test.ts +3 -3
- package/src/sdk/GlobalState/GlobalState.tsx +10 -11
- package/src/sdk/UserInfoSingleton/UserInfoSingleton.ts +9 -2
- package/src/sdk/UserInfoSingleton/__tests__/UserInfoSingleton.test.ts +46 -9
- package/src/sdk/UserInfoSingleton/types.ts +1 -4
- package/src/specs/NativeDdRum.ts +65 -0
- package/src/specs/NativeDdSdk.ts +40 -6
- package/src/trace/DdTrace.ts +11 -7
- package/src/trace/__tests__/DdTrace.test.ts +7 -8
- package/src/types.tsx +97 -76
- package/src/utils/__tests__/errorUtils.test.ts +1 -1
- package/src/utils/__tests__/singletonUtils.test.ts +75 -0
- package/src/utils/longTasksUtils.ts +1 -3
- package/src/utils/singletonUtils.ts +17 -0
- package/src/version.ts +1 -1
- package/lib/commonjs/DdSdkReactNativeConfiguration.js +0 -412
- package/lib/commonjs/DdSdkReactNativeConfiguration.js.map +0 -1
- package/lib/commonjs/ProxyConfiguration.js.map +0 -1
- package/lib/commonjs/SdkVerbosity.js.map +0 -1
- package/lib/commonjs/TrackingConsent.js.map +0 -1
- package/lib/commonjs/rum/DdAttributes.js.map +0 -1
- package/lib/commonjs/sdk/FileBasedConfiguration/FileBasedConfiguration.js +0 -185
- package/lib/commonjs/sdk/FileBasedConfiguration/FileBasedConfiguration.js.map +0 -1
- package/lib/commonjs/utils/argsUtils.js +0 -41
- package/lib/commonjs/utils/argsUtils.js.map +0 -1
- package/lib/commonjs/utils/errorUtils.js.map +0 -1
- package/lib/module/DdSdkReactNativeConfiguration.js +0 -403
- package/lib/module/DdSdkReactNativeConfiguration.js.map +0 -1
- package/lib/module/ProxyConfiguration.js.map +0 -1
- package/lib/module/SdkVerbosity.js.map +0 -1
- package/lib/module/TrackingConsent.js.map +0 -1
- package/lib/module/rum/DdAttributes.js.map +0 -1
- package/lib/module/sdk/FileBasedConfiguration/FileBasedConfiguration.js +0 -176
- package/lib/module/sdk/FileBasedConfiguration/FileBasedConfiguration.js.map +0 -1
- package/lib/module/utils/argsUtils.js +0 -35
- package/lib/module/utils/argsUtils.js.map +0 -1
- package/lib/module/utils/errorUtils.js.map +0 -1
- package/lib/typescript/DdSdkReactNativeConfiguration.d.ts +0 -376
- package/lib/typescript/DdSdkReactNativeConfiguration.d.ts.map +0 -1
- package/lib/typescript/ProxyConfiguration.d.ts.map +0 -1
- package/lib/typescript/SdkVerbosity.d.ts.map +0 -1
- package/lib/typescript/TrackingConsent.d.ts.map +0 -1
- package/lib/typescript/rum/DdAttributes.d.ts.map +0 -1
- package/lib/typescript/sdk/FileBasedConfiguration/FileBasedConfiguration.d.ts +0 -34
- package/lib/typescript/sdk/FileBasedConfiguration/FileBasedConfiguration.d.ts.map +0 -1
- package/lib/typescript/utils/argsUtils.d.ts +0 -8
- package/lib/typescript/utils/argsUtils.d.ts.map +0 -1
- package/lib/typescript/utils/errorUtils.d.ts.map +0 -1
- package/src/DdSdkReactNativeConfiguration.tsx +0 -582
- package/src/sdk/FileBasedConfiguration/FileBasedConfiguration.ts +0 -241
- package/src/sdk/FileBasedConfiguration/__tests__/FileBasedConfiguration.test.ts +0 -255
- package/src/sdk/FileBasedConfiguration/__tests__/__fixtures__/configuration-all-fields.json +0 -27
- package/src/sdk/FileBasedConfiguration/__tests__/__fixtures__/malformed-configuration.json +0 -5
- package/src/utils/__tests__/argsUtils.test.ts +0 -66
- package/src/utils/argsUtils.ts +0 -41
- /package/lib/commonjs/{rum/DdAttributes.js → DdAttributes.js} +0 -0
- /package/lib/commonjs/{SdkVerbosity.js → config/types/SdkVerbosity.js} +0 -0
- /package/lib/commonjs/{TrackingConsent.js → config/types/TrackingConsent.js} +0 -0
- /package/lib/module/{rum/DdAttributes.js → DdAttributes.js} +0 -0
- /package/lib/module/{SdkVerbosity.js → config/types/SdkVerbosity.js} +0 -0
- /package/lib/module/{TrackingConsent.js → config/types/TrackingConsent.js} +0 -0
- /package/lib/typescript/{rum/DdAttributes.d.ts → DdAttributes.d.ts} +0 -0
- /package/lib/typescript/{ProxyConfiguration.d.ts → config/types/ProxyConfiguration.d.ts} +0 -0
- /package/lib/typescript/{SdkVerbosity.d.ts → config/types/SdkVerbosity.d.ts} +0 -0
- /package/lib/typescript/{TrackingConsent.d.ts → config/types/TrackingConsent.d.ts} +0 -0
- /package/src/{rum/DdAttributes.ts → DdAttributes.ts} +0 -0
- /package/src/{SdkVerbosity.tsx → config/types/SdkVerbosity.ts} +0 -0
- /package/src/{TrackingConsent.tsx → config/types/TrackingConsent.ts} +0 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0. This product includes software developed at Datadog (https://www.datadoghq.com/).
|
|
3
|
+
* Copyright 2016-Present Datadog, Inc.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Datadog headers
|
|
8
|
+
*/
|
|
9
|
+
export const SAMPLING_PRIORITY_HEADER_KEY = 'x-datadog-sampling-priority';
|
|
10
|
+
export const ORIGIN_HEADER_KEY = 'x-datadog-origin';
|
|
11
|
+
export const ORIGIN_RUM = 'rum';
|
|
12
|
+
export const TRACE_ID_HEADER_KEY = 'x-datadog-trace-id';
|
|
13
|
+
export const PARENT_ID_HEADER_KEY = 'x-datadog-parent-id';
|
|
14
|
+
export const TAGS_HEADER_KEY = 'x-datadog-tags';
|
|
15
|
+
export const DD_TRACE_ID_TAG = '_dd.p.tid';
|
|
16
|
+
export const DD_RUM_SESSION_ID_TAG = 'session.id';
|
|
17
|
+
export const DD_RUM_USER_ID_TAG = 'user.id';
|
|
18
|
+
export const DD_RUM_ACCOUNT_ID_TAG = 'account.id';
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* OTel headers
|
|
22
|
+
*/
|
|
23
|
+
export const TRACECONTEXT_HEADER_KEY = 'traceparent';
|
|
24
|
+
export const TRACESTATE_HEADER_KEY = 'tracestate';
|
|
25
|
+
export const BAGGAGE_HEADER_KEY = 'baggage';
|
|
26
|
+
export const B3_HEADER_KEY = 'b3';
|
|
27
|
+
export const B3_MULTI_TRACE_ID_HEADER_KEY = 'X-B3-TraceId';
|
|
28
|
+
export const B3_MULTI_SPAN_ID_HEADER_KEY = 'X-B3-SpanId';
|
|
29
|
+
export const B3_MULTI_SAMPLED_HEADER_KEY = 'X-B3-Sampled';
|
|
30
|
+
//# sourceMappingURL=headers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["SAMPLING_PRIORITY_HEADER_KEY","ORIGIN_HEADER_KEY","ORIGIN_RUM","TRACE_ID_HEADER_KEY","PARENT_ID_HEADER_KEY","TAGS_HEADER_KEY","DD_TRACE_ID_TAG","DD_RUM_SESSION_ID_TAG","DD_RUM_USER_ID_TAG","DD_RUM_ACCOUNT_ID_TAG","TRACECONTEXT_HEADER_KEY","TRACESTATE_HEADER_KEY","BAGGAGE_HEADER_KEY","B3_HEADER_KEY","B3_MULTI_TRACE_ID_HEADER_KEY","B3_MULTI_SPAN_ID_HEADER_KEY","B3_MULTI_SAMPLED_HEADER_KEY"],"sourceRoot":"../../../../../../src","sources":["rum/instrumentation/resourceTracking/distributedTracing/headers.ts"],"mappings":"AAAA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,OAAO,MAAMA,4BAA4B,GAAG,6BAA6B;AACzE,OAAO,MAAMC,iBAAiB,GAAG,kBAAkB;AACnD,OAAO,MAAMC,UAAU,GAAG,KAAK;AAC/B,OAAO,MAAMC,mBAAmB,GAAG,oBAAoB;AACvD,OAAO,MAAMC,oBAAoB,GAAG,qBAAqB;AACzD,OAAO,MAAMC,eAAe,GAAG,gBAAgB;AAC/C,OAAO,MAAMC,eAAe,GAAG,WAAW;AAC1C,OAAO,MAAMC,qBAAqB,GAAG,YAAY;AACjD,OAAO,MAAMC,kBAAkB,GAAG,SAAS;AAC3C,OAAO,MAAMC,qBAAqB,GAAG,YAAY;;AAEjD;AACA;AACA;AACA,OAAO,MAAMC,uBAAuB,GAAG,aAAa;AACpD,OAAO,MAAMC,qBAAqB,GAAG,YAAY;AACjD,OAAO,MAAMC,kBAAkB,GAAG,SAAS;AAC3C,OAAO,MAAMC,aAAa,GAAG,IAAI;AACjC,OAAO,MAAMC,4BAA4B,GAAG,cAAc;AAC1D,OAAO,MAAMC,2BAA2B,GAAG,aAAa;AACxD,OAAO,MAAMC,2BAA2B,GAAG,cAAc","ignoreList":[]}
|
package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/URLHostParser.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import { InternalLog } from '../../../../../InternalLog';
|
|
8
|
-
import { SdkVerbosity } from '../../../../../SdkVerbosity';
|
|
8
|
+
import { SdkVerbosity } from '../../../../../config/types/SdkVerbosity';
|
|
9
9
|
// matches what is between the first "://" and the next "/", ":" or whitespace
|
|
10
10
|
const hostRegex = '^.+://([^:/\\s]+)';
|
|
11
11
|
|
package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/URLHostParser.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["InternalLog","SdkVerbosity","hostRegex","URLHostParser","url","matchedHost","match","e","log","WARN"],"sourceRoot":"../../../../../../../src","sources":["rum/instrumentation/resourceTracking/requestProxy/XHRProxy/URLHostParser.ts"],"mappings":"AAAA;AACA;AACA;AACA;AACA;;AAEA,SAASA,WAAW,QAAQ,4BAA4B;AACxD,SAASC,YAAY,QAAQ,
|
|
1
|
+
{"version":3,"names":["InternalLog","SdkVerbosity","hostRegex","URLHostParser","url","matchedHost","match","e","log","WARN"],"sourceRoot":"../../../../../../../src","sources":["rum/instrumentation/resourceTracking/requestProxy/XHRProxy/URLHostParser.ts"],"mappings":"AAAA;AACA;AACA;AACA;AACA;;AAEA,SAASA,WAAW,QAAQ,4BAA4B;AACxD,SAASC,YAAY,QAAQ,0CAA0C;AAGvE;AACA,MAAMC,SAAS,GAAG,mBAAmB;;AAErC;AACA;AACA;AACA;AACA,OAAO,MAAMC,aAAa,GAAIC,GAAW,IAAsB;EAC3D,IAAI;IACA,MAAMC,WAAW,GAAGD,GAAG,CAACE,KAAK,CAACJ,SAAS,CAAC;IACxC,IAAIG,WAAW,KAAK,IAAI,EAAE;MACtB,OAAO,IAAI;IACf;IACA;IACA,OAAOA,WAAW,CAAC,CAAC,CAAC;EACzB,CAAC,CAAC,OAAOE,CAAC,EAAE;IACRP,WAAW,CAACQ,GAAG,CAAC,sBAAsBJ,GAAG,SAAS,EAAEH,YAAY,CAACQ,IAAI,CAAC;IACtE,OAAO,IAAI;EACf;AACJ,CAAC","ignoreList":[]}
|
|
@@ -5,12 +5,15 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import { Timer } from '../../../../../utils/Timer';
|
|
8
|
-
import { getCachedSessionId } from '../../../../
|
|
9
|
-
import {
|
|
8
|
+
import { getCachedAccountId, getCachedSessionId, getCachedUserId } from '../../../../helper';
|
|
9
|
+
import { getTracingHeadersFromAttributes } from '../../distributedTracing/distributedTracingHeaders';
|
|
10
10
|
import { getTracingAttributes } from '../../distributedTracing/distributedTracing';
|
|
11
|
+
import { BAGGAGE_HEADER_KEY } from '../../distributedTracing/headers';
|
|
11
12
|
import { DATADOG_GRAPH_QL_OPERATION_NAME_HEADER, DATADOG_GRAPH_QL_OPERATION_TYPE_HEADER, DATADOG_GRAPH_QL_VARIABLES_HEADER } from '../../graphql/graphqlHeaders';
|
|
12
13
|
import { DATADOG_BAGGAGE_HEADER, isDatadogCustomHeader } from '../../headers';
|
|
13
14
|
import { RequestProxy } from '../interfaces/RequestProxy';
|
|
15
|
+
import { ResourceReporter } from './DatadogRumResource/ResourceReporter';
|
|
16
|
+
import { filterDevResource } from './DatadogRumResource/internalDevResourceBlocklist';
|
|
14
17
|
import { URLHostParser } from './URLHostParser';
|
|
15
18
|
import { formatBaggageHeader } from './baggageHeaderUtils';
|
|
16
19
|
import { calculateResponseSize } from './responseSize';
|
|
@@ -23,6 +26,12 @@ export class XHRProxy extends RequestProxy {
|
|
|
23
26
|
super();
|
|
24
27
|
this.providers = providers;
|
|
25
28
|
}
|
|
29
|
+
static createWithResourceReporter() {
|
|
30
|
+
return new XHRProxy({
|
|
31
|
+
xhrType: XMLHttpRequest,
|
|
32
|
+
resourceReporter: new ResourceReporter([filterDevResource])
|
|
33
|
+
});
|
|
34
|
+
}
|
|
26
35
|
onTrackingStart = context => {
|
|
27
36
|
XHRProxy.originalXhrOpen = this.providers.xhrType.prototype.open;
|
|
28
37
|
XHRProxy.originalXhrSend = this.providers.xhrType.prototype.send;
|
|
@@ -60,7 +69,9 @@ const proxyOpen = ({
|
|
|
60
69
|
hostname,
|
|
61
70
|
firstPartyHostsRegexMap,
|
|
62
71
|
tracingSamplingRate,
|
|
63
|
-
rumSessionId: getCachedSessionId()
|
|
72
|
+
rumSessionId: getCachedSessionId(),
|
|
73
|
+
userId: getCachedUserId(),
|
|
74
|
+
accountId: getCachedAccountId()
|
|
64
75
|
}),
|
|
65
76
|
baggageHeaderEntries: new Set()
|
|
66
77
|
};
|
package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/XHRProxy.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Timer","getCachedSessionId","
|
|
1
|
+
{"version":3,"names":["Timer","getCachedAccountId","getCachedSessionId","getCachedUserId","getTracingHeadersFromAttributes","getTracingAttributes","BAGGAGE_HEADER_KEY","DATADOG_GRAPH_QL_OPERATION_NAME_HEADER","DATADOG_GRAPH_QL_OPERATION_TYPE_HEADER","DATADOG_GRAPH_QL_VARIABLES_HEADER","DATADOG_BAGGAGE_HEADER","isDatadogCustomHeader","RequestProxy","ResourceReporter","filterDevResource","URLHostParser","formatBaggageHeader","calculateResponseSize","RESPONSE_START_LABEL","XHRProxy","constructor","providers","createWithResourceReporter","xhrType","XMLHttpRequest","resourceReporter","onTrackingStart","context","originalXhrOpen","prototype","open","originalXhrSend","send","originalXhrSetRequestHeader","setRequestHeader","proxyRequests","onTrackingStop","proxyOpen","proxySend","proxySetRequestHeader","firstPartyHostsRegexMap","tracingSamplingRate","method","url","hostname","_datadog_xhr","reported","timer","graphql","tracingAttributes","rumSessionId","userId","accountId","baggageHeaderEntries","Set","apply","arguments","start","tracingHeaders","forEach","header","value","baggageHeader","proxyOnReadyStateChange","xhrProxy","originalOnreadystatechange","onreadystatechange","readyState","DONE","reportXhr","HEADERS_RECEIVED","recordTick","responseSize","key","startTime","stop","reportResource","request","kind","graphqlAttributes","response","statusCode","status","size","timings","stopTime","responseStartTime","hasTickFor","timeAt","undefined","resourceContext","sendRequestHeader","toLowerCase","operationName","operationType","variables","add"],"sourceRoot":"../../../../../../../src","sources":["rum/instrumentation/resourceTracking/requestProxy/XHRProxy/XHRProxy.ts"],"mappings":"AAAA;AACA;AACA;AACA;AACA;;AAEA,SAASA,KAAK,QAAQ,4BAA4B;AAClD,SACIC,kBAAkB,EAClBC,kBAAkB,EAClBC,eAAe,QACZ,oBAAoB;AAE3B,SAASC,+BAA+B,QAAQ,oDAAoD;AACpG,SAASC,oBAAoB,QAAQ,6CAA6C;AAClF,SAASC,kBAAkB,QAAQ,kCAAkC;AACrE,SACIC,sCAAsC,EACtCC,sCAAsC,EACtCC,iCAAiC,QAC9B,8BAA8B;AACrC,SAASC,sBAAsB,EAAEC,qBAAqB,QAAQ,eAAe;AAE7E,SAASC,YAAY,QAAQ,4BAA4B;AAEzD,SAASC,gBAAgB,QAAQ,uCAAuC;AACxE,SAASC,iBAAiB,QAAQ,mDAAmD;AACrF,SAASC,aAA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AAC,CAAC;AACN,CAAC;AAED,MAAMzB,qBAAqB,GAAIlB,SAA4B,IAAW;EAClE,MAAME,OAAO,GAAGF,SAAS,CAACE,OAAO;EACjC,MAAMU,2BAA2B,GAAGV,OAAO,CAACM,SAAS,CAACK,gBAAgB;EAEtEX,OAAO,CAACM,SAAS,CAACK,gBAAgB,GAAG,SAASyD,iBAAiBA,CAE3D/B,MAAc,EACdC,KAAa,EACf;IACE,MAAMY,GAAG,GAAGb,MAAM,CAACgC,WAAW,CAAC,CAAC;IAChC,IAAIjF,qBAAqB,CAAC8D,GAAG,CAAC,EAAE;MAC5B,QAAQA,GAAG;QACP,KAAKlE,sCAAsC;UACvC,IAAI,CAACsC,YAAY,CAACG,OAAO,CAAC6C,aAAa,GAAGhC,KAAK;UAC/C;QACJ,KAAKrD,sCAAsC;UACvC,IAAI,CAACqC,YAAY,CAACG,OAAO,CAAC8C,aAAa,GAAGjC,KAAK;UAC/C;QACJ,KAAKpD,iCAAiC;UAClC,IAAI,CAACoC,YAAY,CAACG,OAAO,CAAC+C,SAAS,GAAGlC,KAAK;UAC3C;QACJ,KAAKnD,sBAAsB;UACvB;UACA,OAAOuB,2BAA2B,CAACsB,KAAK,CAAC,IAAI,EAAE,CAC3CjD,kBAAkB,EAClBuD,KAAK,CACR,CAAC;QACN;UACI,OAAO5B,2BAA2B,CAACsB,KAAK,CACpC,IAAI;UACJ;UACAC,SACJ,CAAC;MACT;IACJ,CAAC,MAAM,IAAIiB,GAAG,KAAKnE,kBAAkB,EAAE;MACnC;MACA,IAAI,CAACuC,YAAY,CAACQ,oBAAoB,EAAE2C,GAAG,CAACnC,KAAK,CAAC;IACtD,CAAC,MAAM;MACH;MACA,OAAO5B,2BAA2B,CAACsB,KAAK,CAAC,IAAI,EAAEC,SAAgB,CAAC;IACpE;EACJ,CAAC;AACL,CAAC","ignoreList":[]}
|
package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/baggageHeaderUtils.js
CHANGED
|
@@ -5,7 +5,8 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import { InternalLog } from '../../../../../InternalLog';
|
|
8
|
-
import { SdkVerbosity } from '../../../../../SdkVerbosity';
|
|
8
|
+
import { SdkVerbosity } from '../../../../../config/types/SdkVerbosity';
|
|
9
|
+
import { DD_RUM_ACCOUNT_ID_TAG, DD_RUM_SESSION_ID_TAG, DD_RUM_USER_ID_TAG } from '../../distributedTracing/headers';
|
|
9
10
|
|
|
10
11
|
// The resulting baggage-string should contain 64 list-members or less (https://www.w3.org/TR/baggage/#limits)
|
|
11
12
|
const MAX_MEMBERS = 64;
|
|
@@ -29,7 +30,7 @@ export function formatBaggageHeader(entries) {
|
|
|
29
30
|
const formattedParts = [];
|
|
30
31
|
for (const rawEntry of entries) {
|
|
31
32
|
if (!rawEntry.includes('=')) {
|
|
32
|
-
InternalLog.log('XHRProxy: Dropped invalid baggage header entry - expected format "key=value".', SdkVerbosity.
|
|
33
|
+
InternalLog.log('XHRProxy: Dropped invalid baggage header entry - expected format "key=value".', SdkVerbosity.ERROR);
|
|
33
34
|
continue;
|
|
34
35
|
}
|
|
35
36
|
|
|
@@ -37,16 +38,27 @@ export function formatBaggageHeader(entries) {
|
|
|
37
38
|
const [mainPart, ...rawProperties] = rawEntry.split(';');
|
|
38
39
|
const idx = mainPart.indexOf('=');
|
|
39
40
|
if (idx <= 0) {
|
|
40
|
-
InternalLog.log("XHRProxy: Dropped invalid baggage header entry - no '=' or empty key", SdkVerbosity.
|
|
41
|
+
InternalLog.log("XHRProxy: Dropped invalid baggage header entry - no '=' or empty key", SdkVerbosity.ERROR);
|
|
41
42
|
continue;
|
|
42
43
|
}
|
|
43
44
|
const rawKey = mainPart.slice(0, idx).trim();
|
|
44
45
|
const rawValue = mainPart.slice(idx + 1).trim();
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
46
|
+
const isDatadogKey = isDatadogPropertyKey(rawKey);
|
|
47
|
+
let encodedValue;
|
|
48
|
+
if (isDatadogKey) {
|
|
49
|
+
// Only encode datadog-specific properties
|
|
50
|
+
encodedValue = isDatadogKey ? encodeValue(rawValue) : rawValue;
|
|
51
|
+
} else {
|
|
52
|
+
if (!TOKEN_REGEX.test(rawKey)) {
|
|
53
|
+
InternalLog.log('XHRProxy: invalid baggage header keys detected (not RFC 7230-compliant); functionality may be affected.', SdkVerbosity.WARN);
|
|
54
|
+
}
|
|
55
|
+
if (!isCompliantBaggageValue(rawValue)) {
|
|
56
|
+
InternalLog.log('XHRProxy: invalid baggage header value detected (not RFC-compliant); functionality may be affected.', SdkVerbosity.WARN);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// non-datadog properties are not encoded
|
|
60
|
+
encodedValue = rawValue;
|
|
48
61
|
}
|
|
49
|
-
const encodedValue = encodeValue(rawValue);
|
|
50
62
|
|
|
51
63
|
// Handle properties
|
|
52
64
|
const properties = [];
|
|
@@ -60,8 +72,7 @@ export function formatBaggageHeader(entries) {
|
|
|
60
72
|
// Property with no value (key1=value1;prop1; ... )
|
|
61
73
|
const propKey = trimmed.trim();
|
|
62
74
|
if (!TOKEN_REGEX.test(propKey)) {
|
|
63
|
-
InternalLog.log('XHRProxy:
|
|
64
|
-
continue;
|
|
75
|
+
InternalLog.log('XHRProxy: invalid baggage header property key detected (not RFC 7230-compliant); functionality may be affected.', SdkVerbosity.WARN);
|
|
65
76
|
}
|
|
66
77
|
properties.push(propKey);
|
|
67
78
|
} else {
|
|
@@ -69,8 +80,7 @@ export function formatBaggageHeader(entries) {
|
|
|
69
80
|
const propKey = trimmed.slice(0, eqIdx).trim();
|
|
70
81
|
const propVal = trimmed.slice(eqIdx + 1).trim();
|
|
71
82
|
if (!TOKEN_REGEX.test(propKey)) {
|
|
72
|
-
InternalLog.log('XHRProxy:
|
|
73
|
-
continue;
|
|
83
|
+
InternalLog.log('XHRProxy: invalid baggage header key-value property key detected (not RFC 7230-compliant); functionality may be affected.', SdkVerbosity.WARN);
|
|
74
84
|
}
|
|
75
85
|
properties.push(`${propKey}=${encodeValue(propVal)}`);
|
|
76
86
|
}
|
|
@@ -84,47 +94,13 @@ export function formatBaggageHeader(entries) {
|
|
|
84
94
|
return null;
|
|
85
95
|
}
|
|
86
96
|
const headerValue = formattedParts.join(',');
|
|
87
|
-
const byteLength =
|
|
97
|
+
const byteLength = Buffer.byteLength(headerValue, 'utf8');
|
|
88
98
|
if (byteLength > MAX_BYTES) {
|
|
89
99
|
InternalLog.log(`Baggage header too large: ${byteLength} bytes > ${MAX_BYTES} - entries may be dropped (https://www.w3.org/TR/baggage/#limits)`, SdkVerbosity.WARN);
|
|
90
100
|
}
|
|
91
101
|
return headerValue;
|
|
92
102
|
}
|
|
93
103
|
|
|
94
|
-
/**
|
|
95
|
-
* Returns the number of bytes needed to encode a string in UTF-8.
|
|
96
|
-
*
|
|
97
|
-
* Useful as a lightweight alternative to Node.js `Buffer.byteLength()`
|
|
98
|
-
* for older environments that do not support it.
|
|
99
|
-
*
|
|
100
|
-
* @param text - The input string.
|
|
101
|
-
* @returns The UTF-8 byte length of the string.
|
|
102
|
-
*/
|
|
103
|
-
function utf8ByteLength(text) {
|
|
104
|
-
let byteLength = text.length;
|
|
105
|
-
for (let i = text.length - 1; i >= 0; i--) {
|
|
106
|
-
const code = text.charCodeAt(i);
|
|
107
|
-
|
|
108
|
-
// 2-byte characters (U+0080 to U+07FF)
|
|
109
|
-
if (code > 0x7f && code <= 0x7ff) {
|
|
110
|
-
byteLength++;
|
|
111
|
-
}
|
|
112
|
-
// 3-byte characters (U+0800 to U+FFFF)
|
|
113
|
-
else if (code > 0x7ff && code <= 0xffff) {
|
|
114
|
-
byteLength += 2;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
// Handle surrogate pairs (4-byte characters, e.g. emoji)
|
|
118
|
-
// These characters already count as 2 in the initial length
|
|
119
|
-
// Encountering the low surrogate already accounts for the full 4 bytes
|
|
120
|
-
// (2 from the initial length + 2 for the 3-byte characters logic above)
|
|
121
|
-
if (code >= 0xdc00 && code <= 0xdfff) {
|
|
122
|
-
i--; // prevents double counting the same character by skipping high surrogate
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
return byteLength;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
104
|
/**
|
|
129
105
|
* Returns a set of valid baggage header characters.
|
|
130
106
|
*/
|
|
@@ -143,13 +119,25 @@ function getBaggageHeaderSafeChars() {
|
|
|
143
119
|
return safeChars;
|
|
144
120
|
}
|
|
145
121
|
|
|
146
|
-
|
|
122
|
+
/**
|
|
123
|
+
* Checks if the given key is a Datadog-specific baggage property key.
|
|
124
|
+
* @param key the baggage property key.
|
|
125
|
+
* @returns true if the key is Datadog-specific, false otherwise.
|
|
126
|
+
*/
|
|
127
|
+
function isDatadogPropertyKey(key) {
|
|
128
|
+
return key === DD_RUM_SESSION_ID_TAG || key === DD_RUM_USER_ID_TAG || key === DD_RUM_ACCOUNT_ID_TAG;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/**
|
|
147
132
|
* Percent-encode all characters outside baggage-octet range.
|
|
133
|
+
* @param raw The raw baggage value.
|
|
134
|
+
* @returns the encoded baggage value.
|
|
148
135
|
*/
|
|
149
136
|
function encodeValue(raw) {
|
|
137
|
+
const decoded = tryDecodeValue(raw);
|
|
150
138
|
const safeChars = getBaggageHeaderSafeChars();
|
|
151
139
|
let result = '';
|
|
152
|
-
for (const ch of Array.from(
|
|
140
|
+
for (const ch of Array.from(decoded)) {
|
|
153
141
|
if (safeChars.has(ch)) {
|
|
154
142
|
result += ch;
|
|
155
143
|
} else {
|
|
@@ -161,4 +149,58 @@ function encodeValue(raw) {
|
|
|
161
149
|
}
|
|
162
150
|
return result;
|
|
163
151
|
}
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* Try to decode the given baggage value, to avoid double-encoding.
|
|
155
|
+
* @param rawValue The raw baggage value.
|
|
156
|
+
* @returns the decoded value, or the original raw value if decoding fails.
|
|
157
|
+
*/
|
|
158
|
+
function tryDecodeValue(rawValue) {
|
|
159
|
+
try {
|
|
160
|
+
// Try interpreting it as already-encoded
|
|
161
|
+
return decodeURIComponent(rawValue);
|
|
162
|
+
} catch {
|
|
163
|
+
return rawValue;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Check if a character is a hexadecimal digit.
|
|
169
|
+
* @param ch The character to check.
|
|
170
|
+
* @returns true if the character is a hexadecimal digit, false otherwise.
|
|
171
|
+
*/
|
|
172
|
+
function isHexDigit(ch) {
|
|
173
|
+
return ch >= '0' && ch <= '9' || ch >= 'A' && ch <= 'F' || ch >= 'a' && ch <= 'f';
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* Check if a raw baggage value is RFC-compliant:
|
|
178
|
+
* - characters are in baggage-octet, OR
|
|
179
|
+
* - part of a valid %HH percent-encoded sequence.
|
|
180
|
+
*/
|
|
181
|
+
function isCompliantBaggageValue(raw) {
|
|
182
|
+
const safeChars = getBaggageHeaderSafeChars();
|
|
183
|
+
for (let i = 0; i < raw.length; i++) {
|
|
184
|
+
const ch = raw[i];
|
|
185
|
+
|
|
186
|
+
// Directly allowed character
|
|
187
|
+
if (safeChars.has(ch)) {
|
|
188
|
+
continue;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
// Percent-encoded triplet: %HH
|
|
192
|
+
if (ch === '%' && i + 2 < raw.length) {
|
|
193
|
+
const h1 = raw[i + 1];
|
|
194
|
+
const h2 = raw[i + 2];
|
|
195
|
+
if (isHexDigit(h1) && isHexDigit(h2)) {
|
|
196
|
+
i += 2; // skip the two hex digits
|
|
197
|
+
continue;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
// Not safe and not a valid %HH
|
|
202
|
+
return false;
|
|
203
|
+
}
|
|
204
|
+
return true;
|
|
205
|
+
}
|
|
164
206
|
//# sourceMappingURL=baggageHeaderUtils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["InternalLog","SdkVerbosity","MAX_MEMBERS","MAX_BYTES","TOKEN_REGEX","baggageHeaderSafeChars","formatBaggageHeader","entries","formattedParts","rawEntry","includes","log","
|
|
1
|
+
{"version":3,"names":["InternalLog","SdkVerbosity","DD_RUM_ACCOUNT_ID_TAG","DD_RUM_SESSION_ID_TAG","DD_RUM_USER_ID_TAG","MAX_MEMBERS","MAX_BYTES","TOKEN_REGEX","baggageHeaderSafeChars","formatBaggageHeader","entries","formattedParts","rawEntry","includes","log","ERROR","mainPart","rawProperties","split","idx","indexOf","rawKey","slice","trim","rawValue","isDatadogKey","isDatadogPropertyKey","encodedValue","encodeValue","test","WARN","isCompliantBaggageValue","properties","rawProperty","trimmed","eqIdx","propKey","push","propVal","joinedProps","length","join","headerValue","byteLength","Buffer","getBaggageHeaderSafeChars","safeChars","Set","c","add","String","fromCharCode","key","raw","decoded","tryDecodeValue","result","ch","Array","from","has","utf8Bytes","value","toString","toUpperCase","padStart","decodeURIComponent","isHexDigit","i","h1","h2"],"sourceRoot":"../../../../../../../src","sources":["rum/instrumentation/resourceTracking/requestProxy/XHRProxy/baggageHeaderUtils.ts"],"mappings":"AAAA;AACA;AACA;AACA;AACA;;AAEA,SAASA,WAAW,QAAQ,4BAA4B;AACxD,SAASC,YAAY,QAAQ,0CAA0C;AACvE,SACIC,qBAAqB,EACrBC,qBAAqB,EACrBC,kBAAkB,QACf,kCAAkC;;AAEzC;AACA,MAAMC,WAAW,GAAG,EAAE;;AAEtB;AACA,MAAMC,SAAS,GAAG,IAAI;;AAEtB;AACA,MAAMC,WAAW,GAAG,gCAAgC;;AAEpD;AACA;AACA;AACA,IAAIC,sBAA+C;;AAEnD;AACA;AACA;AACA;AACA,OAAO,SAASC,mBAAmBA,CAACC,OAAoB,EAAiB;EACrE,MAAMC,cAAwB,GAAG,EAAE;EAEnC,KAAK,MAAMC,QAAQ,IAAIF,OAAO,EAAE;IAC5B,IAAI,CAACE,QAAQ,CAACC,QAAQ,C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,CAAC,CAAC;;IAEjB;IACA,IAAItB,SAAS,CAACc,GAAG,CAACH,EAAE,CAAC,EAAE;MACnB;IACJ;;IAEA;IACA,IAAIA,EAAE,KAAK,GAAG,IAAIW,CAAC,GAAG,CAAC,GAAGf,GAAG,CAACb,MAAM,EAAE;MAClC,MAAM6B,EAAE,GAAGhB,GAAG,CAACe,CAAC,GAAG,CAAC,CAAC;MACrB,MAAME,EAAE,GAAGjB,GAAG,CAACe,CAAC,GAAG,CAAC,CAAC;MACrB,IAAID,UAAU,CAACE,EAAE,CAAC,IAAIF,UAAU,CAACG,EAAE,CAAC,EAAE;QAClCF,CAAC,IAAI,CAAC,CAAC,CAAC;QACR;MACJ;IACJ;;IAEA;IACA,OAAO,KAAK;EAChB;EAEA,OAAO,IAAI;AACf","ignoreList":[]}
|
package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/responseSize.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import { InternalLog } from '../../../../../InternalLog';
|
|
8
|
-
import { SdkVerbosity } from '../../../../../SdkVerbosity';
|
|
8
|
+
import { SdkVerbosity } from '../../../../../config/types/SdkVerbosity';
|
|
9
9
|
const MISSING_RESOURCE_SIZE = -1;
|
|
10
10
|
export const RESOURCE_SIZE_ERROR_MESSAGE = "Couldn't get resource size, because an error occurred: ";
|
|
11
11
|
function byteLength(str) {
|
package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/responseSize.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["InternalLog","SdkVerbosity","MISSING_RESOURCE_SIZE","RESOURCE_SIZE_ERROR_MESSAGE","byteLength","str","unescape","encodeURI","length","getResponseContentLengthFromHeader","xhr","contentLengthHeader","parseInt","getResponseHeader","isNaN","calculateResponseSize","response","size","responseType","JSON","stringify","e","log","ERROR"],"sourceRoot":"../../../../../../../src","sources":["rum/instrumentation/resourceTracking/requestProxy/XHRProxy/responseSize.ts"],"mappings":"AAAA;AACA;AACA;AACA;AACA;;AAEA,SAASA,WAAW,QAAQ,4BAA4B;AACxD,SAASC,YAAY,QAAQ,
|
|
1
|
+
{"version":3,"names":["InternalLog","SdkVerbosity","MISSING_RESOURCE_SIZE","RESOURCE_SIZE_ERROR_MESSAGE","byteLength","str","unescape","encodeURI","length","getResponseContentLengthFromHeader","xhr","contentLengthHeader","parseInt","getResponseHeader","isNaN","calculateResponseSize","response","size","responseType","JSON","stringify","e","log","ERROR"],"sourceRoot":"../../../../../../../src","sources":["rum/instrumentation/resourceTracking/requestProxy/XHRProxy/responseSize.ts"],"mappings":"AAAA;AACA;AACA;AACA;AACA;;AAEA,SAASA,WAAW,QAAQ,4BAA4B;AACxD,SAASC,YAAY,QAAQ,0CAA0C;AAEvE,MAAMC,qBAAqB,GAAG,CAAC,CAAC;AAChC,OAAO,MAAMC,2BAA2B,GACpC,yDAAyD;AAE7D,SAASC,UAAUA,CAACC,GAAW,EAAU;EACrC;EACA;EACA,OAAOC,QAAQ,CAACC,SAAS,CAACF,GAAG,CAAC,CAAC,CAACG,MAAM;AAC1C;AAEA,SAASC,kCAAkCA,CACvCC,GAAmB,EACN;EACb,MAAMC,mBAAmB,GAAGC,QAAQ,CAChCF,GAAG,CAACG,iBAAiB,CAAC,gBAAgB,CAAC,IAAI,EAAE,EAC7C,EACJ,CAAC;EACD,IAAI,CAACC,KAAK,CAACH,mBAAmB,CAAC,EAAE;IAC7B,OAAOA,mBAAmB;EAC9B;EACA,OAAO,IAAI;AACf;AAEA,OAAO,SAASI,qBAAqBA,CAACL,GAAmB,EAAU;EAC/D,MAAMC,mBAAmB,GAAGF,kCAAkC,CAACC,GAAG,CAAC;EACnE,IAAIC,mBAAmB,IAAI,IAAI,EAAE;IAC7B,OAAOA,mBAAmB;EAC9B;EAEA,MAAMK,QAAQ,GAAGN,GAAG,CAACM,QAAQ;EAC7B,IAAI,CAACA,QAAQ,EAAE;IACX,OAAOd,qBAAqB;EAChC;EAEA,IAAIe,IAAI;EACR,IAAI;IACA,QAAQP,GAAG,CAACQ,YAAY;MACpB,KAAK,EAAE;MACP,KAAK,MAAM;QACP;QACAD,IAAI,GAAGb,UAAU,CAACY,QAAQ,CAAC;QAC3B;MACJ,KAAK,MAAM;QACPC,IAAI,GAAGD,QAAQ,CAACC,IAAI;QACpB;MACJ,KAAK,aAAa;QACdA,IAAI,GAAGD,QAAQ,CAACZ,UAAU;QAC1B;MACJ,KAAK,UAAU;QACX;QACA;QACA;MACJ,KAAK,MAAM;QACP;QACA;QACA;QACA;QACAa,IAAI,GAAGb,UAAU,CAACe,IAAI,CAACC,SAAS,CAACJ,QAAQ,CAAC,CAAC;QAC3C;MACJ;QACI;IACR;EACJ,CAAC,CAAC,OAAOK,CAAC,EAAE;IACRrB,WAAW,CAACsB,GAAG,CACX,GAAGnB,2BAA2B,GAAGkB,CAAC,EAAE,EACpCpB,YAAY,CAACsB,KACjB,CAAC;EACL;EAEA,IAAI,OAAON,IAAI,KAAK,QAAQ,EAAE;IAC1B,OAAOf,qBAAqB;EAChC;EACA,OAAOe,IAAI;AACf","ignoreList":[]}
|
package/lib/module/rum/types.js
CHANGED
|
@@ -24,15 +24,6 @@ export let RumActionType = /*#__PURE__*/function (RumActionType) {
|
|
|
24
24
|
RumActionType["CUSTOM"] = "CUSTOM";
|
|
25
25
|
return RumActionType;
|
|
26
26
|
}({});
|
|
27
|
-
export let ErrorSource = /*#__PURE__*/function (ErrorSource) {
|
|
28
|
-
ErrorSource["NETWORK"] = "NETWORK";
|
|
29
|
-
ErrorSource["SOURCE"] = "SOURCE";
|
|
30
|
-
ErrorSource["CONSOLE"] = "CONSOLE";
|
|
31
|
-
ErrorSource["WEBVIEW"] = "WEBVIEW";
|
|
32
|
-
ErrorSource["CUSTOM"] = "CUSTOM";
|
|
33
|
-
return ErrorSource;
|
|
34
|
-
}({});
|
|
35
|
-
|
|
36
27
|
/**
|
|
37
28
|
* Type of instrumentation on the host.
|
|
38
29
|
* - DATADOG: Datadog’s propagator (`x-datadog-*`)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["RumActionType","
|
|
1
|
+
{"version":3,"names":["RumActionType","PropagatorType","ActionSource"],"sourceRoot":"../../../src","sources":["rum/types.ts"],"mappings":"AAAA;AACA;AACA;AACA;AACA;;AAQA;AACA;AACA;;AAoQA;AACA;AACA;AACA,WAAYA,aAAa,0BAAbA,aAAa;EACrB;EADQA,aAAa;EAGrB;EAHQA,aAAa;EAKrB;EALQA,aAAa;EAOrB;EAPQA,aAAa;EASrB;EATQA,aAAa;EAAA,OAAbA,aAAa;AAAA;AA0BzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAYC,cAAc,0BAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAA,OAAdA,cAAc;AAAA;AAO1B,WAAYC,YAAY,0BAAZA,YAAY;EAAZA,YAAY;EAAZA,YAAY;EAAZA,YAAY;EAAA,OAAZA,YAAY;AAAA","ignoreList":[]}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.
|
|
3
|
+
* This product includes software developed at Datadog (https://www.datadoghq.com/).
|
|
4
|
+
* Copyright 2016-Present Datadog, Inc.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { setCachedAccountId } from '../../rum/helper';
|
|
8
|
+
class AccountInfoProvider {
|
|
9
|
+
accountInfo = undefined;
|
|
10
|
+
setAccountInfo = accountInfo => {
|
|
11
|
+
this.accountInfo = accountInfo;
|
|
12
|
+
setCachedAccountId(this.accountInfo.id);
|
|
13
|
+
};
|
|
14
|
+
addAccountExtraInfo = extraInfo => {
|
|
15
|
+
if (!this.accountInfo) {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
this.accountInfo.extraInfo = {
|
|
19
|
+
...this.accountInfo.extraInfo,
|
|
20
|
+
...extraInfo
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
getAccountInfo = () => {
|
|
24
|
+
return this.accountInfo;
|
|
25
|
+
};
|
|
26
|
+
clearAccountInfo = () => {
|
|
27
|
+
this.accountInfo = undefined;
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
export class AccountInfoSingleton {
|
|
31
|
+
static accountInfoProvider = new AccountInfoProvider();
|
|
32
|
+
static getInstance = () => {
|
|
33
|
+
return AccountInfoSingleton.accountInfoProvider;
|
|
34
|
+
};
|
|
35
|
+
static reset = () => {
|
|
36
|
+
AccountInfoSingleton.accountInfoProvider = new AccountInfoProvider();
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=AccountInfoSingleton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["setCachedAccountId","AccountInfoProvider","accountInfo","undefined","setAccountInfo","id","addAccountExtraInfo","extraInfo","getAccountInfo","clearAccountInfo","AccountInfoSingleton","accountInfoProvider","getInstance","reset"],"sourceRoot":"../../../../src","sources":["sdk/AccountInfoSingleton/AccountInfoSingleton.ts"],"mappings":"AAAA;AACA;AACA;AACA;AACA;;AAEA,SAASA,kBAAkB,QAAQ,kBAAkB;AAIrD,MAAMC,mBAAmB,CAAC;EACdC,WAAW,GAA4BC,SAAS;EAExDC,cAAc,GAAIF,WAAwB,IAAK;IAC3C,IAAI,CAACA,WAAW,GAAGA,WAAW;IAC9BF,kBAAkB,CAAC,IAAI,CAACE,WAAW,CAACG,EAAE,CAAC;EAC3C,CAAC;EAEDC,mBAAmB,GAAIC,SAAmC,IAAK;IAC3D,IAAI,CAAC,IAAI,CAACL,WAAW,EAAE;MACnB;IACJ;IAEA,IAAI,CAACA,WAAW,CAACK,SAAS,GAAG;MACzB,GAAG,IAAI,CAACL,WAAW,CAACK,SAAS;MAC7B,GAAGA;IACP,CAAC;EACL,CAAC;EAEDC,cAAc,GAAGA,CAAA,KAA+B;IAC5C,OAAO,IAAI,CAACN,WAAW;EAC3B,CAAC;EAEDO,gBAAgB,GAAGA,CAAA,KAAM;IACrB,IAAI,CAACP,WAAW,GAAGC,SAAS;EAChC,CAAC;AACL;AAEA,OAAO,MAAMO,oBAAoB,CAAC;EAC9B,OAAeC,mBAAmB,GAAG,IAAIV,mBAAmB,CAAC,CAAC;EAE9D,OAAOW,WAAW,GAAGA,CAAA,KAA2B;IAC5C,OAAOF,oBAAoB,CAACC,mBAAmB;EACnD,CAAC;EAED,OAAOE,KAAK,GAAGA,CAAA,KAAM;IACjBH,oBAAoB,CAACC,mBAAmB,GAAG,IAAIV,mBAAmB,CAAC,CAAC;EACxE,CAAC;AACL","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../../src","sources":["sdk/AccountInfoSingleton/types.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.
|
|
3
|
+
* This product includes software developed at Datadog (https://www.datadoghq.com/).
|
|
4
|
+
* Copyright 2016-Present Datadog, Inc.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { DdSdk } from '../DdSdk';
|
|
8
|
+
import { builtInEncoders } from './defaultEncoders';
|
|
9
|
+
import { encodeAttributesInPlace } from './helpers';
|
|
10
|
+
import { isPlainObject, warn } from './utils';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Encodes arbitrary input into a flat dictionary of attributes.
|
|
14
|
+
* - Objects are flattened using dot syntax. Max depth handling is done on the native layer by the
|
|
15
|
+
* Android and iOS SDKs.
|
|
16
|
+
* - We assume the input does not always conform to Record<string, Encodable> and we:
|
|
17
|
+
* - Fallback to { context: givenValue } if a primitive is passed
|
|
18
|
+
* - Apply built-in and consumer encoders to all values
|
|
19
|
+
* - Drop values of unsupported types
|
|
20
|
+
* - Internal SDK attributes (starting with '_dd.') are preserved as-is without flattening
|
|
21
|
+
*/
|
|
22
|
+
export function encodeAttributes(input) {
|
|
23
|
+
const result = {};
|
|
24
|
+
const allEncoders = [...DdSdk.attributeEncoders, ...builtInEncoders];
|
|
25
|
+
const context = {
|
|
26
|
+
numOfAttributes: 0
|
|
27
|
+
};
|
|
28
|
+
if (isPlainObject(input)) {
|
|
29
|
+
for (const [k, v] of Object.entries(input)) {
|
|
30
|
+
// Internal SDK attributes (starting with '_dd.') should not be flattened
|
|
31
|
+
// as they have a specific structure expected by the native SDK
|
|
32
|
+
if (k.startsWith('_dd.')) {
|
|
33
|
+
result[k] = v;
|
|
34
|
+
context.numOfAttributes++;
|
|
35
|
+
} else {
|
|
36
|
+
encodeAttributesInPlace(v, result, [k], allEncoders, context);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
} else {
|
|
40
|
+
// Fallback for primitive values passed as root
|
|
41
|
+
encodeAttributesInPlace(input, result, ['context'], allEncoders, context);
|
|
42
|
+
warn('Warning: attributes root should be an object.\n' + 'Received a primitive/array instead, which will be wrapped under the "context" key.');
|
|
43
|
+
}
|
|
44
|
+
return result;
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=attributesEncoding.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["DdSdk","builtInEncoders","encodeAttributesInPlace","isPlainObject","warn","encodeAttributes","input","result","allEncoders","attributeEncoders","context","numOfAttributes","k","v","Object","entries","startsWith"],"sourceRoot":"../../../../src","sources":["sdk/AttributesEncoding/attributesEncoding.ts"],"mappings":"AAAA;AACA;AACA;AACA;AACA;;AAEA,SAASA,KAAK,QAAQ,UAAU;AAEhC,SAASC,eAAe,QAAQ,mBAAmB;AAEnD,SAASC,uBAAuB,QAAQ,WAAW;AAEnD,SAASC,aAAa,EAAEC,IAAI,QAAQ,SAAS;;AAE7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,gBAAgBA,CAACC,KAAc,EAA6B;EACxE,MAAMC,MAAiC,GAAG,CAAC,CAAC;EAC5C,MAAMC,WAAW,GAAG,CAAC,GAAGR,KAAK,CAACS,iBAAiB,EAAE,GAAGR,eAAe,CAAC;EACpE,MAAMS,OAAsB,GAAG;IAAEC,eAAe,EAAE;EAAE,CAAC;EACrD,IAAIR,aAAa,CAACG,KAAK,CAAC,EAAE;IACtB,KAAK,MAAM,CAACM,CAAC,EAAEC,CAAC,CAAC,IAAIC,MAAM,CAACC,OAAO,CAACT,KAAK,CAAC,EAAE;MACxC;MACA;MACA,IAAIM,CAAC,CAACI,UAAU,CAAC,MAAM,CAAC,EAAE;QACtBT,MAAM,CAACK,CAAC,CAAC,GAAGC,CAAc;QAC1BH,OAAO,CAACC,eAAe,EAAE;MAC7B,CAAC,MAAM;QACHT,uBAAuB,CAACW,CAAC,EAAEN,MAAM,EAAE,CAACK,CAAC,CAAC,EAAEJ,WAAW,EAAEE,OAAO,CAAC;MACjE;IACJ;EACJ,CAAC,MAAM;IACH;IACAR,uBAAuB,CACnBI,KAAK,EACLC,MAAM,EACN,CAAC,SAAS,CAAC,EACXC,WAAW,EACXE,OACJ,CAAC;IACDN,IAAI,CACA,iDAAiD,GAC7C,oFACR,CAAC;EACL;EAEA,OAAOG,MAAM;AACjB","ignoreList":[]}
|