@datadog/mobile-react-native 2.2.0 → 2.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/DatadogSDKReactNative.podspec +2 -1
- package/android/build.gradle +1 -0
- package/android/src/main/kotlin/com/datadog/reactnative/DatadogSDKWrapper.kt +2 -0
- package/android/src/main/kotlin/com/datadog/reactnative/DatadogWrapper.kt +11 -1
- package/android/src/main/kotlin/com/datadog/reactnative/DdLogsImplementation.kt +5 -0
- package/android/src/main/kotlin/com/datadog/reactnative/DdSdkConfiguration.kt +64 -1
- package/android/src/main/kotlin/com/datadog/reactnative/DdSdkConfigurationExt.kt +165 -5
- package/android/src/main/kotlin/com/datadog/reactnative/DdSdkImplementation.kt +6 -354
- package/android/src/main/kotlin/com/datadog/reactnative/DdSdkNativeInitialization.kt +351 -0
- package/android/src/main/kotlin/com/datadog/reactnative/DdSdkReactNativePackage.kt +5 -3
- package/android/src/main/kotlin/com/datadog/reactnative/DdTraceImplementation.kt +10 -0
- package/android/src/main/kotlin/com/datadog/reactnative/JSONFileReader.kt +20 -0
- package/android/src/main/kotlin/com/datadog/reactnative/ProxyAuthenticator.kt +4 -1
- package/android/src/main/kotlin/com/datadog/reactnative/SdkVersion.kt +10 -0
- package/android/src/oldarch/kotlin/com/datadog/reactnative/DdLogs.kt +3 -2
- package/android/src/oldarch/kotlin/com/datadog/reactnative/DdRum.kt +5 -2
- package/android/src/oldarch/kotlin/com/datadog/reactnative/DdSdk.kt +3 -2
- package/android/src/test/kotlin/com/datadog/reactnative/DdSdkConfigurationTest.kt +196 -0
- package/android/src/test/kotlin/com/datadog/reactnative/DdSdkNativeInitializationTest.kt +181 -0
- package/android/src/test/kotlin/com/datadog/reactnative/DdSdkTest.kt +12 -271
- package/android/src/test/kotlin/com/datadog/reactnative/DdTraceTest.kt +10 -0
- package/android/src/test/kotlin/com/datadog/tools/unit/DdSdkConfigurationExt.kt +29 -2
- package/android/src/test/kotlin/com/datadog/tools/unit/MapExt.kt +24 -0
- package/android/src/test/kotlin/com/datadog/tools/unit/forge/DdSdkConfigurationForgeryFactory.kt +9 -1
- package/android/src/test/resources/input/complete-configuration.json +48 -0
- package/android/src/test/resources/input/malformed-configuration.json +5 -0
- package/android/src/test/resources/input/minimal-configuration.json +8 -0
- package/datadog-configuration.gradle +57 -0
- package/datadog-configuration.schema.json +200 -0
- package/ios/Sources/DatadogSDKWrapper.swift +16 -13
- package/ios/Sources/DdLogsImplementation.swift +14 -0
- package/ios/Sources/DdSdk.h +2 -0
- package/ios/Sources/DdSdk.mm +6 -1
- package/ios/Sources/DdSdkConfiguration.swift +47 -56
- package/ios/Sources/DdSdkImplementation.swift +10 -279
- package/ios/Sources/DdSdkNativeInitialization.swift +218 -0
- package/ios/Sources/DdTraceImplementation.swift +3 -1
- package/ios/Sources/GlobalState.swift +1 -1
- package/ios/Sources/JSONFileReader.swift +28 -0
- package/ios/Sources/RNDdSdkConfiguration.swift +227 -9
- package/ios/Sources/SdkVersion.swift +10 -0
- package/lib/commonjs/DdSdkReactNative.js +24 -66
- package/lib/commonjs/DdSdkReactNative.js.map +1 -1
- package/lib/commonjs/DdSdkReactNativeConfiguration.js +24 -4
- package/lib/commonjs/DdSdkReactNativeConfiguration.js.map +1 -1
- package/lib/commonjs/ProxyConfiguration.js +15 -2
- package/lib/commonjs/ProxyConfiguration.js.map +1 -1
- package/lib/commonjs/index.js +8 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/nativeModulesTypes.js +2 -2
- package/lib/commonjs/nativeModulesTypes.js.map +1 -1
- package/lib/commonjs/sdk/DatadogProvider/DatadogProvider.js.map +1 -1
- package/lib/commonjs/sdk/FileBasedConfiguration/FileBasedConfiguration.js +214 -0
- package/lib/commonjs/sdk/FileBasedConfiguration/FileBasedConfiguration.js.map +1 -0
- package/lib/commonjs/types.js +10 -2
- package/lib/commonjs/types.js.map +1 -1
- package/lib/commonjs/version.js +1 -1
- package/lib/commonjs/version.js.map +1 -1
- package/lib/module/DdSdkReactNative.js +23 -65
- package/lib/module/DdSdkReactNative.js.map +1 -1
- package/lib/module/DdSdkReactNativeConfiguration.js +22 -4
- package/lib/module/DdSdkReactNativeConfiguration.js.map +1 -1
- package/lib/module/ProxyConfiguration.js +15 -2
- package/lib/module/ProxyConfiguration.js.map +1 -1
- package/lib/module/index.js +2 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/nativeModulesTypes.js +2 -2
- package/lib/module/nativeModulesTypes.js.map +1 -1
- package/lib/module/sdk/DatadogProvider/DatadogProvider.js.map +1 -1
- package/lib/module/sdk/FileBasedConfiguration/FileBasedConfiguration.js +197 -0
- package/lib/module/sdk/FileBasedConfiguration/FileBasedConfiguration.js.map +1 -0
- package/lib/module/types.js +10 -2
- package/lib/module/types.js.map +1 -1
- package/lib/module/version.js +1 -1
- package/lib/module/version.js.map +1 -1
- package/lib/typescript/DdSdkReactNative.d.ts +0 -9
- package/lib/typescript/DdSdkReactNativeConfiguration.d.ts +43 -3
- package/lib/typescript/ProxyConfiguration.d.ts +4 -12
- package/lib/typescript/index.d.ts +2 -1
- package/lib/typescript/nativeModulesTypes.d.ts +2 -2
- package/lib/typescript/sdk/DatadogProvider/DatadogProvider.d.ts +2 -1
- package/lib/typescript/sdk/FileBasedConfiguration/FileBasedConfiguration.d.ts +31 -0
- package/lib/typescript/types.d.ts +29 -3
- package/lib/typescript/version.d.ts +1 -1
- package/package.json +7 -4
- package/src/DdSdkReactNative.tsx +58 -101
- package/src/DdSdkReactNativeConfiguration.tsx +26 -7
- package/src/ProxyConfiguration.tsx +17 -3
- package/src/__tests__/DdSdkReactNative.test.tsx +134 -112
- package/src/__tests__/DdSdkReactNativeConfiguration.test.ts +19 -10
- package/src/__tests__/mock.test.ts +0 -9
- package/src/index.tsx +2 -0
- package/src/nativeModulesTypes.ts +1 -1
- package/src/sdk/DatadogProvider/DatadogProvider.tsx +3 -1
- package/src/sdk/DatadogProvider/__tests__/initialization.test.tsx +12 -5
- package/src/sdk/DatadogProvider/__tests__/initializationModes.test.tsx +1 -2
- package/src/sdk/FileBasedConfiguration/FileBasedConfiguration.ts +235 -0
- package/src/sdk/FileBasedConfiguration/__tests__/FileBasedConfiguration.test.ts +245 -0
- package/src/sdk/FileBasedConfiguration/__tests__/__fixtures__/configuration-all-fields.json +22 -0
- package/src/sdk/FileBasedConfiguration/__tests__/__fixtures__/malformed-configuration.json +5 -0
- package/src/types.tsx +21 -2
- package/src/version.ts +1 -1
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://github.com/DataDog/dd-sdk-reactnative/blob/develop/datadog-configuration.schema.json",
|
|
4
|
+
"title": "Datadog React Native SDK Configuration",
|
|
5
|
+
"description": "Configuration for initializing the Datadog React Native SDK from the native layers.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"properties": {
|
|
8
|
+
"configuration": {
|
|
9
|
+
"description": "Configuration used for initializing the Datadog SDK.",
|
|
10
|
+
"type": "object",
|
|
11
|
+
"properties": {
|
|
12
|
+
"clientToken": {
|
|
13
|
+
"description": "A valid Datadog client token.",
|
|
14
|
+
"type": "string"
|
|
15
|
+
},
|
|
16
|
+
"env": {
|
|
17
|
+
"description": "The application’s environment, for example: prod, pre-prod, staging, etc.",
|
|
18
|
+
"type": "string"
|
|
19
|
+
},
|
|
20
|
+
"applicationId": {
|
|
21
|
+
"description": "The RUM application ID.",
|
|
22
|
+
"type": "string"
|
|
23
|
+
},
|
|
24
|
+
"nativeCrashReportEnabled": {
|
|
25
|
+
"description": "Enables crash reporting for native platforms (iOS, Android). Default `false`.",
|
|
26
|
+
"type": "boolean"
|
|
27
|
+
},
|
|
28
|
+
"nativeLongTaskThresholdMs": {
|
|
29
|
+
"description": "The threshold for native long tasks reporting in milliseconds.",
|
|
30
|
+
"type": "integer"
|
|
31
|
+
},
|
|
32
|
+
"longTaskThresholdMs": {
|
|
33
|
+
"description": "The threshold for javascript long tasks reporting in milliseconds.",
|
|
34
|
+
"type": "integer"
|
|
35
|
+
},
|
|
36
|
+
"sessionSamplingRate": {
|
|
37
|
+
"description": "Percentage of sampled RUM sessions. Range `0`-`100`.",
|
|
38
|
+
"type": "integer"
|
|
39
|
+
},
|
|
40
|
+
"site": {
|
|
41
|
+
"description": "The Datadog site of your organization (can be 'US1', 'US1_FED', 'US3', 'US5', 'AP1' or 'EU1', default is 'US1').",
|
|
42
|
+
"type": "string",
|
|
43
|
+
"enum": ["US1", "US1_FED", "US3", "US5", "EU1", "AP1"]
|
|
44
|
+
},
|
|
45
|
+
"trackingConsent": {
|
|
46
|
+
"description": "Consent, which can take one of the following values: 'PENDING', 'GRANTED', 'NOT_GRANTED'.",
|
|
47
|
+
"type": "string",
|
|
48
|
+
"enum": ["PENDING", "GRANTED", "NOT_GRANTED"]
|
|
49
|
+
},
|
|
50
|
+
"telemetrySampleRate": {
|
|
51
|
+
"description": "The sampling rate for Internal Telemetry (info related to the work of the SDK internals). Range `0`-`100`.",
|
|
52
|
+
"type": "integer"
|
|
53
|
+
},
|
|
54
|
+
"vitalsUpdateFrequency": {
|
|
55
|
+
"description": "Sets the preferred frequency for collecting mobile vitals.",
|
|
56
|
+
"type": "string",
|
|
57
|
+
"enum": ["NEVER", "RARE", "AVERAGE", "FREQUENT"]
|
|
58
|
+
},
|
|
59
|
+
"uploadFrequency": {
|
|
60
|
+
"description": "Sets the preferred frequency for uploading batches of data.",
|
|
61
|
+
"type": "string",
|
|
62
|
+
"enum": ["RARE", "AVERAGE", "FREQUENT"]
|
|
63
|
+
},
|
|
64
|
+
"batchSize": {
|
|
65
|
+
"description": "Defines the Datadog SDK policy when batching data together before uploading it to Datadog servers.",
|
|
66
|
+
"type": "string",
|
|
67
|
+
"enum": ["SMALL", "MEDIUM", "LARGE"]
|
|
68
|
+
},
|
|
69
|
+
"trackFrustrations": {
|
|
70
|
+
"description": "Enables tracking of frustration signals (error taps). Defaults to `true`.",
|
|
71
|
+
"type": "boolean"
|
|
72
|
+
},
|
|
73
|
+
"trackBackgroundEvents": {
|
|
74
|
+
"description": "Enables tracking of RUM event when no RUM View is active.",
|
|
75
|
+
"type": "boolean"
|
|
76
|
+
},
|
|
77
|
+
"customEndpoints": {
|
|
78
|
+
"type": "object",
|
|
79
|
+
"description": "Target a custom server for RUM, Logs and Traces features.",
|
|
80
|
+
"properties": {
|
|
81
|
+
"rum": {
|
|
82
|
+
"type": "string"
|
|
83
|
+
},
|
|
84
|
+
"logs": {
|
|
85
|
+
"type": "string"
|
|
86
|
+
},
|
|
87
|
+
"trace": {
|
|
88
|
+
"type": "string"
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
"nativeViewTracking": {
|
|
93
|
+
"description": "Enables native views tracking.",
|
|
94
|
+
"type": "boolean"
|
|
95
|
+
},
|
|
96
|
+
"nativeInteractionTracking": {
|
|
97
|
+
"description": "Enables native interaction tracking.",
|
|
98
|
+
"type": "boolean"
|
|
99
|
+
},
|
|
100
|
+
"verbosity": {
|
|
101
|
+
"description": "Verbosity for internal SDK logging.",
|
|
102
|
+
"type": "string",
|
|
103
|
+
"enum": ["DEBUG", "INFO", "WARN", "ERROR"]
|
|
104
|
+
},
|
|
105
|
+
"proxy": {
|
|
106
|
+
"type": "object",
|
|
107
|
+
"description": "Configuration for proxying SDK data.",
|
|
108
|
+
"properties": {
|
|
109
|
+
"type": {
|
|
110
|
+
"description": "Proxy type.",
|
|
111
|
+
"type": "string",
|
|
112
|
+
"enum": ["HTTP", "HTTPS", "SOCKS"]
|
|
113
|
+
},
|
|
114
|
+
"address": {
|
|
115
|
+
"description": "Proxy address. Can be either in the IP address format, ex. '1.1.1.1', or hostname, ex. 'example.com'.",
|
|
116
|
+
"type": "string"
|
|
117
|
+
},
|
|
118
|
+
"port": {
|
|
119
|
+
"description": "Proxy port.",
|
|
120
|
+
"type": "integer"
|
|
121
|
+
},
|
|
122
|
+
"username": {
|
|
123
|
+
"description": "Username for Basic authentication scheme. Note: SOCKS + authentication scheme is not supported.",
|
|
124
|
+
"type": "string"
|
|
125
|
+
},
|
|
126
|
+
"password": {
|
|
127
|
+
"description": "Password for Basic authentication scheme.",
|
|
128
|
+
"type": "string"
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
"required": ["type", "port", "address"]
|
|
132
|
+
},
|
|
133
|
+
"serviceName": {
|
|
134
|
+
"description": "Custom service name.",
|
|
135
|
+
"type": "string"
|
|
136
|
+
},
|
|
137
|
+
"version": {
|
|
138
|
+
"description": "Overrides the reported version of the app.",
|
|
139
|
+
"type": "string"
|
|
140
|
+
},
|
|
141
|
+
"firstPartyHosts": {
|
|
142
|
+
"description": "List of your backends hosts to enable tracing with.",
|
|
143
|
+
"type": "array",
|
|
144
|
+
"items": {
|
|
145
|
+
"type": "object",
|
|
146
|
+
"properties": {
|
|
147
|
+
"match": {
|
|
148
|
+
"description": "Matches domains and subdomains, e.g. `['example.com']` matches `example.com` and `api.example.com`. Regular expressions are NOT supported.",
|
|
149
|
+
"type": "string"
|
|
150
|
+
},
|
|
151
|
+
"propagatorTypes": {
|
|
152
|
+
"description": "Types of instrumentation on the host.",
|
|
153
|
+
"type": "array",
|
|
154
|
+
"items": {
|
|
155
|
+
"description": "Type of instrumentation on the host.",
|
|
156
|
+
"type": "string",
|
|
157
|
+
"enum": [
|
|
158
|
+
"DATADOG",
|
|
159
|
+
"B3",
|
|
160
|
+
"B3MULTI",
|
|
161
|
+
"TRACECONTEXT"
|
|
162
|
+
]
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
},
|
|
168
|
+
"trackInteractions": {
|
|
169
|
+
"description": "Track React Native components interactions.",
|
|
170
|
+
"type": "boolean"
|
|
171
|
+
},
|
|
172
|
+
"trackResources": {
|
|
173
|
+
"description": "Track React Native resources.",
|
|
174
|
+
"type": "boolean"
|
|
175
|
+
},
|
|
176
|
+
"trackErrors": {
|
|
177
|
+
"description": "Track React Native errors.",
|
|
178
|
+
"type": "boolean"
|
|
179
|
+
},
|
|
180
|
+
"actionNameAttribute": {
|
|
181
|
+
"description": "Specifies a custom prop to name RUM actions on elements having an `onPress` prop.",
|
|
182
|
+
"type": "string"
|
|
183
|
+
},
|
|
184
|
+
"resourceTracingSamplingRate": {
|
|
185
|
+
"description": "Percentage of tracing integrations for network calls between your app and your backend. Range `0`-`100`.",
|
|
186
|
+
"type": "number"
|
|
187
|
+
},
|
|
188
|
+
"bundleLogsWithRum": {
|
|
189
|
+
"description": "Enables RUM correlation with logs.",
|
|
190
|
+
"type": "boolean"
|
|
191
|
+
},
|
|
192
|
+
"bundleLogsWithTraces": {
|
|
193
|
+
"description": "Enables Traces correlation with logs.",
|
|
194
|
+
"type": "boolean"
|
|
195
|
+
}
|
|
196
|
+
},
|
|
197
|
+
"required": ["clientToken", "env", "applicationId"]
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
}
|
|
@@ -21,18 +21,18 @@ public class DatadogSDKWrapper {
|
|
|
21
21
|
// Singleton
|
|
22
22
|
public static var shared = DatadogSDKWrapper()
|
|
23
23
|
|
|
24
|
-
private init() {}
|
|
25
|
-
|
|
26
24
|
// Initialization callbacks
|
|
27
25
|
internal var onCoreInitializedListeners: [OnCoreInitializedListener] = []
|
|
28
|
-
|
|
26
|
+
internal var loggerConfiguration = DatadogLogs.Logger.Configuration()
|
|
27
|
+
// Core instance
|
|
28
|
+
private var coreInstance: DatadogCoreProtocol? = nil
|
|
29
|
+
|
|
30
|
+
private init() { }
|
|
31
|
+
|
|
29
32
|
public func addOnCoreInitializedListener(listener:@escaping OnCoreInitializedListener) {
|
|
30
33
|
onCoreInitializedListeners.append(listener)
|
|
31
34
|
}
|
|
32
35
|
|
|
33
|
-
// Core instance
|
|
34
|
-
private var coreInstance: DatadogCoreProtocol? = nil
|
|
35
|
-
|
|
36
36
|
/// This is intended for internal testing only.
|
|
37
37
|
public func setCoreInstance(core: DatadogCoreProtocol?) {
|
|
38
38
|
self.coreInstance = core
|
|
@@ -45,14 +45,17 @@ public class DatadogSDKWrapper {
|
|
|
45
45
|
|
|
46
46
|
// SDK Wrapper
|
|
47
47
|
internal func initialize(
|
|
48
|
-
|
|
48
|
+
coreConfiguration: Datadog.Configuration,
|
|
49
|
+
loggerConfiguration: DatadogLogs.Logger.Configuration,
|
|
49
50
|
trackingConsent: TrackingConsent
|
|
50
51
|
) -> Void {
|
|
51
|
-
let core = Datadog.initialize(with:
|
|
52
|
+
let core = Datadog.initialize(with: coreConfiguration, trackingConsent: trackingConsent)
|
|
52
53
|
setCoreInstance(core: core)
|
|
53
54
|
for listener in onCoreInitializedListeners {
|
|
54
55
|
listener(core)
|
|
55
56
|
}
|
|
57
|
+
|
|
58
|
+
self.loggerConfiguration = loggerConfiguration
|
|
56
59
|
}
|
|
57
60
|
|
|
58
61
|
internal func isInitialized() -> Bool {
|
|
@@ -101,12 +104,12 @@ public class DatadogSDKWrapper {
|
|
|
101
104
|
}
|
|
102
105
|
|
|
103
106
|
internal func createLogger() -> LoggerProtocol {
|
|
104
|
-
|
|
105
|
-
return Logger.create(with: Logger.Configuration(networkInfoEnabled: true, consoleLogFormat: .short), in: core)
|
|
106
|
-
} else {
|
|
107
|
+
let core = coreInstance ?? {
|
|
107
108
|
consolePrint("Core instance was not found when creating Logger.", .critical)
|
|
108
|
-
return
|
|
109
|
-
}
|
|
109
|
+
return CoreRegistry.default
|
|
110
|
+
}()
|
|
111
|
+
|
|
112
|
+
return DatadogLogs.Logger.create(with: loggerConfiguration, in: core)
|
|
110
113
|
}
|
|
111
114
|
|
|
112
115
|
// Telemetry
|
|
@@ -111,3 +111,17 @@ public class DdLogsImplementation: NSObject {
|
|
|
111
111
|
resolve(nil)
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
|
+
|
|
115
|
+
internal extension DatadogLogs.Logger.Configuration {
|
|
116
|
+
/// Creates a Logger configuration from briged configuration dictionary.
|
|
117
|
+
///
|
|
118
|
+
/// - Parameter dictionnary: The configuration from the bridge.
|
|
119
|
+
init(_ sdkConfiguration: DdSdkConfiguration) {
|
|
120
|
+
self.init(
|
|
121
|
+
networkInfoEnabled: true,
|
|
122
|
+
bundleWithRumEnabled: sdkConfiguration.bundleLogsWithRum ?? true,
|
|
123
|
+
bundleWithTraceEnabled: sdkConfiguration.bundleLogsWithTraces ?? true,
|
|
124
|
+
consoleLogFormat: .short
|
|
125
|
+
)
|
|
126
|
+
}
|
|
127
|
+
}
|
package/ios/Sources/DdSdk.h
CHANGED
package/ios/Sources/DdSdk.mm
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
#import <DatadogSDKReactNative/DatadogSDKReactNative-Swift.h>
|
|
11
11
|
#endif
|
|
12
12
|
#import "DdSdk.h"
|
|
13
|
-
#import <React/RCTBridge
|
|
13
|
+
#import <React/RCTBridge.h>
|
|
14
14
|
|
|
15
15
|
@implementation DdSdk
|
|
16
16
|
|
|
@@ -96,6 +96,11 @@ RCT_REMAP_METHOD(clearAllData, withResolver:(RCTPromiseResolveBlock)resolve
|
|
|
96
96
|
return NO;
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
+
+ (void)initFromNative {
|
|
100
|
+
DdSdkNativeInitialization *nativeInitialization = [[DdSdkNativeInitialization alloc] init];
|
|
101
|
+
[nativeInitialization initializeFromNative];
|
|
102
|
+
}
|
|
103
|
+
|
|
99
104
|
- (dispatch_queue_t)methodQueue {
|
|
100
105
|
return [RNQueue getSharedQueue];
|
|
101
106
|
}
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
import Foundation
|
|
8
8
|
import DatadogCore
|
|
9
9
|
import DatadogInternal
|
|
10
|
+
import DatadogRUM
|
|
10
11
|
|
|
11
12
|
/**
|
|
12
13
|
A configuration object to initialize Datadog's features.
|
|
@@ -29,6 +30,14 @@ import DatadogInternal
|
|
|
29
30
|
- customEndpoints: Custom endpoints for RUM/Logs/Trace features.
|
|
30
31
|
- additionalConfig: Additional configuration parameters.
|
|
31
32
|
- configurationForTelemetry: Additional configuration paramters only used for telemetry purposes.
|
|
33
|
+
- nativeViewTracking: Enables/Disables tracking RUM Views on the native level.
|
|
34
|
+
- nativeInteractionTracking: Enables/Disables tracking RUM Actions on the native level.
|
|
35
|
+
- verbosity: Verbosity level of the SDK.
|
|
36
|
+
- proxyConfig: Configuration for proxying SDK data.
|
|
37
|
+
- serviceName: Custom service name.
|
|
38
|
+
- firstPartyHosts: List of backend hosts to enable tracing with.
|
|
39
|
+
- bundleLogsWithRum: Correlates logs with RUM.
|
|
40
|
+
- bundleLogsWithTraces: Correlates logs with traces.
|
|
32
41
|
*/
|
|
33
42
|
@objc(DdSdkConfiguration)
|
|
34
43
|
public class DdSdkConfiguration: NSObject {
|
|
@@ -40,9 +49,9 @@ public class DdSdkConfiguration: NSObject {
|
|
|
40
49
|
public var longTaskThresholdMs: Double = 0.0
|
|
41
50
|
public var sampleRate: Double? = nil
|
|
42
51
|
public var site: DatadogSite
|
|
43
|
-
public var trackingConsent:
|
|
52
|
+
public var trackingConsent: TrackingConsent
|
|
44
53
|
public var telemetrySampleRate: Double? = nil
|
|
45
|
-
public var vitalsUpdateFrequency:
|
|
54
|
+
public var vitalsUpdateFrequency: RUM.Configuration.VitalsFrequency? = nil
|
|
46
55
|
public var trackFrustrations: Bool? = nil
|
|
47
56
|
public var uploadFrequency: Datadog.Configuration.UploadFrequency
|
|
48
57
|
public var batchSize: Datadog.Configuration.BatchSize
|
|
@@ -50,6 +59,15 @@ public class DdSdkConfiguration: NSObject {
|
|
|
50
59
|
public var customEndpoints: CustomEndpoints? = nil
|
|
51
60
|
public var additionalConfig: NSDictionary? = nil
|
|
52
61
|
public var configurationForTelemetry: ConfigurationForTelemetry? = nil
|
|
62
|
+
public var nativeViewTracking: Bool? = nil
|
|
63
|
+
public var nativeInteractionTracking: Bool? = nil
|
|
64
|
+
public var verbosity: NSString? = nil
|
|
65
|
+
public var proxyConfig: [AnyHashable: Any]? = nil
|
|
66
|
+
public var serviceName: NSString? = nil
|
|
67
|
+
public var firstPartyHosts: [String: Set<TracingHeaderType>]? = nil
|
|
68
|
+
public var resourceTracingSamplingRate: Double? = nil
|
|
69
|
+
public var bundleLogsWithRum: Bool
|
|
70
|
+
public var bundleLogsWithTraces: Bool
|
|
53
71
|
|
|
54
72
|
public init(
|
|
55
73
|
clientToken: String,
|
|
@@ -59,17 +77,26 @@ public class DdSdkConfiguration: NSObject {
|
|
|
59
77
|
nativeLongTaskThresholdMs: Double?,
|
|
60
78
|
longTaskThresholdMs: Double,
|
|
61
79
|
sampleRate: Double?,
|
|
62
|
-
site:
|
|
63
|
-
trackingConsent:
|
|
80
|
+
site: DatadogSite,
|
|
81
|
+
trackingConsent: TrackingConsent,
|
|
64
82
|
telemetrySampleRate: Double?,
|
|
65
|
-
vitalsUpdateFrequency:
|
|
83
|
+
vitalsUpdateFrequency: RUM.Configuration.VitalsFrequency?,
|
|
66
84
|
trackFrustrations: Bool?,
|
|
67
|
-
uploadFrequency:
|
|
68
|
-
batchSize:
|
|
85
|
+
uploadFrequency: Datadog.Configuration.UploadFrequency,
|
|
86
|
+
batchSize: Datadog.Configuration.BatchSize,
|
|
69
87
|
trackBackgroundEvents: Bool?,
|
|
70
88
|
customEndpoints: CustomEndpoints?,
|
|
71
89
|
additionalConfig: NSDictionary?,
|
|
72
|
-
configurationForTelemetry: ConfigurationForTelemetry
|
|
90
|
+
configurationForTelemetry: ConfigurationForTelemetry?,
|
|
91
|
+
nativeViewTracking: Bool?,
|
|
92
|
+
nativeInteractionTracking: Bool?,
|
|
93
|
+
verbosity: NSString?,
|
|
94
|
+
proxyConfig: [AnyHashable: Any]?,
|
|
95
|
+
serviceName: NSString?,
|
|
96
|
+
firstPartyHosts: [String: Set<TracingHeaderType>]?,
|
|
97
|
+
resourceTracingSamplingRate: Double?,
|
|
98
|
+
bundleLogsWithRum: Bool,
|
|
99
|
+
bundleLogsWithTraces: Bool
|
|
73
100
|
) {
|
|
74
101
|
self.clientToken = clientToken
|
|
75
102
|
self.env = env
|
|
@@ -78,62 +105,26 @@ public class DdSdkConfiguration: NSObject {
|
|
|
78
105
|
self.nativeLongTaskThresholdMs = nativeLongTaskThresholdMs
|
|
79
106
|
self.longTaskThresholdMs = longTaskThresholdMs
|
|
80
107
|
self.sampleRate = sampleRate
|
|
81
|
-
self.site =
|
|
108
|
+
self.site = site
|
|
82
109
|
self.trackingConsent = trackingConsent
|
|
83
110
|
self.telemetrySampleRate = telemetrySampleRate
|
|
84
111
|
self.vitalsUpdateFrequency = vitalsUpdateFrequency
|
|
85
112
|
self.trackFrustrations = trackFrustrations
|
|
86
|
-
self.uploadFrequency =
|
|
87
|
-
self.batchSize =
|
|
113
|
+
self.uploadFrequency = uploadFrequency
|
|
114
|
+
self.batchSize = batchSize
|
|
88
115
|
self.trackBackgroundEvents = trackBackgroundEvents
|
|
89
116
|
self.customEndpoints = customEndpoints
|
|
90
117
|
self.additionalConfig = additionalConfig
|
|
91
118
|
self.configurationForTelemetry = configurationForTelemetry
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
return .us3
|
|
102
|
-
case "us5":
|
|
103
|
-
return .us5
|
|
104
|
-
case "us1_fed", "gov":
|
|
105
|
-
return .us1_fed
|
|
106
|
-
case "ap1":
|
|
107
|
-
return .ap1
|
|
108
|
-
default:
|
|
109
|
-
return .us1
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
static func buildBatchSize(batchSize: NSString?) -> Datadog.Configuration.BatchSize {
|
|
114
|
-
switch batchSize?.lowercased ?? "" {
|
|
115
|
-
case "small":
|
|
116
|
-
return .small
|
|
117
|
-
case "medium":
|
|
118
|
-
return .medium
|
|
119
|
-
case "large":
|
|
120
|
-
return .large
|
|
121
|
-
default:
|
|
122
|
-
return .medium
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
static func buildUploadFrequency(uploadFrequency: NSString?) -> Datadog.Configuration.UploadFrequency {
|
|
127
|
-
switch uploadFrequency?.lowercased ?? "" {
|
|
128
|
-
case "rare":
|
|
129
|
-
return .rare
|
|
130
|
-
case "average":
|
|
131
|
-
return .average
|
|
132
|
-
case "frequent":
|
|
133
|
-
return .frequent
|
|
134
|
-
default:
|
|
135
|
-
return .average
|
|
136
|
-
}
|
|
119
|
+
self.nativeViewTracking = nativeViewTracking
|
|
120
|
+
self.nativeInteractionTracking = nativeInteractionTracking
|
|
121
|
+
self.verbosity = verbosity
|
|
122
|
+
self.proxyConfig = proxyConfig
|
|
123
|
+
self.serviceName = serviceName
|
|
124
|
+
self.firstPartyHosts = firstPartyHosts
|
|
125
|
+
self.resourceTracingSamplingRate = resourceTracingSamplingRate
|
|
126
|
+
self.bundleLogsWithRum = bundleLogsWithRum
|
|
127
|
+
self.bundleLogsWithTraces = bundleLogsWithTraces
|
|
137
128
|
}
|
|
138
129
|
}
|
|
139
130
|
|