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

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 (124) hide show
  1. package/DatadogSDKReactNative.podspec +1 -1
  2. package/README.md +47 -16
  3. package/android/build.gradle +1 -1
  4. package/android/gradle.properties +4 -4
  5. package/lib/commonjs/DdSdkReactNative.js +38 -23
  6. package/lib/commonjs/DdSdkReactNative.js.map +1 -1
  7. package/lib/commonjs/DdSdkReactNativeConfiguration.js +17 -2
  8. package/lib/commonjs/DdSdkReactNativeConfiguration.js.map +1 -1
  9. package/lib/commonjs/InternalLog.js +56 -0
  10. package/lib/commonjs/InternalLog.js.map +1 -0
  11. package/lib/commonjs/ProxyConfiguration.js.map +1 -1
  12. package/lib/commonjs/SdkVerbosity.js +26 -0
  13. package/lib/commonjs/SdkVerbosity.js.map +1 -0
  14. package/lib/commonjs/TimeProvider.js +72 -0
  15. package/lib/commonjs/TimeProvider.js.map +1 -0
  16. package/lib/commonjs/Timer.js +10 -23
  17. package/lib/commonjs/Timer.js.map +1 -1
  18. package/lib/commonjs/TrackingConsent.js.map +1 -1
  19. package/lib/commonjs/foundation.js +51 -11
  20. package/lib/commonjs/foundation.js.map +1 -1
  21. package/lib/commonjs/index.js +34 -18
  22. package/lib/commonjs/index.js.map +1 -1
  23. package/lib/commonjs/rum/instrumentation/DdEventsInterceptor.js +14 -5
  24. package/lib/commonjs/rum/instrumentation/DdEventsInterceptor.js.map +1 -1
  25. package/lib/commonjs/rum/instrumentation/DdRumErrorTracking.js +34 -23
  26. package/lib/commonjs/rum/instrumentation/DdRumErrorTracking.js.map +1 -1
  27. package/lib/commonjs/rum/instrumentation/DdRumResourceTracking.js +62 -36
  28. package/lib/commonjs/rum/instrumentation/DdRumResourceTracking.js.map +1 -1
  29. package/lib/commonjs/rum/instrumentation/DdRumUserInteractionTracking.js +46 -7
  30. package/lib/commonjs/rum/instrumentation/DdRumUserInteractionTracking.js.map +1 -1
  31. package/lib/commonjs/rum/instrumentation/NoOpEventsInterceptor.js.map +1 -1
  32. package/lib/commonjs/rum/instrumentation/ShallowObjectEqualityChecker.js +34 -0
  33. package/lib/commonjs/rum/instrumentation/ShallowObjectEqualityChecker.js.map +1 -0
  34. package/lib/commonjs/rum/instrumentation/TraceIdentifier.js.map +1 -1
  35. package/lib/commonjs/types.js.map +1 -1
  36. package/lib/commonjs/version.js +1 -1
  37. package/lib/commonjs/version.js.map +1 -1
  38. package/lib/module/DdSdkReactNative.js +31 -23
  39. package/lib/module/DdSdkReactNative.js.map +1 -1
  40. package/lib/module/DdSdkReactNativeConfiguration.js +18 -3
  41. package/lib/module/DdSdkReactNativeConfiguration.js.map +1 -1
  42. package/lib/module/InternalLog.js +52 -0
  43. package/lib/module/InternalLog.js.map +1 -0
  44. package/lib/module/ProxyConfiguration.js.map +1 -1
  45. package/lib/module/SdkVerbosity.js +18 -0
  46. package/lib/module/SdkVerbosity.js.map +1 -0
  47. package/lib/module/TimeProvider.js +63 -0
  48. package/lib/module/TimeProvider.js.map +1 -0
  49. package/lib/module/Timer.js +14 -23
  50. package/lib/module/Timer.js.map +1 -1
  51. package/lib/module/TrackingConsent.js.map +1 -1
  52. package/lib/module/foundation.js +31 -11
  53. package/lib/module/foundation.js.map +1 -1
  54. package/lib/module/index.js +4 -2
  55. package/lib/module/index.js.map +1 -1
  56. package/lib/module/rum/instrumentation/DdEventsInterceptor.js +11 -5
  57. package/lib/module/rum/instrumentation/DdEventsInterceptor.js.map +1 -1
  58. package/lib/module/rum/instrumentation/DdRumErrorTracking.js +30 -23
  59. package/lib/module/rum/instrumentation/DdRumErrorTracking.js.map +1 -1
  60. package/lib/module/rum/instrumentation/DdRumResourceTracking.js +57 -34
  61. package/lib/module/rum/instrumentation/DdRumResourceTracking.js.map +1 -1
  62. package/lib/module/rum/instrumentation/DdRumUserInteractionTracking.js +41 -6
  63. package/lib/module/rum/instrumentation/DdRumUserInteractionTracking.js.map +1 -1
  64. package/lib/module/rum/instrumentation/NoOpEventsInterceptor.js.map +1 -1
  65. package/lib/module/rum/instrumentation/ShallowObjectEqualityChecker.js +25 -0
  66. package/lib/module/rum/instrumentation/ShallowObjectEqualityChecker.js.map +1 -0
  67. package/lib/module/rum/instrumentation/TraceIdentifier.js.map +1 -1
  68. package/lib/module/types.js.map +1 -1
  69. package/lib/module/version.js +1 -1
  70. package/lib/module/version.js.map +1 -1
  71. package/lib/typescript/DdSdkReactNative.d.ts +6 -6
  72. package/lib/typescript/DdSdkReactNativeConfiguration.d.ts +15 -4
  73. package/lib/typescript/InternalLog.d.ts +11 -0
  74. package/lib/typescript/SdkVerbosity.d.ts +9 -0
  75. package/lib/typescript/TimeProvider.d.ts +20 -0
  76. package/lib/typescript/Timer.d.ts +3 -2
  77. package/lib/typescript/index.d.ts +4 -2
  78. package/lib/typescript/rum/instrumentation/DdEventsInterceptor.d.ts +1 -0
  79. package/lib/typescript/rum/instrumentation/DdRumErrorTracking.d.ts +2 -2
  80. package/lib/typescript/rum/instrumentation/DdRumResourceTracking.d.ts +10 -9
  81. package/lib/typescript/rum/instrumentation/DdRumUserInteractionTracking.d.ts +3 -3
  82. package/lib/typescript/rum/instrumentation/DdRumXhr.d.ts +13 -3
  83. package/lib/typescript/rum/instrumentation/ShallowObjectEqualityChecker.d.ts +4 -0
  84. package/lib/typescript/version.d.ts +1 -1
  85. package/package.json +6 -3
  86. package/src/DdSdkReactNative.tsx +112 -62
  87. package/src/DdSdkReactNativeConfiguration.tsx +22 -14
  88. package/src/InternalLog.tsx +50 -0
  89. package/src/ProxyConfiguration.tsx +5 -5
  90. package/src/{NativeSdkVerbosity.tsx → SdkVerbosity.tsx} +6 -6
  91. package/src/TimeProvider.tsx +64 -0
  92. package/src/Timer.ts +20 -35
  93. package/src/TrackingConsent.tsx +3 -3
  94. package/src/__mocks__/InternalLog.tsx +9 -0
  95. package/src/__tests__/DdRumWrapper.test.tsx +40 -33
  96. package/src/__tests__/DdSdkReactNative.test.tsx +697 -513
  97. package/src/__tests__/InternalLog.test.tsx +379 -0
  98. package/src/__tests__/TimeProvider.test.tsx +75 -0
  99. package/src/__tests__/Timer.test.ts +148 -57
  100. package/src/__tests__/rum/instrumentation/DdEventsInterceptor.test.tsx +151 -92
  101. package/src/__tests__/rum/instrumentation/DdRumErrorTracking.test.tsx +179 -106
  102. package/src/__tests__/rum/instrumentation/DdRumResourceTracking.test.tsx +714 -644
  103. package/src/__tests__/rum/instrumentation/DdRumUserInteractionTracking.test.tsx +239 -85
  104. package/src/__tests__/rum/instrumentation/ShallowObjectEqualityChecker.test.ts +31 -0
  105. package/src/__tests__/rum/instrumentation/TraceIdentifier.test.tsx +13 -15
  106. package/src/__tests__/rum/instrumentation/__utils__/XMLHttpRequestMock.ts +97 -0
  107. package/src/foundation.tsx +80 -61
  108. package/src/index.tsx +15 -3
  109. package/src/rum/instrumentation/DdEventsInterceptor.tsx +51 -35
  110. package/src/rum/instrumentation/DdRumErrorTracking.tsx +61 -49
  111. package/src/rum/instrumentation/DdRumResourceTracking.tsx +307 -233
  112. package/src/rum/instrumentation/DdRumUserInteractionTracking.tsx +72 -25
  113. package/src/rum/instrumentation/DdRumXhr.tsx +21 -11
  114. package/src/rum/instrumentation/EventsInterceptor.tsx +3 -3
  115. package/src/rum/instrumentation/NoOpEventsInterceptor.tsx +2 -2
  116. package/src/rum/instrumentation/ShallowObjectEqualityChecker.ts +24 -0
  117. package/src/rum/instrumentation/TraceIdentifier.tsx +19 -19
  118. package/src/types.tsx +199 -158
  119. package/src/version.ts +1 -1
  120. package/lib/commonjs/NativeSdkVerbosity.js +0 -26
  121. package/lib/commonjs/NativeSdkVerbosity.js.map +0 -1
  122. package/lib/module/NativeSdkVerbosity.js +0 -18
  123. package/lib/module/NativeSdkVerbosity.js.map +0 -1
  124. package/lib/typescript/NativeSdkVerbosity.d.ts +0 -9
@@ -4,22 +4,23 @@
4
4
  * Copyright 2016-Present Datadog, Inc.
5
5
  */
6
6
 
7
- import React from 'react'
8
- import { DdEventsInterceptor } from './DdEventsInterceptor'
9
- import NoOpEventsInterceptor from './NoOpEventsInterceptor'
10
- import type EventsInterceptor from './EventsInterceptor'
7
+ import React from 'react';
11
8
 
9
+ import { InternalLog } from '../../InternalLog';
10
+ import { SdkVerbosity } from '../../SdkVerbosity';
12
11
 
13
- const PROPERTY_FUNCTION_TYPE = "function"
12
+ import { DdEventsInterceptor } from './DdEventsInterceptor';
13
+ import type EventsInterceptor from './EventsInterceptor';
14
+ import NoOpEventsInterceptor from './NoOpEventsInterceptor';
15
+ import { areObjectShallowEqual } from './ShallowObjectEqualityChecker';
14
16
 
15
17
  /**
16
- * Provides RUM auto-instrumentation feature to track user interaction as RUM events.
17
- * For now we are only covering the "onPress" events.
18
- */
18
+ * Provides RUM auto-instrumentation feature to track user interaction as RUM events.
19
+ * For now we are only covering the "onPress" events.
20
+ */
19
21
  export class DdRumUserInteractionTracking {
20
-
21
- private static isTracking = false
22
- private static eventsInterceptor: EventsInterceptor = new NoOpEventsInterceptor()
22
+ private static isTracking = false;
23
+ private static eventsInterceptor: EventsInterceptor = new NoOpEventsInterceptor();
23
24
 
24
25
  /**
25
26
  * Starts tracking user interactions and sends a RUM Action event every time a new interaction was detected.
@@ -29,23 +30,69 @@ export class DdRumUserInteractionTracking {
29
30
  static startTracking(): void {
30
31
  // extra safety to avoid wrapping more than 1 time this function
31
32
  if (DdRumUserInteractionTracking.isTracking) {
32
- return
33
+ InternalLog.log(
34
+ 'Datadog SDK is already tracking interactions',
35
+ SdkVerbosity.WARN
36
+ );
37
+ return;
33
38
  }
34
- DdRumUserInteractionTracking.eventsInterceptor = new DdEventsInterceptor()
35
- const original = React.createElement
36
- React.createElement = (element: any, props: any, ...children: any): any => {
39
+ DdRumUserInteractionTracking.eventsInterceptor = new DdEventsInterceptor();
40
+ const original = React.createElement;
41
+ React.createElement = (
42
+ element: any,
43
+ props: any,
44
+ ...children: any
45
+ ): any => {
37
46
  // check if we have an 'onPress' property and that this is really a function
38
- if (props && typeof props.onPress === PROPERTY_FUNCTION_TYPE) {
39
- const originalOnPress = props.onPress
47
+ if (props && typeof props.onPress === 'function') {
48
+ const originalOnPress = props.onPress;
40
49
  props.onPress = (...args: any[]) => {
41
- DdRumUserInteractionTracking.eventsInterceptor.interceptOnPress(...args)
42
- return originalOnPress(...args)
43
- }
50
+ DdRumUserInteractionTracking.eventsInterceptor.interceptOnPress(
51
+ ...args
52
+ );
53
+ return originalOnPress(...args);
54
+ };
55
+ // we store the original onPress prop so we can keep memoization working
56
+ props.__DATADOG_INTERNAL_ORIGINAL_ON_PRESS__ = originalOnPress;
44
57
  }
45
- return original(element, props, ...children)
46
- }
47
- DdRumUserInteractionTracking.isTracking = true
48
- }
58
+ return original(element, props, ...children);
59
+ };
49
60
 
50
- }
61
+ const originalMemo = React.memo;
62
+ React.memo = (
63
+ component: any,
64
+ propsAreEqual?: (prevProps: any, newProps: any) => boolean
65
+ ) => {
66
+ return originalMemo(component, (prev, next) => {
67
+ if (!next.onPress || !prev.onPress) {
68
+ return propsAreEqual
69
+ ? propsAreEqual(prev, next)
70
+ : areObjectShallowEqual(prev, next);
71
+ }
72
+ // we replace "our" onPress from the props by the original for comparison
73
+ const { onPress: _prevOnPress, ...partialPrevProps } = prev;
74
+ const prevProps = {
75
+ ...partialPrevProps,
76
+ onPress: prev.__DATADOG_INTERNAL_ORIGINAL_ON_PRESS__
77
+ };
78
+
79
+ const { onPress: _nextOnPress, ...partialNextProps } = next;
80
+ const nextProps = {
81
+ ...partialNextProps,
82
+ onPress: next.__DATADOG_INTERNAL_ORIGINAL_ON_PRESS__
83
+ };
84
+
85
+ // if no comparison function is provided we do shallow comparison
86
+ return propsAreEqual
87
+ ? propsAreEqual(prevProps, nextProps)
88
+ : areObjectShallowEqual(nextProps, prevProps);
89
+ });
90
+ };
51
91
 
92
+ DdRumUserInteractionTracking.isTracking = true;
93
+ InternalLog.log(
94
+ 'Datadog SDK is tracking interactions',
95
+ SdkVerbosity.INFO
96
+ );
97
+ }
98
+ }
@@ -4,20 +4,30 @@
4
4
  * Copyright 2016-Present Datadog, Inc.
5
5
  */
6
6
 
7
- import type Timer from "../../Timer";
8
-
7
+ import type Timer from '../../Timer';
9
8
 
10
9
  export interface DdRumXhr extends XMLHttpRequest {
11
-
12
- _datadog_xhr: DdRumXhrContext
13
-
10
+ _datadog_xhr: DdRumXhrContext;
14
11
  }
15
12
 
16
13
  export interface DdRumXhrContext {
17
- method: string,
18
- url: string,
19
- reported: boolean,
20
- timer: Timer,
21
- spanId: string,
22
- traceId: string
14
+ method: string;
15
+ url: string;
16
+ reported: boolean;
17
+ timer: Timer;
18
+ tracingAttributes: DdRumResourceTracingAttributes;
23
19
  }
20
+
21
+ export type DdRumResourceTracingAttributes =
22
+ | {
23
+ tracingStrategy: 'KEEP';
24
+ traceId: string;
25
+ spanId: string;
26
+ samplingPriorityHeader: '1';
27
+ }
28
+ | {
29
+ tracingStrategy: 'DISCARD';
30
+ traceId?: void;
31
+ spanId?: void;
32
+ samplingPriorityHeader: '0';
33
+ };
@@ -3,7 +3,7 @@
3
3
  * This product includes software developed at Datadog (https://www.datadoghq.com/).
4
4
  * Copyright 2016-Present Datadog, Inc.
5
5
  */
6
-
6
+
7
7
  export default interface EventsInterceptor {
8
- interceptOnPress(...args: any[]): void
9
- }
8
+ interceptOnPress(...args: any[]): void;
9
+ }
@@ -4,11 +4,11 @@
4
4
  * Copyright 2016-Present Datadog, Inc.
5
5
  */
6
6
 
7
- import type EventsInterceptor from './EventsInterceptor'
7
+ import type EventsInterceptor from './EventsInterceptor';
8
8
 
9
9
  export default class NoOpEventsInterceptor implements EventsInterceptor {
10
10
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
11
11
  interceptOnPress(..._args: any[]): void {
12
12
  // NoOp
13
13
  }
14
- }
14
+ }
@@ -0,0 +1,24 @@
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
+ /**
8
+ * Does a shallow comparison between 2 objects
9
+ */
10
+ export const areObjectShallowEqual = (
11
+ objectA: Record<string, unknown>,
12
+ objectB: Record<string, unknown>
13
+ ): boolean => {
14
+ const keys = Object.keys(objectA);
15
+ if (keys.length !== Object.keys(objectB).length) {
16
+ return false;
17
+ }
18
+ for (const key of keys) {
19
+ if (objectA[key] !== objectB[key]) {
20
+ return false;
21
+ }
22
+ }
23
+ return true;
24
+ };
@@ -9,26 +9,26 @@
9
9
  */
10
10
 
11
11
  export function generateTraceId(): string {
12
- const radix = 10
13
- const MAX_32_BITS_NUMBER = 4294967295 // 2^32-1
14
- let low: number = Math.floor(Math.random() * MAX_32_BITS_NUMBER)
15
- let high: number = Math.floor(Math.random() * MAX_32_BITS_NUMBER)
16
- let str = ''
12
+ const radix = 10;
13
+ const MAX_32_BITS_NUMBER = 4294967295; // 2^32-1
14
+ let low: number = Math.floor(Math.random() * MAX_32_BITS_NUMBER);
15
+ let high: number = Math.floor(Math.random() * MAX_32_BITS_NUMBER);
16
+ let str = '';
17
17
 
18
- while (high > 0 && low > 0) {
19
- // Create an intermediate value with the same modulo as the combined high and low value
20
- // but requiring 36 bits max (32 for the low value + 4 for the high part)
21
- const modH = high % radix
22
- const temp = ((modH) << 32) + low
23
- const digit = temp % radix
18
+ while (high > 0 && low > 0) {
19
+ // Create an intermediate value with the same modulo as the combined high and low value
20
+ // but requiring 36 bits max (32 for the low value + 4 for the high part)
21
+ const modH = high % radix;
22
+ const temp = (modH << 32) + low;
23
+ const digit = temp % radix;
24
24
 
25
- // update the high value
26
- high = (high - modH) / radix // we reuse the modH to avoid the need of a floor op
27
- // the low value reuses the previous temp value to account for the "missing mod" in the high update
28
- low = (temp - digit) / radix // we reuse the digit to avoid the need of a floor op
25
+ // update the high value
26
+ high = (high - modH) / radix; // we reuse the modH to avoid the need of a floor op
27
+ // the low value reuses the previous temp value to account for the "missing mod" in the high update
28
+ low = (temp - digit) / radix; // we reuse the digit to avoid the need of a floor op
29
29
 
30
- // update the string from right to left
31
- str = digit.toString() + str
32
- }
33
- return str
30
+ // update the string from right to left
31
+ str = digit.toString() + str;
32
+ }
33
+ return str;
34
34
  }
package/src/types.tsx CHANGED
@@ -8,186 +8,227 @@
8
8
  * A configuration object to initialize Datadog's features.
9
9
  */
10
10
  export class DdSdkConfiguration {
11
- constructor(
12
- readonly clientToken: string,
13
- readonly env: string,
14
- readonly applicationId: string,
15
- readonly nativeCrashReportEnabled: boolean,
16
- readonly sampleRate: number,
17
- readonly site: string,
18
- readonly trackingConsent: string,
19
- readonly additionalConfig: object
20
- ) {}
11
+ constructor(
12
+ readonly clientToken: string,
13
+ readonly env: string,
14
+ readonly applicationId: string,
15
+ readonly nativeCrashReportEnabled: boolean,
16
+ readonly sampleRate: number,
17
+ readonly site: string,
18
+ readonly trackingConsent: string,
19
+ readonly additionalConfig: object
20
+ ) {}
21
21
  }
22
22
 
23
23
  /**
24
24
  * The entry point to initialize Datadog's features.
25
25
  */
26
26
  export type DdSdkType = {
27
- /**
28
- * Initializes Datadog's features.
29
- * @param configuration: The configuration to use.
30
- */
31
- initialize(configuration: DdSdkConfiguration): Promise<void>;
32
-
33
- /**
34
- * Sets the global context (set of attributes) attached with all future Logs, Spans and RUM events.
35
- * @param attributes: The global context attributes.
36
- */
37
- setAttributes(attributes: object): Promise<void>;
38
-
39
- /**
40
- * Set the user information.
41
- * @param user: The user object (use builtin attributes: 'id', 'email', 'name', and/or any custom attribute).
42
- */
43
- setUser(user: object): Promise<void>;
44
-
45
- /**
46
- * Set the tracking consent regarding the data collection.
47
- * @param trackingConsent: Consent, which can take one of the following values: 'pending', 'granted', 'not_granted'.
48
- */
49
- setTrackingConsent(trackingConsent: string): Promise<void>;
50
-
27
+ /**
28
+ * Initializes Datadog's features.
29
+ * @param configuration: The configuration to use.
30
+ */
31
+ initialize(configuration: DdSdkConfiguration): Promise<void>;
32
+
33
+ /**
34
+ * Sets the global context (set of attributes) attached with all future Logs, Spans and RUM events.
35
+ * @param attributes: The global context attributes.
36
+ */
37
+ setAttributes(attributes: object): Promise<void>;
38
+
39
+ /**
40
+ * Set the user information.
41
+ * @param user: The user object (use builtin attributes: 'id', 'email', 'name', and/or any custom attribute).
42
+ */
43
+ setUser(user: object): Promise<void>;
44
+
45
+ /**
46
+ * Set the tracking consent regarding the data collection.
47
+ * @param trackingConsent: Consent, which can take one of the following values: 'pending', 'granted', 'not_granted'.
48
+ */
49
+ setTrackingConsent(trackingConsent: string): Promise<void>;
51
50
  };
52
51
 
53
52
  /**
54
53
  * The entry point to use Datadog's Logs feature.
55
54
  */
56
55
  export type DdLogsType = {
57
- /**
58
- * Send a log with level debug.
59
- * @param message: The message to send.
60
- * @param context: The additional context to send.
61
- */
62
- debug(message: string, context?: object): Promise<void>;
63
-
64
- /**
65
- * Send a log with level info.
66
- * @param message: The message to send.
67
- * @param context: The additional context to send.
68
- */
69
- info(message: string, context?: object): Promise<void>;
70
-
71
- /**
72
- * Send a log with level warn.
73
- * @param message: The message to send.
74
- * @param context: The additional context to send.
75
- */
76
- warn(message: string, context?: object): Promise<void>;
77
-
78
- /**
79
- * Send a log with level error.
80
- * @param message: The message to send.
81
- * @param context: The additional context to send.
82
- */
83
- error(message: string, context?: object): Promise<void>;
84
-
56
+ /**
57
+ * Send a log with level debug.
58
+ * @param message: The message to send.
59
+ * @param context: The additional context to send.
60
+ */
61
+ debug(message: string, context?: object): Promise<void>;
62
+
63
+ /**
64
+ * Send a log with level info.
65
+ * @param message: The message to send.
66
+ * @param context: The additional context to send.
67
+ */
68
+ info(message: string, context?: object): Promise<void>;
69
+
70
+ /**
71
+ * Send a log with level warn.
72
+ * @param message: The message to send.
73
+ * @param context: The additional context to send.
74
+ */
75
+ warn(message: string, context?: object): Promise<void>;
76
+
77
+ /**
78
+ * Send a log with level error.
79
+ * @param message: The message to send.
80
+ * @param context: The additional context to send.
81
+ */
82
+ error(message: string, context?: object): Promise<void>;
85
83
  };
86
84
 
87
85
  /**
88
86
  * The entry point to use Datadog's Trace feature.
89
87
  */
90
88
  export type DdTraceType = {
91
- /**
92
- * Start a span, and returns a unique identifier for the span.
93
- * @param operation: The operation name of the span.
94
- * @param context: The additional context to send.
95
- * @param timestampMs: The timestamp when the operation started (in milliseconds). If not provided, current timestamp will be used.
96
- */
97
- startSpan(operation: string, context?: object, timestampMs?: number): Promise<string>;
98
-
99
- /**
100
- * Finish a started span.
101
- * @param spanId: The unique identifier of the span.
102
- * @param context: The additional context to send.
103
- * @param timestampMs: The timestamp when the operation stopped (in milliseconds). If not provided, current timestamp will be used.
104
- */
105
- finishSpan(spanId: string, context?: object, timestampMs?: number): Promise<void>;
106
-
89
+ /**
90
+ * Start a span, and returns a unique identifier for the span.
91
+ * @param operation: The operation name of the span.
92
+ * @param context: The additional context to send.
93
+ * @param timestampMs: The timestamp when the operation started (in milliseconds). If not provided, current timestamp will be used.
94
+ */
95
+ startSpan(
96
+ operation: string,
97
+ context?: object,
98
+ timestampMs?: number
99
+ ): Promise<string>;
100
+
101
+ /**
102
+ * Finish a started span.
103
+ * @param spanId: The unique identifier of the span.
104
+ * @param context: The additional context to send.
105
+ * @param timestampMs: The timestamp when the operation stopped (in milliseconds). If not provided, current timestamp will be used.
106
+ */
107
+ finishSpan(
108
+ spanId: string,
109
+ context?: object,
110
+ timestampMs?: number
111
+ ): Promise<void>;
107
112
  };
108
113
 
109
114
  /**
110
115
  * The entry point to use Datadog's RUM feature.
111
116
  */
112
117
  export type DdRumType = {
113
- /**
114
- * Start tracking a RUM View.
115
- * @param key: The view unique key identifier.
116
- * @param name: The view name.
117
- * @param context: The additional context to send.
118
- * @param timestampMs: The timestamp when the view started (in milliseconds). If not provided, current timestamp will be used.
119
- */
120
- startView(key: string, name: string, context?: object, timestampMs?: number): Promise<void>;
121
-
122
- /**
123
- * Stop tracking a RUM View.
124
- * @param key: The view unique key identifier.
125
- * @param context: The additional context to send.
126
- * @param timestampMs: The timestamp when the view stopped (in milliseconds). If not provided, current timestamp will be used.
127
- */
128
- stopView(key: string, context?: object, timestampMs?: number): Promise<void>;
129
-
130
- /**
131
- * Start tracking a RUM Action.
132
- * @param type: The action type (tap, scroll, swipe, click, custom).
133
- * @param name: The action name.
134
- * @param context: The additional context to send.
135
- * @param timestampMs: The timestamp when the action started (in milliseconds). If not provided, current timestamp will be used.
136
- */
137
- startAction(type: string, name: string, context?: object, timestampMs?: number): Promise<void>;
138
-
139
- /**
140
- * Stop tracking the ongoing RUM Action.
141
- * @param context: The additional context to send.
142
- * @param timestampMs: The timestamp when the action stopped (in milliseconds). If not provided, current timestamp will be used.
143
- */
144
- stopAction(context?: object, timestampMs?: number): Promise<void>;
145
-
146
- /**
147
- * Add a RUM Action.
148
- * @param type: The action type (tap, scroll, swipe, click, custom).
149
- * @param name: The action name.
150
- * @param context: The additional context to send.
151
- * @param timestampMs: The timestamp when the action occurred (in milliseconds). If not provided, current timestamp will be used.
152
- */
153
- addAction(type: string, name: string, context?: object, timestampMs?: number): Promise<void>;
154
-
155
- /**
156
- * Start tracking a RUM Resource.
157
- * @param key: The resource unique key identifier.
158
- * @param method: The resource method (GET, POST, …).
159
- * @param url: The resource url.
160
- * @param context: The additional context to send.
161
- * @param timestampMs: The timestamp when the resource started (in milliseconds). If not provided, current timestamp will be used.
162
- */
163
- startResource(key: string, method: string, url: string, context?: object, timestampMs?: number): Promise<void>;
164
-
165
- /**
166
- * Stop tracking a RUM Resource.
167
- * @param key: The resource unique key identifier.
168
- * @param statusCode: The resource status code.
169
- * @param kind: The resource's kind (xhr, document, image, css, font, …).
170
- * @param size: The resource size in bytes. If size is unknown, use -1.
171
- * @param context: The additional context to send.
172
- * @param timestampMs: The timestamp when the resource stopped (in milliseconds). If not provided, current timestamp will be used.
173
- */
174
- stopResource(key: string, statusCode: number, kind: string, size?: number, context?: object, timestampMs?: number): Promise<void>;
175
-
176
- /**
177
- * Add a RUM Error.
178
- * @param message: The error message.
179
- * @param source: The error source (network, source, console, logger, …).
180
- * @param stacktrace: The error stacktrace.
181
- * @param context: The additional context to send.
182
- * @param timestampMs: The timestamp when the error occurred (in milliseconds). If not provided, current timestamp will be used.
183
- */
184
- addError(message: string, source: string, stacktrace: string, context?: object, timestampMs?: number): Promise<void>;
185
-
186
- /**
187
- * Adds a specific timing in the active View. The timing duration will be computed as the difference between the time the View was started and the time this function was called.
188
- * @param name: The name of the new custom timing attribute. Timings can be nested up to 8 levels deep. Names using more than 8 levels will be sanitized by SDK.
189
- */
190
- addTiming(name: string): Promise<void>;
191
-
118
+ /**
119
+ * Start tracking a RUM View.
120
+ * @param key: The view unique key identifier.
121
+ * @param name: The view name.
122
+ * @param context: The additional context to send.
123
+ * @param timestampMs: The timestamp when the view started (in milliseconds). If not provided, current timestamp will be used.
124
+ */
125
+ startView(
126
+ key: string,
127
+ name: string,
128
+ context?: object,
129
+ timestampMs?: number
130
+ ): Promise<void>;
131
+
132
+ /**
133
+ * Stop tracking a RUM View.
134
+ * @param key: The view unique key identifier.
135
+ * @param context: The additional context to send.
136
+ * @param timestampMs: The timestamp when the view stopped (in milliseconds). If not provided, current timestamp will be used.
137
+ */
138
+ stopView(
139
+ key: string,
140
+ context?: object,
141
+ timestampMs?: number
142
+ ): Promise<void>;
143
+
144
+ /**
145
+ * Start tracking a RUM Action.
146
+ * @param type: The action type (tap, scroll, swipe, click, custom).
147
+ * @param name: The action name.
148
+ * @param context: The additional context to send.
149
+ * @param timestampMs: The timestamp when the action started (in milliseconds). If not provided, current timestamp will be used.
150
+ */
151
+ startAction(
152
+ type: string,
153
+ name: string,
154
+ context?: object,
155
+ timestampMs?: number
156
+ ): Promise<void>;
157
+
158
+ /**
159
+ * Stop tracking the ongoing RUM Action.
160
+ * @param context: The additional context to send.
161
+ * @param timestampMs: The timestamp when the action stopped (in milliseconds). If not provided, current timestamp will be used.
162
+ */
163
+ stopAction(context?: object, timestampMs?: number): Promise<void>;
164
+
165
+ /**
166
+ * Add a RUM Action.
167
+ * @param type: The action type (tap, scroll, swipe, click, custom).
168
+ * @param name: The action name.
169
+ * @param context: The additional context to send.
170
+ * @param timestampMs: The timestamp when the action occurred (in milliseconds). If not provided, current timestamp will be used.
171
+ */
172
+ addAction(
173
+ type: string,
174
+ name: string,
175
+ context?: object,
176
+ timestampMs?: number
177
+ ): Promise<void>;
178
+
179
+ /**
180
+ * Start tracking a RUM Resource.
181
+ * @param key: The resource unique key identifier.
182
+ * @param method: The resource method (GET, POST, …).
183
+ * @param url: The resource url.
184
+ * @param context: The additional context to send.
185
+ * @param timestampMs: The timestamp when the resource started (in milliseconds). If not provided, current timestamp will be used.
186
+ */
187
+ startResource(
188
+ key: string,
189
+ method: string,
190
+ url: string,
191
+ context?: object,
192
+ timestampMs?: number
193
+ ): Promise<void>;
194
+
195
+ /**
196
+ * Stop tracking a RUM Resource.
197
+ * @param key: The resource unique key identifier.
198
+ * @param statusCode: The resource status code.
199
+ * @param kind: The resource's kind (xhr, document, image, css, font, …).
200
+ * @param size: The resource size in bytes. If size is unknown, use -1.
201
+ * @param context: The additional context to send.
202
+ * @param timestampMs: The timestamp when the resource stopped (in milliseconds). If not provided, current timestamp will be used.
203
+ */
204
+ stopResource(
205
+ key: string,
206
+ statusCode: number,
207
+ kind: string,
208
+ size?: number,
209
+ context?: object,
210
+ timestampMs?: number
211
+ ): Promise<void>;
212
+
213
+ /**
214
+ * Add a RUM Error.
215
+ * @param message: The error message.
216
+ * @param source: The error source (network, source, console, logger, …).
217
+ * @param stacktrace: The error stacktrace.
218
+ * @param context: The additional context to send.
219
+ * @param timestampMs: The timestamp when the error occurred (in milliseconds). If not provided, current timestamp will be used.
220
+ */
221
+ addError(
222
+ message: string,
223
+ source: string,
224
+ stacktrace: string,
225
+ context?: object,
226
+ timestampMs?: number
227
+ ): Promise<void>;
228
+
229
+ /**
230
+ * Adds a specific timing in the active View. The timing duration will be computed as the difference between the time the View was started and the time this function was called.
231
+ * @param name: The name of the new custom timing attribute. Timings can be nested up to 8 levels deep. Names using more than 8 levels will be sanitized by SDK.
232
+ */
233
+ addTiming(name: string): Promise<void>;
192
234
  };
193
-
package/src/version.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  // generated by genversion
2
- export const version = '1.0.0-rc4';
2
+ export const version = '1.0.0-rc7';