@datadog/mobile-react-native 1.0.0-rc3 → 1.0.0-rc4

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.
Files changed (46) hide show
  1. package/DatadogSDKReactNative.podspec +1 -1
  2. package/android/build.gradle +2 -3
  3. package/android/src/main/java/com/datadog/reactnative/DdRum.kt +25 -24
  4. package/android/src/main/java/com/datadog/reactnative/DdTrace.kt +6 -6
  5. package/ios/Sources/DdRum.m +10 -9
  6. package/ios/Sources/DdRum.swift +24 -24
  7. package/ios/Sources/DdTrace.m +2 -2
  8. package/ios/Sources/DdTrace.swift +6 -6
  9. package/lib/commonjs/DdSdkReactNative.js +5 -0
  10. package/lib/commonjs/DdSdkReactNative.js.map +1 -1
  11. package/lib/commonjs/foundation.js +13 -31
  12. package/lib/commonjs/foundation.js.map +1 -1
  13. package/lib/commonjs/rum/instrumentation/DdRumErrorTracking.js +24 -4
  14. package/lib/commonjs/rum/instrumentation/DdRumErrorTracking.js.map +1 -1
  15. package/lib/commonjs/rum/instrumentation/DdRumResourceTracking.js +87 -2
  16. package/lib/commonjs/rum/instrumentation/DdRumResourceTracking.js.map +1 -1
  17. package/lib/commonjs/types.js.map +1 -1
  18. package/lib/commonjs/version.js +10 -0
  19. package/lib/commonjs/version.js.map +1 -0
  20. package/lib/module/DdSdkReactNative.js +4 -0
  21. package/lib/module/DdSdkReactNative.js.map +1 -1
  22. package/lib/module/foundation.js +13 -31
  23. package/lib/module/foundation.js.map +1 -1
  24. package/lib/module/rum/instrumentation/DdRumErrorTracking.js +23 -4
  25. package/lib/module/rum/instrumentation/DdRumErrorTracking.js.map +1 -1
  26. package/lib/module/rum/instrumentation/DdRumResourceTracking.js +83 -2
  27. package/lib/module/rum/instrumentation/DdRumResourceTracking.js.map +1 -1
  28. package/lib/module/types.js.map +1 -1
  29. package/lib/module/version.js +3 -0
  30. package/lib/module/version.js.map +1 -0
  31. package/lib/typescript/DdSdkReactNative.d.ts +1 -0
  32. package/lib/typescript/rum/instrumentation/DdRumErrorTracking.d.ts +1 -0
  33. package/lib/typescript/rum/instrumentation/DdRumResourceTracking.d.ts +4 -0
  34. package/lib/typescript/types.d.ts +12 -11
  35. package/lib/typescript/version.d.ts +1 -0
  36. package/package.json +3 -3
  37. package/src/DdSdkReactNative.tsx +4 -0
  38. package/src/__tests__/DdRumWrapper.test.tsx +91 -0
  39. package/src/__tests__/DdSdkReactNative.test.tsx +15 -0
  40. package/src/__tests__/rum/instrumentation/DdRumErrorTracking.test.tsx +104 -10
  41. package/src/__tests__/rum/instrumentation/DdRumResourceTracking.test.tsx +265 -15
  42. package/src/foundation.tsx +64 -70
  43. package/src/rum/instrumentation/DdRumErrorTracking.tsx +28 -7
  44. package/src/rum/instrumentation/DdRumResourceTracking.tsx +74 -2
  45. package/src/types.tsx +12 -11
  46. package/src/version.ts +2 -0
@@ -17,7 +17,7 @@ Pod::Spec.new do |s|
17
17
  s.source_files = "ios/Sources/*.{h,m,mm,swift}"
18
18
 
19
19
  s.dependency "React-Core"
20
- s.dependency "DatadogSDKBridge", "~> 0.4.7"
20
+ s.dependency "DatadogSDKBridge", "0.5.1"
21
21
 
22
22
  s.test_spec 'Tests' do |test_spec|
23
23
  test_spec.source_files = 'ios/Tests/*.swift'
@@ -3,8 +3,8 @@ buildscript {
3
3
  def kotlin_version = rootProject.ext.has('kotlinVersion') ? rootProject.ext.get('kotlinVersion') : project.properties['DdSdkReactNative_kotlinVersion']
4
4
 
5
5
  repositories {
6
+ mavenCentral()
6
7
  google()
7
- jcenter()
8
8
  }
9
9
 
10
10
  dependencies {
@@ -52,7 +52,6 @@ android {
52
52
 
53
53
  repositories {
54
54
  mavenCentral()
55
- jcenter()
56
55
  google()
57
56
  maven { url "https://jitpack.io" }
58
57
  mavenLocal()
@@ -129,7 +128,7 @@ dependencies {
129
128
  // noinspection GradleDynamicVersion
130
129
  api 'com.facebook.react:react-native:+'
131
130
 
132
- implementation "com.datadoghq:dd-bridge-android:0.4.6"
131
+ implementation "com.datadoghq:dd-bridge-android:0.5.2"
133
132
 
134
133
  implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
135
134
  }
@@ -28,24 +28,24 @@ class DdRum(reactContext: ReactApplicationContext) : ReactContextBaseJavaModule(
28
28
  * Start tracking a RUM View.
29
29
  * @param key The view unique key identifier.
30
30
  * @param name The view name.
31
- * @param timestampMs The timestamp when the view started (in milliseconds).
32
31
  * @param context The additional context to send.
32
+ * @param timestampMs The timestamp when the view started (in milliseconds). If not provided, current timestamp will be used.
33
33
  */
34
34
  @ReactMethod
35
- fun startView(key: String, name: String, timestampMs: Double, context: ReadableMap, promise: Promise) {
36
- nativeInstance.startView(key, name, timestampMs.toLong(), context.toHashMap())
35
+ fun startView(key: String, name: String, context: ReadableMap, timestampMs: Double, promise: Promise) {
36
+ nativeInstance.startView(key, name, context.toHashMap(), timestampMs.toLong())
37
37
  promise.resolve(null)
38
38
  }
39
39
 
40
40
  /**
41
41
  * Stop tracking a RUM View.
42
42
  * @param key The view unique key identifier.
43
- * @param timestampMs The timestamp when the view stopped (in milliseconds).
44
43
  * @param context The additional context to send.
44
+ * @param timestampMs The timestamp when the view stopped (in milliseconds). If not provided, current timestamp will be used.
45
45
  */
46
46
  @ReactMethod
47
- fun stopView(key: String, timestampMs: Double, context: ReadableMap, promise: Promise) {
48
- nativeInstance.stopView(key, timestampMs.toLong(), context.toHashMap())
47
+ fun stopView(key: String, context: ReadableMap, timestampMs: Double, promise: Promise) {
48
+ nativeInstance.stopView(key, context.toHashMap(), timestampMs.toLong())
49
49
  promise.resolve(null)
50
50
  }
51
51
 
@@ -53,23 +53,23 @@ class DdRum(reactContext: ReactApplicationContext) : ReactContextBaseJavaModule(
53
53
  * Start tracking a RUM Action.
54
54
  * @param type The action type (tap, scroll, swipe, click, custom).
55
55
  * @param name The action name.
56
- * @param timestampMs The timestamp when the action started (in milliseconds).
57
56
  * @param context The additional context to send.
57
+ * @param timestampMs The timestamp when the action started (in milliseconds). If not provided, current timestamp will be used.
58
58
  */
59
59
  @ReactMethod
60
- fun startAction(type: String, name: String, timestampMs: Double, context: ReadableMap, promise: Promise) {
61
- nativeInstance.startAction(type, name, timestampMs.toLong(), context.toHashMap())
60
+ fun startAction(type: String, name: String, context: ReadableMap, timestampMs: Double, promise: Promise) {
61
+ nativeInstance.startAction(type, name, context.toHashMap(), timestampMs.toLong())
62
62
  promise.resolve(null)
63
63
  }
64
64
 
65
65
  /**
66
66
  * Stop tracking the ongoing RUM Action.
67
- * @param timestampMs The timestamp when the action stopped (in milliseconds).
68
67
  * @param context The additional context to send.
68
+ * @param timestampMs The timestamp when the action stopped (in milliseconds). If not provided, current timestamp will be used.
69
69
  */
70
70
  @ReactMethod
71
- fun stopAction(timestampMs: Double, context: ReadableMap, promise: Promise) {
72
- nativeInstance.stopAction(timestampMs.toLong(), context.toHashMap())
71
+ fun stopAction(context: ReadableMap, timestampMs: Double, promise: Promise) {
72
+ nativeInstance.stopAction(context.toHashMap(), timestampMs.toLong())
73
73
  promise.resolve(null)
74
74
  }
75
75
 
@@ -77,12 +77,12 @@ class DdRum(reactContext: ReactApplicationContext) : ReactContextBaseJavaModule(
77
77
  * Add a RUM Action.
78
78
  * @param type The action type (tap, scroll, swipe, click, custom).
79
79
  * @param name The action name.
80
- * @param timestampMs The timestamp when the action occurred (in milliseconds).
81
80
  * @param context The additional context to send.
81
+ * @param timestampMs The timestamp when the action occurred (in milliseconds). If not provided, current timestamp will be used.
82
82
  */
83
83
  @ReactMethod
84
- fun addAction(type: String, name: String, timestampMs: Double, context: ReadableMap, promise: Promise) {
85
- nativeInstance.addAction(type, name, timestampMs.toLong(), context.toHashMap())
84
+ fun addAction(type: String, name: String, context: ReadableMap, timestampMs: Double, promise: Promise) {
85
+ nativeInstance.addAction(type, name, context.toHashMap(), timestampMs.toLong())
86
86
  promise.resolve(null)
87
87
  }
88
88
 
@@ -91,12 +91,12 @@ class DdRum(reactContext: ReactApplicationContext) : ReactContextBaseJavaModule(
91
91
  * @param key The resource unique key identifier.
92
92
  * @param method The resource method (GET, POST, …).
93
93
  * @param url The resource url.
94
- * @param timestampMs The timestamp when the resource started (in milliseconds).
95
94
  * @param context The additional context to send.
95
+ * @param timestampMs The timestamp when the resource started (in milliseconds). If not provided, current timestamp will be used.
96
96
  */
97
97
  @ReactMethod
98
- fun startResource(key: String, method: String, url: String, timestampMs: Double, context: ReadableMap, promise: Promise) {
99
- nativeInstance.startResource(key, method, url, timestampMs.toLong(), context.toHashMap())
98
+ fun startResource(key: String, method: String, url: String, context: ReadableMap, timestampMs: Double, promise: Promise) {
99
+ nativeInstance.startResource(key, method, url, context.toHashMap(), timestampMs.toLong())
100
100
  promise.resolve(null)
101
101
  }
102
102
 
@@ -105,12 +105,13 @@ class DdRum(reactContext: ReactApplicationContext) : ReactContextBaseJavaModule(
105
105
  * @param key The resource unique key identifier.
106
106
  * @param statusCode The resource status code.
107
107
  * @param kind The resource's kind (xhr, document, image, css, font, …).
108
- * @param timestampMs The timestamp when the resource stopped (in milliseconds).
108
+ * @param size The resource size in bytes.
109
109
  * @param context The additional context to send.
110
+ * @param timestampMs The timestamp when the resource stopped (in milliseconds). If not provided, current timestamp will be used.
110
111
  */
111
112
  @ReactMethod
112
- fun stopResource(key: String, statusCode: Double, kind: String, timestampMs: Double, context: ReadableMap, promise: Promise) {
113
- nativeInstance.stopResource(key, statusCode.toLong(), kind, timestampMs.toLong(), context.toHashMap())
113
+ fun stopResource(key: String, statusCode: Double, kind: String, size: Double, context: ReadableMap, timestampMs: Double, promise: Promise) {
114
+ nativeInstance.stopResource(key, statusCode.toLong(), kind, size.toLong(), context.toHashMap(), timestampMs.toLong())
114
115
  promise.resolve(null)
115
116
  }
116
117
 
@@ -119,12 +120,12 @@ class DdRum(reactContext: ReactApplicationContext) : ReactContextBaseJavaModule(
119
120
  * @param message The error message.
120
121
  * @param source The error source (network, source, console, logger, …).
121
122
  * @param stacktrace The error stacktrace.
122
- * @param timestampMs The timestamp when the error occurred (in milliseconds).
123
123
  * @param context The additional context to send.
124
+ * @param timestampMs The timestamp when the error occurred (in milliseconds). If not provided, current timestamp will be used.
124
125
  */
125
126
  @ReactMethod
126
- fun addError(message: String, source: String, stacktrace: String, timestampMs: Double, context: ReadableMap, promise: Promise) {
127
- nativeInstance.addError(message, source, stacktrace, timestampMs.toLong(), context.toHashMap())
127
+ fun addError(message: String, source: String, stacktrace: String, context: ReadableMap, timestampMs: Double, promise: Promise) {
128
+ nativeInstance.addError(message, source, stacktrace, context.toHashMap(), timestampMs.toLong())
128
129
  promise.resolve(null)
129
130
  }
130
131
 
@@ -27,24 +27,24 @@ class DdTrace(reactContext: ReactApplicationContext) : ReactContextBaseJavaModul
27
27
  /**
28
28
  * Start a span, and returns a unique identifier for the span.
29
29
  * @param operation The operation name of the span.
30
- * @param timestampMs The timestamp when the operation started (in milliseconds).
31
30
  * @param context The additional context to send.
31
+ * @param timestampMs The timestamp when the operation started (in milliseconds). If not provided, current timestamp will be used.
32
32
  */
33
33
  @ReactMethod
34
- fun startSpan(operation: String, timestampMs: Double, context: ReadableMap, promise: Promise) {
35
- val result = nativeInstance.startSpan(operation, timestampMs.toLong(), context.toHashMap())
34
+ fun startSpan(operation: String, context: ReadableMap, timestampMs: Double, promise: Promise) {
35
+ val result = nativeInstance.startSpan(operation, context.toHashMap(), timestampMs.toLong())
36
36
  promise.resolve(result)
37
37
  }
38
38
 
39
39
  /**
40
40
  * Finish a started span.
41
41
  * @param spanId The unique identifier of the span.
42
- * @param timestampMs The timestamp when the operation stopped (in milliseconds).
43
42
  * @param context The additional context to send.
43
+ * @param timestampMs The timestamp when the operation stopped (in milliseconds). If not provided, current timestamp will be used.
44
44
  */
45
45
  @ReactMethod
46
- fun finishSpan(spanId: String, timestampMs: Double, context: ReadableMap, promise: Promise) {
47
- nativeInstance.finishSpan(spanId, timestampMs.toLong(), context.toHashMap())
46
+ fun finishSpan(spanId: String, context: ReadableMap, timestampMs: Double, promise: Promise) {
47
+ nativeInstance.finishSpan(spanId, context.toHashMap(), timestampMs.toLong())
48
48
  promise.resolve(null)
49
49
  }
50
50
 
@@ -10,57 +10,58 @@
10
10
 
11
11
  RCT_EXTERN_METHOD(startView:(NSString)key
12
12
  withName:(NSString)name
13
- withTimestampms:(NSInteger)timestampMs
14
13
  withContext:(NSDictionary)context
14
+ withTimestampms:(NSInteger)timestampMs
15
15
  withResolver:(RCTPromiseResolveBlock)resolve
16
16
  withRejecter:(RCTPromiseRejectBlock)reject)
17
17
 
18
18
  RCT_EXTERN_METHOD(stopView:(NSString)key
19
- withTimestampms:(NSInteger)timestampMs
20
19
  withContext:(NSDictionary)context
20
+ withTimestampms:(NSInteger)timestampMs
21
21
  withResolver:(RCTPromiseResolveBlock)resolve
22
22
  withRejecter:(RCTPromiseRejectBlock)reject)
23
23
 
24
24
  RCT_EXTERN_METHOD(startAction:(NSString)type
25
25
  withName:(NSString)name
26
- withTimestampms:(NSInteger)timestampMs
27
26
  withContext:(NSDictionary)context
27
+ withTimestampms:(NSInteger)timestampMs
28
28
  withResolver:(RCTPromiseResolveBlock)resolve
29
29
  withRejecter:(RCTPromiseRejectBlock)reject)
30
30
 
31
- RCT_EXTERN_METHOD(stopAction:(NSInteger)timestampMs
32
- withContext:(NSDictionary)context
31
+ RCT_EXTERN_METHOD(stopAction:(NSDictionary)context
32
+ withTimestampms:(NSInteger)timestampMs
33
33
  withResolver:(RCTPromiseResolveBlock)resolve
34
34
  withRejecter:(RCTPromiseRejectBlock)reject)
35
35
 
36
36
  RCT_EXTERN_METHOD(addAction:(NSString)type
37
37
  withName:(NSString)name
38
- withTimestampms:(NSInteger)timestampMs
39
38
  withContext:(NSDictionary)context
39
+ withTimestampms:(NSInteger)timestampMs
40
40
  withResolver:(RCTPromiseResolveBlock)resolve
41
41
  withRejecter:(RCTPromiseRejectBlock)reject)
42
42
 
43
43
  RCT_EXTERN_METHOD(startResource:(NSString)key
44
44
  withMethod:(NSString)method
45
45
  withUrl:(NSString)url
46
- withTimestampms:(NSInteger)timestampMs
47
46
  withContext:(NSDictionary)context
47
+ withTimestampms:(NSInteger)timestampMs
48
48
  withResolver:(RCTPromiseResolveBlock)resolve
49
49
  withRejecter:(RCTPromiseRejectBlock)reject)
50
50
 
51
51
  RCT_EXTERN_METHOD(stopResource:(NSString)key
52
52
  withStatuscode:(NSInteger)statusCode
53
53
  withKind:(NSString)kind
54
- withTimestampms:(NSInteger)timestampMs
54
+ withSize:(NSInteger)size
55
55
  withContext:(NSDictionary)context
56
+ withTimestampms:(NSInteger)timestampMs
56
57
  withResolver:(RCTPromiseResolveBlock)resolve
57
58
  withRejecter:(RCTPromiseRejectBlock)reject)
58
59
 
59
60
  RCT_EXTERN_METHOD(addError:(NSString)message
60
61
  withSource:(NSString)source
61
62
  withStacktrace:(NSString)stacktrace
62
- withTimestampms:(NSInteger)timestampMs
63
63
  withContext:(NSDictionary)context
64
+ withTimestampms:(NSInteger)timestampMs
64
65
  withResolver:(RCTPromiseResolveBlock)resolve
65
66
  withRejecter:(RCTPromiseRejectBlock)reject)
66
67
 
@@ -20,51 +20,51 @@ class RNDdRum: NSObject {
20
20
  @objc(methodQueue)
21
21
  let methodQueue: DispatchQueue = sharedQueue
22
22
 
23
- @objc(startView:withName:withTimestampms:withContext:withResolver:withRejecter:)
24
- func startView(key: NSString, name: NSString, timestampMs: Int64, context: NSDictionary, resolve:RCTPromiseResolveBlock, reject:RCTPromiseRejectBlock) -> Void {
25
- nativeInstance.startView(key: key, name: name, timestampMs: timestampMs, context: context)
23
+ @objc(startView:withName:withContext:withTimestampms:withResolver:withRejecter:)
24
+ func startView(key: NSString, name: NSString, context: NSDictionary, timestampMs: Int64, resolve:RCTPromiseResolveBlock, reject:RCTPromiseRejectBlock) -> Void {
25
+ nativeInstance.startView(key: key, name: name, context: context, timestampMs: timestampMs)
26
26
  resolve(nil)
27
27
  }
28
28
 
29
- @objc(stopView:withTimestampms:withContext:withResolver:withRejecter:)
30
- func stopView(key: NSString, timestampMs: Int64, context: NSDictionary, resolve:RCTPromiseResolveBlock, reject:RCTPromiseRejectBlock) -> Void {
31
- nativeInstance.stopView(key: key, timestampMs: timestampMs, context: context)
29
+ @objc(stopView:withContext:withTimestampms:withResolver:withRejecter:)
30
+ func stopView(key: NSString, context: NSDictionary, timestampMs: Int64, resolve:RCTPromiseResolveBlock, reject:RCTPromiseRejectBlock) -> Void {
31
+ nativeInstance.stopView(key: key, context: context, timestampMs: timestampMs)
32
32
  resolve(nil)
33
33
  }
34
34
 
35
- @objc(startAction:withName:withTimestampms:withContext:withResolver:withRejecter:)
36
- func startAction(type: NSString, name: NSString, timestampMs: Int64, context: NSDictionary, resolve:RCTPromiseResolveBlock, reject:RCTPromiseRejectBlock) -> Void {
37
- nativeInstance.startAction(type: type, name: name, timestampMs: timestampMs, context: context)
35
+ @objc(startAction:withName:withContext:withTimestampms:withResolver:withRejecter:)
36
+ func startAction(type: NSString, name: NSString, context: NSDictionary, timestampMs: Int64, resolve:RCTPromiseResolveBlock, reject:RCTPromiseRejectBlock) -> Void {
37
+ nativeInstance.startAction(type: type, name: name, context: context, timestampMs: timestampMs)
38
38
  resolve(nil)
39
39
  }
40
40
 
41
- @objc(stopAction:withContext:withResolver:withRejecter:)
42
- func stopAction(timestampMs: Int64, context: NSDictionary, resolve:RCTPromiseResolveBlock, reject:RCTPromiseRejectBlock) -> Void {
43
- nativeInstance.stopAction(timestampMs: timestampMs, context: context)
41
+ @objc(stopAction:withTimestampms:withResolver:withRejecter:)
42
+ func stopAction(context: NSDictionary, timestampMs: Int64, resolve:RCTPromiseResolveBlock, reject:RCTPromiseRejectBlock) -> Void {
43
+ nativeInstance.stopAction(context: context, timestampMs: timestampMs)
44
44
  resolve(nil)
45
45
  }
46
46
 
47
- @objc(addAction:withName:withTimestampms:withContext:withResolver:withRejecter:)
48
- func addAction(type: NSString, name: NSString, timestampMs: Int64, context: NSDictionary, resolve:RCTPromiseResolveBlock, reject:RCTPromiseRejectBlock) -> Void {
49
- nativeInstance.addAction(type: type, name: name, timestampMs: timestampMs, context: context)
47
+ @objc(addAction:withName:withContext:withTimestampms:withResolver:withRejecter:)
48
+ func addAction(type: NSString, name: NSString, context: NSDictionary, timestampMs: Int64, resolve:RCTPromiseResolveBlock, reject:RCTPromiseRejectBlock) -> Void {
49
+ nativeInstance.addAction(type: type, name: name, context: context, timestampMs: timestampMs)
50
50
  resolve(nil)
51
51
  }
52
52
 
53
- @objc(startResource:withMethod:withUrl:withTimestampms:withContext:withResolver:withRejecter:)
54
- func startResource(key: NSString, method: NSString, url: NSString, timestampMs: Int64, context: NSDictionary, resolve:RCTPromiseResolveBlock, reject:RCTPromiseRejectBlock) -> Void {
55
- nativeInstance.startResource(key: key, method: method, url: url, timestampMs: timestampMs, context: context)
53
+ @objc(startResource:withMethod:withUrl:withContext:withTimestampms:withResolver:withRejecter:)
54
+ func startResource(key: NSString, method: NSString, url: NSString, context: NSDictionary, timestampMs: Int64, resolve:RCTPromiseResolveBlock, reject:RCTPromiseRejectBlock) -> Void {
55
+ nativeInstance.startResource(key: key, method: method, url: url, context: context, timestampMs: timestampMs)
56
56
  resolve(nil)
57
57
  }
58
58
 
59
- @objc(stopResource:withStatuscode:withKind:withTimestampms:withContext:withResolver:withRejecter:)
60
- func stopResource(key: NSString, statusCode: Int64, kind: NSString, timestampMs: Int64, context: NSDictionary, resolve:RCTPromiseResolveBlock, reject:RCTPromiseRejectBlock) -> Void {
61
- nativeInstance.stopResource(key: key, statusCode: statusCode, kind: kind, timestampMs: timestampMs, context: context)
59
+ @objc(stopResource:withStatuscode:withKind:withSize:withContext:withTimestampms:withResolver:withRejecter:)
60
+ func stopResource(key: NSString, statusCode: Int64, kind: NSString, size: Int64, context: NSDictionary, timestampMs: Int64, resolve:RCTPromiseResolveBlock, reject:RCTPromiseRejectBlock) -> Void {
61
+ nativeInstance.stopResource(key: key, statusCode: statusCode, kind: kind, size: size, context: context, timestampMs: timestampMs)
62
62
  resolve(nil)
63
63
  }
64
64
 
65
- @objc(addError:withSource:withStacktrace:withTimestampms:withContext:withResolver:withRejecter:)
66
- func addError(message: NSString, source: NSString, stacktrace: NSString, timestampMs: Int64, context: NSDictionary, resolve:RCTPromiseResolveBlock, reject:RCTPromiseRejectBlock) -> Void {
67
- nativeInstance.addError(message: message, source: source, stacktrace: stacktrace, timestampMs: timestampMs, context: context)
65
+ @objc(addError:withSource:withStacktrace:withContext:withTimestampms:withResolver:withRejecter:)
66
+ func addError(message: NSString, source: NSString, stacktrace: NSString, context: NSDictionary, timestampMs: Int64, resolve:RCTPromiseResolveBlock, reject:RCTPromiseRejectBlock) -> Void {
67
+ nativeInstance.addError(message: message, source: source, stacktrace: stacktrace, context: context, timestampMs: timestampMs)
68
68
  resolve(nil)
69
69
  }
70
70
 
@@ -9,14 +9,14 @@
9
9
  @interface RCT_EXTERN_MODULE(DdTrace, NSObject)
10
10
 
11
11
  RCT_EXTERN_METHOD(startSpan:(NSString)operation
12
- withTimestampms:(NSInteger)timestampMs
13
12
  withContext:(NSDictionary)context
13
+ withTimestampms:(NSInteger)timestampMs
14
14
  withResolver:(RCTPromiseResolveBlock)resolve
15
15
  withRejecter:(RCTPromiseRejectBlock)reject)
16
16
 
17
17
  RCT_EXTERN_METHOD(finishSpan:(NSString)spanId
18
- withTimestampms:(NSInteger)timestampMs
19
18
  withContext:(NSDictionary)context
19
+ withTimestampms:(NSInteger)timestampMs
20
20
  withResolver:(RCTPromiseResolveBlock)resolve
21
21
  withRejecter:(RCTPromiseRejectBlock)reject)
22
22
 
@@ -20,15 +20,15 @@ class RNDdTrace: NSObject {
20
20
  @objc(methodQueue)
21
21
  let methodQueue: DispatchQueue = sharedQueue
22
22
 
23
- @objc(startSpan:withTimestampms:withContext:withResolver:withRejecter:)
24
- func startSpan(operation: NSString, timestampMs: Int64, context: NSDictionary, resolve:RCTPromiseResolveBlock, reject:RCTPromiseRejectBlock) -> Void {
25
- let result = nativeInstance.startSpan(operation: operation, timestampMs: timestampMs, context: context)
23
+ @objc(startSpan:withContext:withTimestampms:withResolver:withRejecter:)
24
+ func startSpan(operation: NSString, context: NSDictionary, timestampMs: Int64, resolve:RCTPromiseResolveBlock, reject:RCTPromiseRejectBlock) -> Void {
25
+ let result = nativeInstance.startSpan(operation: operation, context: context, timestampMs: timestampMs)
26
26
  resolve(result)
27
27
  }
28
28
 
29
- @objc(finishSpan:withTimestampms:withContext:withResolver:withRejecter:)
30
- func finishSpan(spanId: NSString, timestampMs: Int64, context: NSDictionary, resolve:RCTPromiseResolveBlock, reject:RCTPromiseRejectBlock) -> Void {
31
- nativeInstance.finishSpan(spanId: spanId, timestampMs: timestampMs, context: context)
29
+ @objc(finishSpan:withContext:withTimestampms:withResolver:withRejecter:)
30
+ func finishSpan(spanId: NSString, context: NSDictionary, timestampMs: Int64, resolve:RCTPromiseResolveBlock, reject:RCTPromiseRejectBlock) -> Void {
31
+ nativeInstance.finishSpan(spanId: spanId, context: context, timestampMs: timestampMs)
32
32
  resolve(nil)
33
33
  }
34
34
 
@@ -17,6 +17,8 @@ var _DdRumResourceTracking = require("./rum/instrumentation/DdRumResourceTrackin
17
17
 
18
18
  var _ProxyConfiguration = require("./ProxyConfiguration");
19
19
 
20
+ var _version = require("./version");
21
+
20
22
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
21
23
 
22
24
  /**
@@ -38,6 +40,7 @@ class DdSdkReactNative {
38
40
  }
39
41
 
40
42
  configuration.additionalConfig[DdSdkReactNative.DD_SOURCE_KEY] = 'react-native';
43
+ configuration.additionalConfig[DdSdkReactNative.DD_SDK_VERSION] = _version.version;
41
44
  configuration.additionalConfig[DdSdkReactNative.DD_NATIVE_VIEW_TRACKING_KEY] = configuration.nativeViewTracking;
42
45
 
43
46
  if (configuration.verbosity != undefined) {
@@ -129,6 +132,8 @@ exports.DdSdkReactNative = DdSdkReactNative;
129
132
 
130
133
  _defineProperty(DdSdkReactNative, "DD_SOURCE_KEY", "_dd.source");
131
134
 
135
+ _defineProperty(DdSdkReactNative, "DD_SDK_VERSION", "_dd.sdk_version");
136
+
132
137
  _defineProperty(DdSdkReactNative, "DD_SERVICE_NAME", "_dd.service_name");
133
138
 
134
139
  _defineProperty(DdSdkReactNative, "DD_SDK_VERBOSITY_KEY", "_dd.sdk_verbosity");
@@ -1 +1 @@
1
- {"version":3,"sources":["DdSdkReactNative.tsx"],"names":["DdSdkReactNative","initialize","configuration","Promise","resolve","reject","wasInitialized","additionalConfig","DD_SOURCE_KEY","DD_NATIVE_VIEW_TRACKING_KEY","nativeViewTracking","verbosity","undefined","DD_SDK_VERBOSITY_KEY","proxyConfig","DD_PROXY_TYPE_KEY","type","DD_PROXY_ADDRESS_KEY","address","DD_PROXY_PORT_KEY","port","username","password","ProxyType","SOCKS","console","warn","DD_PROXY_USERNAME_KEY","DD_PROXY_PASSWORD_KEY","serviceName","DD_SERVICE_NAME","DD_NATIVE_LONG_TASK_THRESHOLD_KEY","NATIVE_LONG_TASK_THRESHOLD_MS","DdSdk","DdSdkConfiguration","clientToken","env","applicationId","nativeCrashReportEnabled","sampleRate","site","trackingConsent","then","enableFeatures","rejection","setAttributes","attributes","setUser","user","setTrackingConsent","consent","trackInteractions","DdRumUserInteractionTracking","startTracking","trackResources","DdRumResourceTracking","trackErrors","DdRumErrorTracking"],"mappings":";;;;;;;AAOA;;AACA;;AACA;;AACA;;AACA;;AAEA;;;;AAEA;AACA;AACA;AACO,MAAMA,gBAAN,CAAuB;AAO1B;;AAaA;AACJ;AACA;AACA;AACA;AACqB,SAAVC,UAAU,CAACC,aAAD,EAA8D;AAC3E,WAAO,IAAIC,OAAJ,CAAkB,CAACC,OAAD,EAAUC,MAAV,KAAqB;AAC1C,UAAIL,gBAAgB,CAACM,cAArB,EAAqC;AACjCF,QAAAA,OAAO;AACP;AACH;;AAEDF,MAAAA,aAAa,CAACK,gBAAd,CAA+BP,gBAAgB,CAACQ,aAAhD,IAAiE,cAAjE;AACAN,MAAAA,aAAa,CAACK,gBA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;;gBAF/BA,gB,qBAGiC,kB;;gBAHjCA,gB,0BAIsC,mB;;gBAJtCA,gB,iCAK6C,0B;;gBAL7CA,gB,uBAQmC,gB;;gBARnCA,gB,0BASsC,mB;;gBATtCA,gB,uBAUmC,gB;;gBAVnCA,gB,2BAWuC,oB;;gBAXvCA,gB,2BAYuC,oB;;gBAZvCA,gB,uCAcmD,yB;;gBAdnDA,gB,mCAe+C,G;;gBAf/CA,gB,oBAkBuB,K","sourcesContent":["/*\n * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.\n * This product includes software developed at Datadog (https://www.datadoghq.com/).\n * Copyright 2016-Present Datadog, Inc.\n */\n\nimport type { DdSdkReactNativeConfiguration } from \"./DdSdkReactNativeConfiguration\"\nimport { DdSdkConfiguration } from \"./types\"\nimport { DdSdk } from \"./foundation\"\nimport { DdRumUserInteractionTracking } from './rum/instrumentation/DdRumUserInteractionTracking'\nimport { DdRumErrorTracking } from './rum/instrumentation/DdRumErrorTracking'\nimport { DdRumResourceTracking } from './rum/instrumentation/DdRumResourceTracking'\nimport type { TrackingConsent } from \"./TrackingConsent\"\nimport { ProxyType } from \"./ProxyConfiguration\"\n\n/**\n * This class initializes the Datadog SDK, and sets up communication with the server.\n */\nexport class DdSdkReactNative {\n\n private static readonly DD_SOURCE_KEY = \"_dd.source\";\n private static readonly DD_SERVICE_NAME = \"_dd.service_name\";\n private static readonly DD_SDK_VERBOSITY_KEY = \"_dd.sdk_verbosity\";\n private static readonly DD_NATIVE_VIEW_TRACKING_KEY = \"_dd.native_view_tracking\";\n\n // Proxy\n private static readonly DD_PROXY_TYPE_KEY = \"_dd.proxy.type\";\n private static readonly DD_PROXY_ADDRESS_KEY = \"_dd.proxy.address\";\n private static readonly DD_PROXY_PORT_KEY = \"_dd.proxy.port\";\n private static readonly DD_PROXY_USERNAME_KEY = \"_dd.proxy.username\";\n private static readonly DD_PROXY_PASSWORD_KEY = \"_dd.proxy.password\";\n\n private static readonly DD_NATIVE_LONG_TASK_THRESHOLD_KEY = \"_dd.long_task.threshold\"\n private static readonly NATIVE_LONG_TASK_THRESHOLD_MS = 200\n\n\n private static wasInitialized = false\n\n /**\n * Initializes the Datadog SDK.\n * @param configuration the configuration for the SDK library\n * @returns a Promise.\n */\n static initialize(configuration: DdSdkReactNativeConfiguration): Promise<void> {\n return new Promise<void>((resolve, reject) => {\n if (DdSdkReactNative.wasInitialized) {\n resolve()\n return\n }\n\n configuration.additionalConfig[DdSdkReactNative.DD_SOURCE_KEY] = 'react-native';\n configuration.additionalConfig[DdSdkReactNative.DD_NATIVE_VIEW_TRACKING_KEY] = configuration.nativeViewTracking;\n if (configuration.verbosity != undefined) {\n configuration.additionalConfig[DdSdkReactNative.DD_SDK_VERBOSITY_KEY] = configuration.verbosity;\n }\n\n if (configuration.proxyConfig) {\n const additionalConfig = configuration.additionalConfig;\n const proxyConfig = configuration.proxyConfig;\n\n additionalConfig[DdSdkReactNative.DD_PROXY_TYPE_KEY] = proxyConfig.type;\n additionalConfig[DdSdkReactNative.DD_PROXY_ADDRESS_KEY] = proxyConfig.address;\n additionalConfig[DdSdkReactNative.DD_PROXY_PORT_KEY] = proxyConfig.port;\n if (proxyConfig.username && proxyConfig.password) {\n if (proxyConfig.type == ProxyType.SOCKS) {\n console.warn(\"SOCKS proxy configuration doesn't support Basic authentication.\")\n } else {\n additionalConfig[DdSdkReactNative.DD_PROXY_USERNAME_KEY] = proxyConfig.username;\n additionalConfig[DdSdkReactNative.DD_PROXY_PASSWORD_KEY] = proxyConfig.password;\n }\n }\n }\n\n if (configuration.serviceName) {\n configuration.additionalConfig[DdSdkReactNative.DD_SERVICE_NAME] = configuration.serviceName;\n }\n\n configuration.additionalConfig[DdSdkReactNative.DD_NATIVE_LONG_TASK_THRESHOLD_KEY]\n = DdSdkReactNative.NATIVE_LONG_TASK_THRESHOLD_MS\n\n DdSdk.initialize(\n new DdSdkConfiguration(\n configuration.clientToken,\n configuration.env,\n configuration.applicationId,\n configuration.nativeCrashReportEnabled,\n configuration.sampleRate,\n configuration.site,\n configuration.trackingConsent,\n configuration.additionalConfig\n )\n ).then(() => {\n DdSdkReactNative.enableFeatures(configuration)\n DdSdkReactNative.wasInitialized = true\n resolve()\n }, (rejection) => {\n reject(rejection)\n })\n })\n }\n\n /**\n * Sets the global context (set of attributes) attached with all future Logs, Spans and RUM events.\n * @param attributes: The global context attributes.\n * @returns a Promise.\n */\n // eslint-disable-next-line @typescript-eslint/ban-types\n static setAttributes(attributes: object): Promise<void> {\n return DdSdk.setAttributes(attributes)\n }\n\n /**\n * Set the user information.\n * @param user: The user object (use builtin attributes: 'id', 'email', 'name', and/or any custom attribute).\n * @returns a Promise.\n */\n // eslint-disable-next-line @typescript-eslint/ban-types\n static setUser(user: object): Promise<void> {\n return DdSdk.setUser(user)\n }\n\n /**\n * Set the tracking consent regarding the data collection.\n * @param trackingConsent: One of TrackingConsent values.\n * @returns a Promise.\n */\n static setTrackingConsent(consent: TrackingConsent): Promise<void> {\n return DdSdk.setTrackingConsent(consent)\n }\n\n private static enableFeatures(configuration: DdSdkReactNativeConfiguration) {\n if (configuration.trackInteractions) {\n DdRumUserInteractionTracking.startTracking();\n }\n\n if (configuration.trackResources) {\n DdRumResourceTracking.startTracking();\n }\n\n if (configuration.trackErrors) {\n DdRumErrorTracking.startTracking();\n }\n }\n}"]}
1
+ {"version":3,"sources":["DdSdkReactNative.tsx"],"names":["DdSdkReactNative","initialize","configuration","Promise","resolve","reject","wasInitialized","additionalConfig","DD_SOURCE_KEY","DD_SDK_VERSION","sdkVersion","DD_NATIVE_VIEW_TRACKING_KEY","nativeViewTracking","verbosity","undefined","DD_SDK_VERBOSITY_KEY","proxyConfig","DD_PROXY_TYPE_KEY","type","DD_PROXY_ADDRESS_KEY","address","DD_PROXY_PORT_KEY","port","username","password","ProxyType","SOCKS","console","warn","DD_PROXY_USERNAME_KEY","DD_PROXY_PASSWORD_KEY","serviceName","DD_SERVICE_NAME","DD_NATIVE_LONG_TASK_THRESHOLD_KEY","NATIVE_LONG_TASK_THRESHOLD_MS","DdSdk","DdSdkConfiguration","clientToken","env","applicationId","nativeCrashReportEnabled","sampleRate","site","trackingConsent","then","enableFeatures","rejection","setAttributes","attributes","setUser","user","setTrackingConsent","consent","trackInteractions","DdRumUserInteractionTracking","startTracking","trackResources","DdRumResourceTracking","trackErrors","DdRumErrorTracking"],"mappings":";;;;;;;AAOA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AAEA;;;;AAEA;AACA;AACA;AACO,MAAMA,gBAAN,CAAuB;AAQ1B;;AAaA;AACJ;AACA;AACA;AACA;AACqB,SAAVC,UAAU,CAACC,aAAD,EAA8D;AAC3E,WAAO,IAAIC,OAAJ,CAAkB,CAACC,OAAD,EAAUC,MAAV,KAAqB;AAC1C,UAAIL,gBAAgB,CAACM,cAArB,EAAqC;AACjCF,QAAAA,OAAO;AACP;AACH;;AAEDF,MAAAA,aAAa,CAACK,gBAAd,CAA+BP,gBAAgB,CAACQ,aAAhD,IAAiE,cAAjE;AACAN,MAAAA,aAAa,CAACK,gBAAd,CAA+BP,gBAAgB,CAACS,cAAhD,IAAkEC,gBAAlE;AACAR,MAAAA,aAAa,CAACK,gBAAd,CAA+BP,gBAAgB,CAACW,2BAAhD,IAA+ET,aAAa,CAACU,kBAA7F;;AACA,UAAIV,aAAa,CAACW,SAAd,IAA2BC,SAA/B,EAA0C;AACtCZ,QAAAA,aAAa,CAACK,gBAAd,CAA+BP,gBAAgB,CAACe,oBAAhD,IAAwEb,aAAa,CAACW,SAAtF;AACH;;AAED,UAAIX,aAAa,CAACc,WAAlB,EAA+B;AAC3B,cAAMT,gBAAgB,GAAGL,aAAa,CAACK,gBAAvC;AACA,cAAMS,WAAW,GAAGd,aAAa,CAACc,WAAlC;AAEAT,QAAAA,gBAAgB,CAACP,gBAAgB,CAACiB,iBAAlB,CAAhB,GAAuDD,WAAW,CAACE,IAAnE;AACAX,QAAAA,gBAAgB,CAACP,gBAAgB,CAACmB,oBAAlB,CAAhB,GAA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AAD,CAAN;AACH,OAjBD;AAkBH,KAvDM,CAAP;AAwDH;AAED;AACJ;AACA;AACA;AACA;AACI;;;AACoB,SAAbC,aAAa,CAACC,UAAD,EAAoC;AACpD,WAAOb,kBAAMY,aAAN,CAAoBC,UAApB,CAAP;AACH;AAED;AACJ;AACA;AACA;AACA;AACI;;;AACc,SAAPC,OAAO,CAACC,IAAD,EAA8B;AACxC,WAAOf,kBAAMc,OAAN,CAAcC,IAAd,CAAP;AACH;AAED;AACJ;AACA;AACA;AACA;;;AAC6B,SAAlBC,kBAAkB,CAACC,OAAD,EAA0C;AAC/D,WAAOjB,kBAAMgB,kBAAN,CAAyBC,OAAzB,CAAP;AACH;;AAE4B,SAAdP,cAAc,CAAC3C,aAAD,EAA+C;AACxE,QAAIA,aAAa,CAACmD,iBAAlB,EAAqC;AACjCC,iEAA6BC,aAA7B;AACH;;AAED,QAAIrD,aAAa,CAACsD,cAAlB,EAAkC;AAC9BC,mDAAsBF,aAAtB;AACH;;AAED,QAAIrD,aAAa,CAACwD,WAAlB,EAA+B;AAC3BC,6CAAmBJ,aAAnB;AACH;AACJ;;AA9HyB;;;;gBAAjBvD,gB,mBAE+B,Y;;gBAF/BA,gB,oBAGgC,iB;;gBAHhCA,gB,qBAIiC,kB;;gBAJjCA,gB,0BAKsC,mB;;gBALtCA,gB,iCAM6C,0B;;gBAN7CA,gB,uBASmC,gB;;gBATnCA,gB,0BAUsC,mB;;gBAVtCA,gB,uBAWmC,gB;;gBAXnCA,gB,2BAYuC,oB;;gBAZvCA,gB,2BAauC,oB;;gBAbvCA,gB,uCAemD,yB;;gBAfnDA,gB,mCAgB+C,G;;gBAhB/CA,gB,oBAmBuB,K","sourcesContent":["/*\n * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.\n * This product includes software developed at Datadog (https://www.datadoghq.com/).\n * Copyright 2016-Present Datadog, Inc.\n */\n\nimport type { DdSdkReactNativeConfiguration } from \"./DdSdkReactNativeConfiguration\"\nimport { DdSdkConfiguration } from \"./types\"\nimport { DdSdk } from \"./foundation\"\nimport { DdRumUserInteractionTracking } from './rum/instrumentation/DdRumUserInteractionTracking'\nimport { DdRumErrorTracking } from './rum/instrumentation/DdRumErrorTracking'\nimport { DdRumResourceTracking } from './rum/instrumentation/DdRumResourceTracking'\nimport type { TrackingConsent } from \"./TrackingConsent\"\nimport { ProxyType } from \"./ProxyConfiguration\"\n\nimport {version as sdkVersion } from './version';\n\n/**\n * This class initializes the Datadog SDK, and sets up communication with the server.\n */\nexport class DdSdkReactNative {\n\n private static readonly DD_SOURCE_KEY = \"_dd.source\";\n private static readonly DD_SDK_VERSION = \"_dd.sdk_version\";\n private static readonly DD_SERVICE_NAME = \"_dd.service_name\";\n private static readonly DD_SDK_VERBOSITY_KEY = \"_dd.sdk_verbosity\";\n private static readonly DD_NATIVE_VIEW_TRACKING_KEY = \"_dd.native_view_tracking\";\n\n // Proxy\n private static readonly DD_PROXY_TYPE_KEY = \"_dd.proxy.type\";\n private static readonly DD_PROXY_ADDRESS_KEY = \"_dd.proxy.address\";\n private static readonly DD_PROXY_PORT_KEY = \"_dd.proxy.port\";\n private static readonly DD_PROXY_USERNAME_KEY = \"_dd.proxy.username\";\n private static readonly DD_PROXY_PASSWORD_KEY = \"_dd.proxy.password\";\n\n private static readonly DD_NATIVE_LONG_TASK_THRESHOLD_KEY = \"_dd.long_task.threshold\"\n private static readonly NATIVE_LONG_TASK_THRESHOLD_MS = 200\n\n\n private static wasInitialized = false\n\n /**\n * Initializes the Datadog SDK.\n * @param configuration the configuration for the SDK library\n * @returns a Promise.\n */\n static initialize(configuration: DdSdkReactNativeConfiguration): Promise<void> {\n return new Promise<void>((resolve, reject) => {\n if (DdSdkReactNative.wasInitialized) {\n resolve()\n return\n }\n\n configuration.additionalConfig[DdSdkReactNative.DD_SOURCE_KEY] = 'react-native';\n configuration.additionalConfig[DdSdkReactNative.DD_SDK_VERSION] = sdkVersion;\n configuration.additionalConfig[DdSdkReactNative.DD_NATIVE_VIEW_TRACKING_KEY] = configuration.nativeViewTracking;\n if (configuration.verbosity != undefined) {\n configuration.additionalConfig[DdSdkReactNative.DD_SDK_VERBOSITY_KEY] = configuration.verbosity;\n }\n\n if (configuration.proxyConfig) {\n const additionalConfig = configuration.additionalConfig;\n const proxyConfig = configuration.proxyConfig;\n\n additionalConfig[DdSdkReactNative.DD_PROXY_TYPE_KEY] = proxyConfig.type;\n additionalConfig[DdSdkReactNative.DD_PROXY_ADDRESS_KEY] = proxyConfig.address;\n additionalConfig[DdSdkReactNative.DD_PROXY_PORT_KEY] = proxyConfig.port;\n if (proxyConfig.username && proxyConfig.password) {\n if (proxyConfig.type == ProxyType.SOCKS) {\n console.warn(\"SOCKS proxy configuration doesn't support Basic authentication.\")\n } else {\n additionalConfig[DdSdkReactNative.DD_PROXY_USERNAME_KEY] = proxyConfig.username;\n additionalConfig[DdSdkReactNative.DD_PROXY_PASSWORD_KEY] = proxyConfig.password;\n }\n }\n }\n\n if (configuration.serviceName) {\n configuration.additionalConfig[DdSdkReactNative.DD_SERVICE_NAME] = configuration.serviceName;\n }\n\n configuration.additionalConfig[DdSdkReactNative.DD_NATIVE_LONG_TASK_THRESHOLD_KEY]\n = DdSdkReactNative.NATIVE_LONG_TASK_THRESHOLD_MS\n\n DdSdk.initialize(\n new DdSdkConfiguration(\n configuration.clientToken,\n configuration.env,\n configuration.applicationId,\n configuration.nativeCrashReportEnabled,\n configuration.sampleRate,\n configuration.site,\n configuration.trackingConsent,\n configuration.additionalConfig\n )\n ).then(() => {\n DdSdkReactNative.enableFeatures(configuration)\n DdSdkReactNative.wasInitialized = true\n resolve()\n }, (rejection) => {\n reject(rejection)\n })\n })\n }\n\n /**\n * Sets the global context (set of attributes) attached with all future Logs, Spans and RUM events.\n * @param attributes: The global context attributes.\n * @returns a Promise.\n */\n // eslint-disable-next-line @typescript-eslint/ban-types\n static setAttributes(attributes: object): Promise<void> {\n return DdSdk.setAttributes(attributes)\n }\n\n /**\n * Set the user information.\n * @param user: The user object (use builtin attributes: 'id', 'email', 'name', and/or any custom attribute).\n * @returns a Promise.\n */\n // eslint-disable-next-line @typescript-eslint/ban-types\n static setUser(user: object): Promise<void> {\n return DdSdk.setUser(user)\n }\n\n /**\n * Set the tracking consent regarding the data collection.\n * @param trackingConsent: One of TrackingConsent values.\n * @returns a Promise.\n */\n static setTrackingConsent(consent: TrackingConsent): Promise<void> {\n return DdSdk.setTrackingConsent(consent)\n }\n\n private static enableFeatures(configuration: DdSdkReactNativeConfiguration) {\n if (configuration.trackInteractions) {\n DdRumUserInteractionTracking.startTracking();\n }\n\n if (configuration.trackResources) {\n DdRumResourceTracking.startTracking();\n }\n\n if (configuration.trackErrors) {\n DdRumErrorTracking.startTracking();\n }\n }\n}"]}
@@ -46,15 +46,11 @@ class DdTraceWrapper {
46
46
  }
47
47
 
48
48
  startSpan(operation, context = {}, timestampMs = Date.now()) {
49
- // TODO swap context and stacktrace in the native call, requires native bridges update
50
- // @ts-ignore
51
- return this.nativeTrace.startSpan(operation, timestampMs, context);
49
+ return this.nativeTrace.startSpan(operation, context, timestampMs);
52
50
  }
53
51
 
54
52
  finishSpan(spanId, context = {}, timestampMs = Date.now()) {
55
- // TODO swap context and stacktrace in the native call, requires native bridges update
56
- // @ts-ignore
57
- return this.nativeTrace.finishSpan(spanId, timestampMs, context);
53
+ return this.nativeTrace.finishSpan(spanId, context, timestampMs);
58
54
  }
59
55
 
60
56
  }
@@ -65,51 +61,37 @@ class DdRumWrapper {
65
61
  }
66
62
 
67
63
  startView(key, name, context = {}, timestampMs = Date.now()) {
68
- // TODO swap context and stacktrace in the native call, requires native bridges update
69
- // @ts-ignore
70
- return this.nativeRum.startView(key, name, timestampMs, context);
64
+ return this.nativeRum.startView(key, name, context, timestampMs);
71
65
  }
72
66
 
73
67
  stopView(key, context = {}, timestampMs = Date.now()) {
74
- // TODO swap context and stacktrace in the native call, requires native bridges update
75
- // @ts-ignore
76
- return this.nativeRum.stopView(key, timestampMs, context);
68
+ return this.nativeRum.stopView(key, context, timestampMs);
77
69
  }
78
70
 
79
71
  startAction(type, name, context = {}, timestampMs = Date.now()) {
80
- // TODO swap context and stacktrace in the native call, requires native bridges update
81
- // @ts-ignore
82
- return this.nativeRum.startAction(type, name, timestampMs, context);
72
+ return this.nativeRum.startAction(type, name, context, timestampMs);
83
73
  }
84
74
 
85
75
  stopAction(context = {}, timestampMs = Date.now()) {
86
- // TODO swap context and stacktrace in the native call, requires native bridges update
87
- // @ts-ignore
88
- return this.nativeRum.stopAction(timestampMs, context);
76
+ return this.nativeRum.stopAction(context, timestampMs);
89
77
  }
90
78
 
91
79
  addAction(type, name, context = {}, timestampMs = Date.now()) {
92
- // TODO swap context and stacktrace in the native call, requires native bridges update
93
- // @ts-ignore
94
- return this.nativeRum.addAction(type, name, timestampMs, context);
80
+ return this.nativeRum.addAction(type, name, context, timestampMs);
95
81
  }
96
82
 
97
83
  startResource(key, method, url, context = {}, timestampMs = Date.now()) {
98
- // TODO swap context and stacktrace in the native call, requires native bridges update
99
- // @ts-ignore
100
- return this.nativeRum.startResource(key, method, url, timestampMs, context);
84
+ return this.nativeRum.startResource(key, method, url, context, timestampMs);
101
85
  }
102
86
 
103
- stopResource(key, statusCode, kind, context = {}, timestampMs = Date.now()) {
104
- // TODO swap context and stacktrace in the native call, requires native bridges update
105
- // @ts-ignore
106
- return this.nativeRum.stopResource(key, statusCode, kind, timestampMs, context);
87
+ stopResource(key, statusCode, kind, size = -1, context = {}, timestampMs = Date.now()) {
88
+ return this.nativeRum.stopResource(key, statusCode, kind, size, context, timestampMs);
107
89
  }
108
90
 
109
91
  addError(message, source, stacktrace, context = {}, timestampMs = Date.now()) {
110
- // TODO swap context and stacktrace in the native call, requires native bridges update
111
- // @ts-ignore
112
- return this.nativeRum.addError(message, source, stacktrace, timestampMs, context);
92
+ let updatedContext = context;
93
+ updatedContext["_dd.error.source_type"] = "react-native";
94
+ return this.nativeRum.addError(message, source, stacktrace, updatedContext, timestampMs);
113
95
  }
114
96
 
115
97
  addTiming(name) {
@@ -1 +1 @@
1
- {"version":3,"sources":["foundation.tsx"],"names":["DdLogsWrapper","NativeModules","DdLogs","debug","message","context","nativeLogs","info","warn","error","DdTraceWrapper","DdTrace","startSpan","operation","timestampMs","Date","now","nativeTrace","finishSpan","spanId","DdRumWrapper","DdRum","startView","key","name","nativeRum","stopView","startAction","type","stopAction","addAction","startResource","method","url","stopResource","statusCode","kind","addError","source","stacktrace","addTiming","DdSdk"],"mappings":";;;;;;;;;;;;;AAMA;;AACA;;;;AAEA,MAAMA,aAAN,CAA0C;AAAA;AAAA,wCAELC,2BAAcC,MAFT;AAAA;;AAItCC,EAAAA,KAAK,CAACC,OAAD,EAAkBC,OAAe,GAAG,EAApC,EAAuD;AACxD,WAAO,KAAKC,UAAL,CAAgBH,KAAhB,CAAsBC,OAAtB,EAA+BC,OAA/B,CAAP;AACH;;AACDE,EAAAA,IAAI,CAACH,OAAD,EAAkBC,OAAe,GAAG,EAApC,EAAuD;AACvD,WAAO,KAAKC,UAAL,CAAgBC,IAAhB,CAAqBH,OAArB,EAA8BC,OAA9B,CAAP;AACH;;AACDG,EAAAA,IAAI,CAACJ,OAAD,EAAkBC,OAAe,GAAG,EAApC,EAAuD;AACvD,WAAO,KAAKC,UAAL,CAAgBE,IAAhB,CAAqBJ,OAArB,EAA8BC,OAA9B,CAAP;AACH;;AACDI,EAAAA,KAAK,CAACL,OAAD,EAAkBC,OAAe,GAAG,EAApC,EAAuD;AACxD,WAAO,KAAKC,UAAL,CAAgBG,KAAhB,CAAsBL,OAAtB,EAA+BC,OAA/B,CAAP;AACH;;AAfqC;;AAmB1C,MAAMK,cAAN,CAA4C;AAAA;AAAA,yCAELT,2BAAcU,OAFT;AAAA;;AAIxCC,EAAAA,SAAS,CAACC,SAAD,EAAoBR,OAAe,GAAG,EAAtC,EAA0CS,WAAmB,GAAGC,IAAI,CAACC,GAAL,EAAhE,EAA6F;AAClG;AACA;AACA,WAAO,KAAKC,WAAL,CAAiBL,SAAjB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,SAAL,CAAee,SAAf,CAAyBhB,IAAzB,CAAP;AACH;;AA9CmC;;AAkDxC,MAAMiB,KAAgB,GAAGxC,2BAAcwC,KAAvC;;AACA,MAAMvC,MAAkB,GAAG,IAAIF,aAAJ,EAA3B;;AACA,MAAMW,OAAoB,GAAG,IAAID,cAAJ,EAA7B;;AACA,MAAMW,KAAgB,GAAG,IAAID,YAAJ,EAAzB","sourcesContent":["/*\n * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.\n * This product includes software developed at Datadog (https://www.datadoghq.com/).\n * Copyright 2016-Present Datadog, Inc.\n */\n\nimport { NativeModules } from 'react-native';\nimport { DdSdkConfiguration, DdSdkType, DdLogsType, DdTraceType, DdRumType } from './types';\n\nclass DdLogsWrapper implements DdLogsType {\n\n private nativeLogs: DdLogsType = NativeModules.DdLogs;\n\n debug(message: string, context: object = {}): Promise<void> {\n return this.nativeLogs.debug(message, context);\n }\n info(message: string, context: object = {}): Promise<void> {\n return this.nativeLogs.info(message, context);\n }\n warn(message: string, context: object = {}): Promise<void> {\n return this.nativeLogs.warn(message, context);\n }\n error(message: string, context: object = {}): Promise<void> {\n return this.nativeLogs.error(message, context);\n }\n\n}\n\nclass DdTraceWrapper implements DdTraceType {\n\n private nativeTrace: DdTraceType = NativeModules.DdTrace;\n\n startSpan(operation: string, context: object = {}, timestampMs: number = Date.now()): Promise<string> {\n // TODO swap context and stacktrace in the native call, requires native bridges update\n // @ts-ignore\n return this.nativeTrace.startSpan(operation, timestampMs, context);\n }\n finishSpan(spanId: string, context: object = {}, timestampMs: number = Date.now()): Promise<void> {\n // TODO swap context and stacktrace in the native call, requires native bridges update\n // @ts-ignore\n return this.nativeTrace.finishSpan(spanId, timestampMs, context);\n }\n\n}\n\nclass DdRumWrapper implements DdRumType {\n\n private nativeRum: DdRumType = NativeModules.DdRum;\n\n startView(key: string, name: string, context: object = {}, timestampMs: number = Date.now()): Promise<void> {\n // TODO swap context and stacktrace in the native call, requires native bridges update\n // @ts-ignore\n return this.nativeRum.startView(key, name, timestampMs, context);\n }\n stopView(key: string, context: object = {}, timestampMs: number = Date.now()): Promise<void> {\n // TODO swap context and stacktrace in the native call, requires native bridges update\n // @ts-ignore\n return this.nativeRum.stopView(key, timestampMs, context);\n }\n startAction(type: string, name: string, context: object = {}, timestampMs: number = Date.now()): Promise<void> {\n // TODO swap context and stacktrace in the native call, requires native bridges update\n // @ts-ignore\n return this.nativeRum.startAction(type, name, timestampMs, context);\n }\n stopAction(context: object = {}, timestampMs: number = Date.now()): Promise<void> {\n // TODO swap context and stacktrace in the native call, requires native bridges update\n // @ts-ignore\n return this.nativeRum.stopAction(timestampMs, context);\n }\n addAction(type: string, name: string, context: object = {}, timestampMs: number = Date.now()): Promise<void> {\n // TODO swap context and stacktrace in the native call, requires native bridges update\n // @ts-ignore\n return this.nativeRum.addAction(type, name, timestampMs, context);\n }\n startResource(key: string, method: string, url: string, context: object = {}, timestampMs: number = Date.now()): Promise<void> {\n // TODO swap context and stacktrace in the native call, requires native bridges update\n // @ts-ignore\n return this.nativeRum.startResource(key, method, url, timestampMs, context);\n }\n stopResource(key: string, statusCode: number, kind: string, context: object = {}, timestampMs: number = Date.now()): Promise<void> {\n // TODO swap context and stacktrace in the native call, requires native bridges update\n // @ts-ignore\n return this.nativeRum.stopResource(key, statusCode, kind, timestampMs, context);\n }\n addError(message: string, source: string, stacktrace: string, context: object = {}, timestampMs: number = Date.now()): Promise<void> {\n // TODO swap context and stacktrace in the native call, requires native bridges update\n // @ts-ignore\n return this.nativeRum.addError(message, source, stacktrace, timestampMs, context);\n }\n addTiming(name: string): Promise<void> {\n return this.nativeRum.addTiming(name);\n }\n\n}\n\nconst DdSdk: DdSdkType = NativeModules.DdSdk;\nconst DdLogs: DdLogsType = new DdLogsWrapper();\nconst DdTrace: DdTraceType = new DdTraceWrapper();\nconst DdRum: DdRumType = new DdRumWrapper();\n\nexport { DdSdkConfiguration, DdSdk, DdLogs, DdTrace, DdRum };\n"]}
1
+ {"version":3,"sources":["foundation.tsx"],"names":["DdLogsWrapper","NativeModules","DdLogs","debug","message","context","nativeLogs","info","warn","error","DdTraceWrapper","DdTrace","startSpan","operation","timestampMs","Date","now","nativeTrace","finishSpan","spanId","DdRumWrapper","DdRum","startView","key","name","nativeRum","stopView","startAction","type","stopAction","addAction","startResource","method","url","stopResource","statusCode","kind","size","addError","source","stacktrace","updatedContext","addTiming","DdSdk"],"mappings":";;;;;;;;;;;;;AAMA;;AACA;;;;AAEA,MAAMA,aAAN,CAA0C;AAAA;AAAA,wCAEPC,2BAAcC,MAFP;AAAA;;AAIxCC,EAAAA,KAAK,CAACC,OAAD,EAAkBC,OAAe,GAAG,EAApC,EAAuD;AAC1D,WAAO,KAAKC,UAAL,CAAgBH,KAAhB,CAAsBC,OAAtB,EAA+BC,OAA/B,CAAP;AACD;;AAEDE,EAAAA,IAAI,CAACH,OAAD,EAAkBC,OAAe,GAAG,EAApC,EAAuD;AACzD,WAAO,KAAKC,UAAL,CAAgBC,IAAhB,CAAqBH,OAArB,EAA8BC,OAA9B,CAAP;AACD;;AAEDG,EAAAA,IAAI,CAACJ,OAAD,EAAkBC,OAAe,GAAG,EAApC,EAAuD;AACzD,WAAO,KAAKC,UAAL,CAAgBE,IAAhB,CAAqBJ,OAArB,EAA8BC,OAA9B,CAAP;AACD;;AAEDI,EAAAA,KAAK,CAACL,OAAD,EAAkBC,OAAe,GAAG,EAApC,EAAuD;AAC1D,WAAO,KAAKC,UAAL,CAAgBG,KAAhB,CAAsBL,OAAtB,EAA+BC,OAA/B,CAAP;AACD;;AAlBuC;;AAsB1C,MAAMK,cAAN,CAA4C;AAAA;AAAA,yCAEPT,2BAAcU,OAFP;AAAA;;AAI1CC,EAAAA,SAAS,CAACC,SAAD,EAAoBR,OAAe,GAAG,EAAtC,EAA0CS,WAAmB,GAAGC,IAAI,CAACC,GAAL,EAAhE,EAA6F;AACpG,WAAO,KAAKC,WAAL,CAAiBL,SAAjB,CAA2BC,SAA3B,EAAsCR,O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CAAClB,IAAD,EAA8B;AACrC,WAAO,KAAKC,SAAL,CAAeiB,SAAf,CAAyBlB,IAAzB,CAAP;AACD;;AAxCqC;;AA4CxC,MAAMmB,KAAgB,GAAG1C,2BAAc0C,KAAvC;;AACA,MAAMzC,MAAkB,GAAG,IAAIF,aAAJ,EAA3B;;AACA,MAAMW,OAAoB,GAAG,IAAID,cAAJ,EAA7B;;AACA,MAAMW,KAAgB,GAAG,IAAID,YAAJ,EAAzB","sourcesContent":["/*\n * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.\n * This product includes software developed at Datadog (https://www.datadoghq.com/).\n * Copyright 2016-Present Datadog, Inc.\n */\n\nimport { NativeModules } from 'react-native';\nimport { DdSdkConfiguration, DdSdkType, DdLogsType, DdTraceType, DdRumType } from './types';\n\nclass DdLogsWrapper implements DdLogsType {\n\n private nativeLogs: DdLogsType = NativeModules.DdLogs;\n\n debug(message: string, context: object = {}): Promise<void> {\n return this.nativeLogs.debug(message, context);\n }\n\n info(message: string, context: object = {}): Promise<void> {\n return this.nativeLogs.info(message, context);\n }\n\n warn(message: string, context: object = {}): Promise<void> {\n return this.nativeLogs.warn(message, context);\n }\n\n error(message: string, context: object = {}): Promise<void> {\n return this.nativeLogs.error(message, context);\n }\n\n}\n\nclass DdTraceWrapper implements DdTraceType {\n\n private nativeTrace: DdTraceType = NativeModules.DdTrace;\n\n startSpan(operation: string, context: object = {}, timestampMs: number = Date.now()): Promise<string> {\n return this.nativeTrace.startSpan(operation, context, timestampMs);\n }\n\n finishSpan(spanId: string, context: object = {}, timestampMs: number = Date.now()): Promise<void> {\n return this.nativeTrace.finishSpan(spanId, context, timestampMs);\n }\n\n}\n\nclass DdRumWrapper implements DdRumType {\n\n private nativeRum: DdRumType = NativeModules.DdRum;\n\n startView(key: string, name: string, context: object = {}, timestampMs: number = Date.now()): Promise<void> {\n return this.nativeRum.startView(key, name, context, timestampMs);\n }\n\n stopView(key: string, context: object = {}, timestampMs: number = Date.now()): Promise<void> {\n return this.nativeRum.stopView(key, context, timestampMs);\n }\n\n startAction(type: string, name: string, context: object = {}, timestampMs: number = Date.now()): Promise<void> {\n return this.nativeRum.startAction(type, name, context, timestampMs);\n }\n\n stopAction(context: object = {}, timestampMs: number = Date.now()): Promise<void> {\n return this.nativeRum.stopAction(context, timestampMs);\n }\n\n addAction(type: string, name: string, context: object = {}, timestampMs: number = Date.now()): Promise<void> {\n return this.nativeRum.addAction(type, name, context, timestampMs);\n }\n\n startResource(key: string, method: string, url: string, context: object = {}, timestampMs: number = Date.now()): Promise<void> {\n return this.nativeRum.startResource(key, method, url, context, timestampMs);\n }\n\n stopResource(key: string, statusCode: number, kind: string, size: number = -1, context: object = {}, timestampMs: number = Date.now()): Promise<void> {\n return this.nativeRum.stopResource(key, statusCode, kind, size, context, timestampMs);\n }\n\n addError(message: string, source: string, stacktrace: string, context: object = {}, timestampMs: number = Date.now()): Promise<void> {\n let updatedContext: any = context;\n updatedContext[\"_dd.error.source_type\"] = \"react-native\";\n return this.nativeRum.addError(message, source, stacktrace, updatedContext, timestampMs);\n }\n\n addTiming(name: string): Promise<void> {\n return this.nativeRum.addTiming(name);\n }\n\n}\n\nconst DdSdk: DdSdkType = NativeModules.DdSdk;\nconst DdLogs: DdLogsType = new DdLogsWrapper();\nconst DdTrace: DdTraceType = new DdTraceWrapper();\nconst DdRum: DdRumType = new DdRumWrapper();\n\nexport { DdSdkConfiguration, DdSdk, DdLogs, DdTrace, DdRum };\n"]}