@datadog/mobile-react-native-navigation 1.0.0-rc8 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/typescript/core/src/DdSdkReactNative.d.ts +2 -0
- package/lib/typescript/core/src/DdSdkReactNativeConfiguration.d.ts +20 -0
- package/lib/typescript/core/src/foundation.d.ts +3 -2
- package/lib/typescript/core/src/nativeModulesTypes.d.ts +168 -0
- package/lib/typescript/core/src/rum/instrumentation/DdEventsInterceptor.d.ts +0 -15
- package/lib/typescript/core/src/rum/instrumentation/resourceTracking/DdRumResourceTracking.d.ts +15 -0
- package/lib/typescript/core/src/rum/instrumentation/resourceTracking/domain/distributedTracing.d.ts +18 -0
- package/lib/typescript/core/src/rum/instrumentation/resourceTracking/domain/firstPartyHosts.d.ts +6 -0
- package/lib/typescript/core/src/rum/instrumentation/resourceTracking/domain/interfaces/RequestProxy.d.ts +8 -0
- package/lib/typescript/core/src/rum/instrumentation/resourceTracking/domain/interfaces/RumResource.d.ts +20 -0
- package/lib/typescript/core/src/rum/instrumentation/resourceTracking/implementation/DatadogRumResource/ResourceReporter.d.ts +8 -0
- package/lib/typescript/core/src/rum/instrumentation/resourceTracking/implementation/DatadogRumResource/internalDevResourceBlocklist.d.ts +6 -0
- package/lib/typescript/core/src/rum/instrumentation/resourceTracking/implementation/DatadogRumResource/resourceTiming.d.ts +17 -0
- package/lib/typescript/core/src/rum/instrumentation/resourceTracking/implementation/URLHostParser.d.ts +6 -0
- package/lib/typescript/core/src/rum/instrumentation/resourceTracking/implementation/XHRProxy.d.ts +25 -0
- package/lib/typescript/core/src/rum/instrumentation/resourceTracking/implementation/responseSize.d.ts +3 -0
- package/lib/typescript/core/src/types.d.ts +42 -7
- package/lib/typescript/core/src/version.d.ts +1 -1
- package/package.json +4 -4
- package/lib/typescript/core/src/rum/instrumentation/DdRumResourceTracking.d.ts +0 -40
- package/lib/typescript/core/src/rum/instrumentation/DdRumXhr.d.ts +0 -23
- package/lib/typescript/core/src/rum/instrumentation/TraceIdentifier.d.ts +0 -1
- package/lib/typescript/core/src/rum/instrumentation/URLHostParser.d.ts +0 -6
|
@@ -9,6 +9,8 @@ export declare class DdSdkReactNative {
|
|
|
9
9
|
private static readonly DD_SERVICE_NAME;
|
|
10
10
|
private static readonly DD_SDK_VERBOSITY_KEY;
|
|
11
11
|
private static readonly DD_NATIVE_VIEW_TRACKING_KEY;
|
|
12
|
+
private static readonly DD_VERSION;
|
|
13
|
+
private static readonly DD_VERSION_SUFFIX;
|
|
12
14
|
private static readonly DD_PROXY_TYPE_KEY;
|
|
13
15
|
private static readonly DD_PROXY_ADDRESS_KEY;
|
|
14
16
|
private static readonly DD_PROXY_PORT_KEY;
|
|
@@ -32,6 +32,26 @@ export declare class DdSdkReactNativeConfiguration {
|
|
|
32
32
|
proxyConfig?: ProxyConfiguration;
|
|
33
33
|
serviceName?: string;
|
|
34
34
|
firstPartyHosts: string[];
|
|
35
|
+
/**
|
|
36
|
+
* Overrides the reported version of the app.
|
|
37
|
+
* Accepted characters are alphanumerics and `_`, `-`, `:`, `.`, `/`.
|
|
38
|
+
* Other special characters are converted to underscores.
|
|
39
|
+
*
|
|
40
|
+
* See https://docs.datadoghq.com/getting_started/tagging/#define-tags for more information on the format.
|
|
41
|
+
*
|
|
42
|
+
* Make sure you set it correctly, as it will have to match the one specified during the upload of your source maps and other mapping files.
|
|
43
|
+
*/
|
|
44
|
+
version?: string;
|
|
45
|
+
/**
|
|
46
|
+
* Add a suffix to the reported version of the app.
|
|
47
|
+
* Accepted characters are alphanumerics and `_`, `-`, `:`, `.`, `/`.
|
|
48
|
+
* Other special characters are converted to underscores.
|
|
49
|
+
*
|
|
50
|
+
* See https://docs.datadoghq.com/getting_started/tagging/#define-tags for more information on the format.
|
|
51
|
+
*
|
|
52
|
+
* A dash (`-`) will be automatically added between the version and the suffix
|
|
53
|
+
*/
|
|
54
|
+
versionSuffix?: string;
|
|
35
55
|
additionalConfig: {
|
|
36
56
|
[k: string]: any;
|
|
37
57
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { DdSdkConfiguration,
|
|
2
|
-
|
|
1
|
+
import { DdSdkConfiguration, DdLogsType, DdTraceType, DdRumType } from './types';
|
|
2
|
+
import type { DdNativeSdkType } from './nativeModulesTypes';
|
|
3
|
+
declare const DdSdk: DdNativeSdkType;
|
|
3
4
|
declare const DdLogs: DdLogsType;
|
|
4
5
|
declare const DdTrace: DdTraceType;
|
|
5
6
|
declare const DdRum: DdRumType;
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A configuration object to initialize Datadog's features.
|
|
3
|
+
*/
|
|
4
|
+
export declare class DdNativeSdkConfiguration {
|
|
5
|
+
readonly clientToken: string;
|
|
6
|
+
readonly env: string;
|
|
7
|
+
readonly applicationId: string;
|
|
8
|
+
readonly nativeCrashReportEnabled: boolean;
|
|
9
|
+
readonly sampleRate: number;
|
|
10
|
+
readonly site: string;
|
|
11
|
+
readonly trackingConsent: string;
|
|
12
|
+
readonly additionalConfig: object;
|
|
13
|
+
constructor(clientToken: string, env: string, applicationId: string, nativeCrashReportEnabled: boolean, sampleRate: number, site: string, trackingConsent: string, additionalConfig: object);
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* The entry point to initialize Datadog's features.
|
|
17
|
+
*/
|
|
18
|
+
export declare type DdNativeSdkType = {
|
|
19
|
+
/**
|
|
20
|
+
* Initializes Datadog's features.
|
|
21
|
+
* @param configuration: The configuration to use.
|
|
22
|
+
*/
|
|
23
|
+
initialize(configuration: DdNativeSdkConfiguration): Promise<void>;
|
|
24
|
+
/**
|
|
25
|
+
* Sets the global context (set of attributes) attached with all future Logs, Spans and RUM events.
|
|
26
|
+
* @param attributes: The global context attributes.
|
|
27
|
+
*/
|
|
28
|
+
setAttributes(attributes: object): Promise<void>;
|
|
29
|
+
/**
|
|
30
|
+
* Set the user information.
|
|
31
|
+
* @param user: The user object (use builtin attributes: 'id', 'email', 'name', and/or any custom attribute).
|
|
32
|
+
*/
|
|
33
|
+
setUser(user: object): Promise<void>;
|
|
34
|
+
/**
|
|
35
|
+
* Set the tracking consent regarding the data collection.
|
|
36
|
+
* @param trackingConsent: Consent, which can take one of the following values: 'pending', 'granted', 'not_granted'.
|
|
37
|
+
*/
|
|
38
|
+
setTrackingConsent(trackingConsent: string): Promise<void>;
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* The entry point to use Datadog's Logs feature.
|
|
42
|
+
*/
|
|
43
|
+
export declare type DdNativeLogsType = {
|
|
44
|
+
/**
|
|
45
|
+
* Send a log with level debug.
|
|
46
|
+
* @param message: The message to send.
|
|
47
|
+
* @param context: The additional context to send.
|
|
48
|
+
*/
|
|
49
|
+
debug(message: string, context?: object): Promise<void>;
|
|
50
|
+
/**
|
|
51
|
+
* Send a log with level info.
|
|
52
|
+
* @param message: The message to send.
|
|
53
|
+
* @param context: The additional context to send.
|
|
54
|
+
*/
|
|
55
|
+
info(message: string, context?: object): Promise<void>;
|
|
56
|
+
/**
|
|
57
|
+
* Send a log with level warn.
|
|
58
|
+
* @param message: The message to send.
|
|
59
|
+
* @param context: The additional context to send.
|
|
60
|
+
*/
|
|
61
|
+
warn(message: string, context?: object): Promise<void>;
|
|
62
|
+
/**
|
|
63
|
+
* Send a log with level error.
|
|
64
|
+
* @param message: The message to send.
|
|
65
|
+
* @param context: The additional context to send.
|
|
66
|
+
*/
|
|
67
|
+
error(message: string, context?: object): Promise<void>;
|
|
68
|
+
};
|
|
69
|
+
/**
|
|
70
|
+
* The entry point to use Datadog's Trace feature.
|
|
71
|
+
*/
|
|
72
|
+
export declare type DdNativeTraceType = {
|
|
73
|
+
/**
|
|
74
|
+
* Start a span, and returns a unique identifier for the span.
|
|
75
|
+
* @param operation: The operation name of the span.
|
|
76
|
+
* @param context: The additional context to send.
|
|
77
|
+
* @param timestampMs: The timestamp when the operation started (in milliseconds). If not provided, current timestamp will be used.
|
|
78
|
+
*/
|
|
79
|
+
startSpan(operation: string, context?: object, timestampMs?: number): Promise<string>;
|
|
80
|
+
/**
|
|
81
|
+
* Finish a started span.
|
|
82
|
+
* @param spanId: The unique identifier of the span.
|
|
83
|
+
* @param context: The additional context to send.
|
|
84
|
+
* @param timestampMs: The timestamp when the operation stopped (in milliseconds). If not provided, current timestamp will be used.
|
|
85
|
+
*/
|
|
86
|
+
finishSpan(spanId: string, context?: object, timestampMs?: number): Promise<void>;
|
|
87
|
+
};
|
|
88
|
+
/**
|
|
89
|
+
* The entry point to use Datadog's RUM feature.
|
|
90
|
+
*/
|
|
91
|
+
export declare type DdNativeRumType = {
|
|
92
|
+
/**
|
|
93
|
+
* Start tracking a RUM View.
|
|
94
|
+
* @param key: The view unique key identifier.
|
|
95
|
+
* @param name: The view name.
|
|
96
|
+
* @param context: The additional context to send.
|
|
97
|
+
* @param timestampMs: The timestamp when the view started (in milliseconds). If not provided, current timestamp will be used.
|
|
98
|
+
*/
|
|
99
|
+
startView(key: string, name: string, context?: object, timestampMs?: number): Promise<void>;
|
|
100
|
+
/**
|
|
101
|
+
* Stop tracking a RUM View.
|
|
102
|
+
* @param key: The view unique key identifier.
|
|
103
|
+
* @param context: The additional context to send.
|
|
104
|
+
* @param timestampMs: The timestamp when the view stopped (in milliseconds). If not provided, current timestamp will be used.
|
|
105
|
+
*/
|
|
106
|
+
stopView(key: string, context?: object, timestampMs?: number): Promise<void>;
|
|
107
|
+
/**
|
|
108
|
+
* Start tracking a RUM Action.
|
|
109
|
+
* @param type: The action type (tap, scroll, swipe, back, custom).
|
|
110
|
+
* @param name: The action name.
|
|
111
|
+
* @param context: The additional context to send.
|
|
112
|
+
* @param timestampMs: The timestamp when the action started (in milliseconds). If not provided, current timestamp will be used.
|
|
113
|
+
*/
|
|
114
|
+
startAction(type: ActionType, name: string, context?: object, timestampMs?: number): Promise<void>;
|
|
115
|
+
/**
|
|
116
|
+
* Stop tracking the ongoing RUM Action.
|
|
117
|
+
* @param type: The action type (tap, scroll, swipe, back, custom).
|
|
118
|
+
* @param name: The action name.
|
|
119
|
+
* @param context: The additional context to send.
|
|
120
|
+
* @param timestampMs: The timestamp when the action stopped (in milliseconds). If not provided, current timestamp will be used.
|
|
121
|
+
*/
|
|
122
|
+
stopAction(type: ActionType, name: string, context?: object, timestampMs?: number): Promise<void>;
|
|
123
|
+
/**
|
|
124
|
+
* Add a RUM Action.
|
|
125
|
+
* @param type: The action type (tap, scroll, swipe, back, custom).
|
|
126
|
+
* @param name: The action name.
|
|
127
|
+
* @param context: The additional context to send.
|
|
128
|
+
* @param timestampMs: The timestamp when the action occurred (in milliseconds). If not provided, current timestamp will be used.
|
|
129
|
+
*/
|
|
130
|
+
addAction(type: ActionType, name: string, context?: object, timestampMs?: number): Promise<void>;
|
|
131
|
+
/**
|
|
132
|
+
* Start tracking a RUM Resource.
|
|
133
|
+
* @param key: The resource unique key identifier.
|
|
134
|
+
* @param method: The resource method (GET, POST, …).
|
|
135
|
+
* @param url: The resource url.
|
|
136
|
+
* @param context: The additional context to send.
|
|
137
|
+
* @param timestampMs: The timestamp when the resource started (in milliseconds). If not provided, current timestamp will be used.
|
|
138
|
+
*/
|
|
139
|
+
startResource(key: string, method: string, url: string, context?: object, timestampMs?: number): Promise<void>;
|
|
140
|
+
/**
|
|
141
|
+
* Stop tracking a RUM Resource.
|
|
142
|
+
* @param key: The resource unique key identifier.
|
|
143
|
+
* @param statusCode: The resource status code.
|
|
144
|
+
* @param kind: The resource's kind (xhr, document, image, css, font, …).
|
|
145
|
+
* @param size: The resource size in bytes. If size is unknown, use -1.
|
|
146
|
+
* @param context: The additional context to send.
|
|
147
|
+
* @param timestampMs: The timestamp when the resource stopped (in milliseconds). If not provided, current timestamp will be used.
|
|
148
|
+
*/
|
|
149
|
+
stopResource(key: string, statusCode: number, kind: ResourceKind, size?: number, context?: object, timestampMs?: number): Promise<void>;
|
|
150
|
+
/**
|
|
151
|
+
* Add a RUM Error.
|
|
152
|
+
* @param message: The error message.
|
|
153
|
+
* @param source: The error source (network, source, console, webview, custom).
|
|
154
|
+
* @param stacktrace: The error stacktrace.
|
|
155
|
+
* @param context: The additional context to send.
|
|
156
|
+
* @param timestampMs: The timestamp when the error occurred (in milliseconds). If not provided, current timestamp will be used.
|
|
157
|
+
*/
|
|
158
|
+
addError(message: string, source: ErrorSource, stacktrace: string, context?: object, timestampMs?: number): Promise<void>;
|
|
159
|
+
/**
|
|
160
|
+
* 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.
|
|
161
|
+
* @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.
|
|
162
|
+
*/
|
|
163
|
+
addTiming(name: string): Promise<void>;
|
|
164
|
+
};
|
|
165
|
+
declare type ActionType = 'TAP' | 'SCROLL' | 'SWIPE' | 'BACK' | 'CUSTOM';
|
|
166
|
+
declare type ResourceKind = 'image' | 'xhr' | 'beacon' | 'css' | 'document' | 'fetch' | 'font' | 'js' | 'media' | 'other' | 'native';
|
|
167
|
+
declare type ErrorSource = 'NETWORK' | 'SOURCE' | 'CONSOLE' | 'WEBVIEW' | 'CUSTOM';
|
|
168
|
+
export {};
|
|
@@ -9,18 +9,3 @@ export declare class DdEventsInterceptor implements EventsInterceptor {
|
|
|
9
9
|
private resolveElementTypeName;
|
|
10
10
|
private findClosestActionLabel;
|
|
11
11
|
}
|
|
12
|
-
/**
|
|
13
|
-
* Describe the type of a RUM Action.
|
|
14
|
-
*/
|
|
15
|
-
export declare enum RumActionType {
|
|
16
|
-
/** User tapped on a widget. */
|
|
17
|
-
TAP = "TAP",
|
|
18
|
-
/** User scrolled a view. */
|
|
19
|
-
SCROLL = "SCROLL",
|
|
20
|
-
/** User swiped on a view. */
|
|
21
|
-
SWIPE = "SWIPE",
|
|
22
|
-
/** User clicked on a widget (not used on Mobile). */
|
|
23
|
-
CLICK = "CLICK",
|
|
24
|
-
/** A custom action. */
|
|
25
|
-
CUSTOM = "CUSTOM"
|
|
26
|
-
}
|
package/lib/typescript/core/src/rum/instrumentation/resourceTracking/DdRumResourceTracking.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Provides RUM auto-instrumentation feature to track resources (fetch, XHR, axios) as RUM events.
|
|
3
|
+
*/
|
|
4
|
+
export declare class DdRumResourceTracking {
|
|
5
|
+
private static isTracking;
|
|
6
|
+
private static requestProxy;
|
|
7
|
+
/**
|
|
8
|
+
* Starts tracking resources and sends a RUM Resource event every time a network request is detected.
|
|
9
|
+
*/
|
|
10
|
+
static startTracking({ tracingSamplingRate, firstPartyHosts }: {
|
|
11
|
+
tracingSamplingRate: number;
|
|
12
|
+
firstPartyHosts: string[];
|
|
13
|
+
}): void;
|
|
14
|
+
static stopTracking(): void;
|
|
15
|
+
}
|
package/lib/typescript/core/src/rum/instrumentation/resourceTracking/domain/distributedTracing.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Hostname } from './firstPartyHosts';
|
|
2
|
+
export declare type DdRumResourceTracingAttributes = {
|
|
3
|
+
tracingStrategy: 'KEEP';
|
|
4
|
+
traceId: string;
|
|
5
|
+
spanId: string;
|
|
6
|
+
samplingPriorityHeader: '1';
|
|
7
|
+
} | {
|
|
8
|
+
tracingStrategy: 'DISCARD';
|
|
9
|
+
traceId?: void;
|
|
10
|
+
spanId?: void;
|
|
11
|
+
samplingPriorityHeader: '0';
|
|
12
|
+
};
|
|
13
|
+
export declare const getTracingAttributes: ({ hostname, firstPartyHostsRegex, tracingSamplingRate }: {
|
|
14
|
+
hostname: Hostname | null;
|
|
15
|
+
firstPartyHostsRegex: RegExp;
|
|
16
|
+
tracingSamplingRate: number;
|
|
17
|
+
}) => DdRumResourceTracingAttributes;
|
|
18
|
+
export declare function generateTraceId(): string;
|
package/lib/typescript/core/src/rum/instrumentation/resourceTracking/domain/firstPartyHosts.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare type Hostname = {
|
|
2
|
+
_type: 'Hostname';
|
|
3
|
+
} & string;
|
|
4
|
+
export declare const NO_MATCH_REGEX: RegExp;
|
|
5
|
+
export declare const firstPartyHostsRegexBuilder: (firstPartyHosts: string[]) => RegExp;
|
|
6
|
+
export declare const isHostFirstParty: (hostname: Hostname, firstPartyHostsRegex: RegExp) => boolean;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { ResourceKind } from '../../../../../../../core/src/types';
|
|
2
|
+
import type { DdRumResourceTracingAttributes } from '../distributedTracing';
|
|
3
|
+
export interface RUMResource {
|
|
4
|
+
key: string;
|
|
5
|
+
request: {
|
|
6
|
+
method: string;
|
|
7
|
+
url: string;
|
|
8
|
+
kind: ResourceKind;
|
|
9
|
+
};
|
|
10
|
+
tracingAttributes: DdRumResourceTracingAttributes;
|
|
11
|
+
response: {
|
|
12
|
+
statusCode: number;
|
|
13
|
+
size: number;
|
|
14
|
+
};
|
|
15
|
+
timings: {
|
|
16
|
+
startTime: number;
|
|
17
|
+
stopTime: number;
|
|
18
|
+
responseStartTime?: number;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { RUMResource } from '../../domain/interfaces/RumResource';
|
|
2
|
+
declare type ResourceMapper = (resource: RUMResource) => RUMResource | null;
|
|
3
|
+
export declare class ResourceReporter {
|
|
4
|
+
private mappers;
|
|
5
|
+
constructor(resourceMappers: ResourceMapper[]);
|
|
6
|
+
reportResource: (resource: RUMResource) => void;
|
|
7
|
+
}
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { RUMResource } from '../../domain/interfaces/RumResource';
|
|
2
|
+
/**
|
|
3
|
+
* Filters RN symbolicate calls and Expo logs calls that happen only in dev.
|
|
4
|
+
* @param resource RUMResource
|
|
5
|
+
*/
|
|
6
|
+
export declare const filterDevResource: (resource: RUMResource) => RUMResource | null;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
interface Timing {
|
|
2
|
+
/**
|
|
3
|
+
* Time relative (absolute in case of iOS) to some point, in ns.
|
|
4
|
+
*/
|
|
5
|
+
startTime: number;
|
|
6
|
+
/**
|
|
7
|
+
* Duration in ns.
|
|
8
|
+
*/
|
|
9
|
+
duration: number;
|
|
10
|
+
}
|
|
11
|
+
interface ResourceTimings {
|
|
12
|
+
firstByte: Timing;
|
|
13
|
+
download: Timing;
|
|
14
|
+
fetch: Timing;
|
|
15
|
+
}
|
|
16
|
+
export declare function createTimings(startTime: number, responseStartTime: number, responseEndTime: number): ResourceTimings;
|
|
17
|
+
export {};
|
package/lib/typescript/core/src/rum/instrumentation/resourceTracking/implementation/XHRProxy.d.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/// <reference types="react-native" />
|
|
2
|
+
import type { RequestProxyOptions } from '../domain/interfaces/RequestProxy';
|
|
3
|
+
import { RequestProxy } from '../domain/interfaces/RequestProxy';
|
|
4
|
+
import type { ResourceReporter } from './DatadogRumResource/ResourceReporter';
|
|
5
|
+
export declare const TRACE_ID_HEADER_KEY = "x-datadog-trace-id";
|
|
6
|
+
export declare const PARENT_ID_HEADER_KEY = "x-datadog-parent-id";
|
|
7
|
+
export declare const ORIGIN_HEADER_KEY = "x-datadog-origin";
|
|
8
|
+
export declare const SAMPLING_PRIORITY_HEADER_KEY = "x-datadog-sampling-priority";
|
|
9
|
+
export declare const ORIGIN_RUM = "rum";
|
|
10
|
+
interface XHRProxyProviders {
|
|
11
|
+
xhrType: typeof XMLHttpRequest;
|
|
12
|
+
resourceReporter: ResourceReporter;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Proxies XMLHTTPRequest to track resources.
|
|
16
|
+
*/
|
|
17
|
+
export declare class XHRProxy extends RequestProxy {
|
|
18
|
+
private providers;
|
|
19
|
+
private static originalXhrOpen;
|
|
20
|
+
private static originalXhrSend;
|
|
21
|
+
constructor(providers: XHRProxyProviders);
|
|
22
|
+
onTrackingStart: (context: RequestProxyOptions) => void;
|
|
23
|
+
onTrackingStop: () => void;
|
|
24
|
+
}
|
|
25
|
+
export {};
|
|
@@ -106,26 +106,38 @@ export declare type DdRumType = {
|
|
|
106
106
|
stopView(key: string, context?: object, timestampMs?: number): Promise<void>;
|
|
107
107
|
/**
|
|
108
108
|
* Start tracking a RUM Action.
|
|
109
|
-
* @param type: The action type (tap, scroll, swipe,
|
|
109
|
+
* @param type: The action type (tap, scroll, swipe, back, custom).
|
|
110
110
|
* @param name: The action name.
|
|
111
111
|
* @param context: The additional context to send.
|
|
112
112
|
* @param timestampMs: The timestamp when the action started (in milliseconds). If not provided, current timestamp will be used.
|
|
113
113
|
*/
|
|
114
|
-
startAction(type:
|
|
114
|
+
startAction(type: RumActionType, name: string, context?: object, timestampMs?: number): Promise<void>;
|
|
115
115
|
/**
|
|
116
116
|
* Stop tracking the ongoing RUM Action.
|
|
117
|
+
* @param type: The action type (tap, scroll, swipe, back, custom).
|
|
118
|
+
* @param name: The action name.
|
|
119
|
+
* @param context: The additional context to send.
|
|
120
|
+
* @param timestampMs: The timestamp when the action stopped (in milliseconds). If not provided, current timestamp will be used.
|
|
121
|
+
*/
|
|
122
|
+
stopAction(type: RumActionType, name: string, context?: object, timestampMs?: number): Promise<void>;
|
|
123
|
+
/**
|
|
124
|
+
* Stop tracking the ongoing RUM Action.
|
|
125
|
+
*
|
|
126
|
+
* Warning: using this function signature can lead to inconsistent behaviors on iOS and Android when multiple actions are started in parallel.
|
|
127
|
+
*
|
|
128
|
+
* @deprecated add the `type` and `name` of the action as first two arguments.
|
|
117
129
|
* @param context: The additional context to send.
|
|
118
130
|
* @param timestampMs: The timestamp when the action stopped (in milliseconds). If not provided, current timestamp will be used.
|
|
119
131
|
*/
|
|
120
132
|
stopAction(context?: object, timestampMs?: number): Promise<void>;
|
|
121
133
|
/**
|
|
122
134
|
* Add a RUM Action.
|
|
123
|
-
* @param type: The action type (tap, scroll, swipe,
|
|
135
|
+
* @param type: The action type (tap, scroll, swipe, back, custom).
|
|
124
136
|
* @param name: The action name.
|
|
125
137
|
* @param context: The additional context to send.
|
|
126
138
|
* @param timestampMs: The timestamp when the action occurred (in milliseconds). If not provided, current timestamp will be used.
|
|
127
139
|
*/
|
|
128
|
-
addAction(type:
|
|
140
|
+
addAction(type: RumActionType, name: string, context?: object, timestampMs?: number): Promise<void>;
|
|
129
141
|
/**
|
|
130
142
|
* Start tracking a RUM Resource.
|
|
131
143
|
* @param key: The resource unique key identifier.
|
|
@@ -144,19 +156,42 @@ export declare type DdRumType = {
|
|
|
144
156
|
* @param context: The additional context to send.
|
|
145
157
|
* @param timestampMs: The timestamp when the resource stopped (in milliseconds). If not provided, current timestamp will be used.
|
|
146
158
|
*/
|
|
147
|
-
stopResource(key: string, statusCode: number, kind:
|
|
159
|
+
stopResource(key: string, statusCode: number, kind: ResourceKind, size?: number, context?: object, timestampMs?: number): Promise<void>;
|
|
148
160
|
/**
|
|
149
161
|
* Add a RUM Error.
|
|
150
162
|
* @param message: The error message.
|
|
151
|
-
* @param source: The error source (network, source, console,
|
|
163
|
+
* @param source: The error source (network, source, console, webview, custom).
|
|
152
164
|
* @param stacktrace: The error stacktrace.
|
|
153
165
|
* @param context: The additional context to send.
|
|
154
166
|
* @param timestampMs: The timestamp when the error occurred (in milliseconds). If not provided, current timestamp will be used.
|
|
155
167
|
*/
|
|
156
|
-
addError(message: string, source:
|
|
168
|
+
addError(message: string, source: ErrorSource, stacktrace: string, context?: object, timestampMs?: number): Promise<void>;
|
|
157
169
|
/**
|
|
158
170
|
* 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.
|
|
159
171
|
* @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.
|
|
160
172
|
*/
|
|
161
173
|
addTiming(name: string): Promise<void>;
|
|
162
174
|
};
|
|
175
|
+
/**
|
|
176
|
+
* Describe the type of a RUM Action.
|
|
177
|
+
*/
|
|
178
|
+
export declare enum RumActionType {
|
|
179
|
+
/** User tapped on a widget. */
|
|
180
|
+
TAP = "TAP",
|
|
181
|
+
/** User scrolled a view. */
|
|
182
|
+
SCROLL = "SCROLL",
|
|
183
|
+
/** User swiped on a view. */
|
|
184
|
+
SWIPE = "SWIPE",
|
|
185
|
+
/** User pressed hardware back button (Android only). */
|
|
186
|
+
BACK = "BACK",
|
|
187
|
+
/** A custom action. */
|
|
188
|
+
CUSTOM = "CUSTOM"
|
|
189
|
+
}
|
|
190
|
+
export declare type ResourceKind = 'image' | 'xhr' | 'beacon' | 'css' | 'document' | 'fetch' | 'font' | 'js' | 'media' | 'other' | 'native';
|
|
191
|
+
export declare enum ErrorSource {
|
|
192
|
+
NETWORK = "NETWORK",
|
|
193
|
+
SOURCE = "SOURCE",
|
|
194
|
+
CONSOLE = "CONSOLE",
|
|
195
|
+
WEBVIEW = "WEBVIEW",
|
|
196
|
+
CUSTOM = "CUSTOM"
|
|
197
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "1.
|
|
1
|
+
export declare const version = "1.1.0";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@datadog/mobile-react-native-navigation",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "A client-side React Native module to interact with Datadog",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"datadog",
|
|
@@ -33,10 +33,10 @@
|
|
|
33
33
|
"scripts": {
|
|
34
34
|
"test": "jest",
|
|
35
35
|
"lint": "eslint .",
|
|
36
|
-
"prepare": "bob build"
|
|
36
|
+
"prepare": "rm -rf lib && yarn bob build"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@datadog/mobile-react-native": "^1.
|
|
39
|
+
"@datadog/mobile-react-native": "^1.1.0",
|
|
40
40
|
"react-native-gesture-handler": "1.10.3",
|
|
41
41
|
"react-native-navigation": "7.13.0"
|
|
42
42
|
},
|
|
@@ -70,5 +70,5 @@
|
|
|
70
70
|
]
|
|
71
71
|
]
|
|
72
72
|
},
|
|
73
|
-
"gitHead": "
|
|
73
|
+
"gitHead": "ca7c8d5d4969a8e8324bd0a7882eba11e6ef41ff"
|
|
74
74
|
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
/// <reference types="react-native" />
|
|
2
|
-
import type { DdRumResourceTracingAttributes } from './DdRumXhr';
|
|
3
|
-
export declare const TRACE_ID_HEADER_KEY = "x-datadog-trace-id";
|
|
4
|
-
export declare const PARENT_ID_HEADER_KEY = "x-datadog-parent-id";
|
|
5
|
-
export declare const ORIGIN_HEADER_KEY = "x-datadog-origin";
|
|
6
|
-
export declare const SAMPLING_PRIORITY_HEADER_KEY = "x-datadog-sampling-priority";
|
|
7
|
-
export declare const ORIGIN_RUM = "rum";
|
|
8
|
-
export declare const RESOURCE_SIZE_ERROR_MESSAGE = "Couldn't get resource size, because an error occured: ";
|
|
9
|
-
export declare function calculateResponseSize(xhr: XMLHttpRequest): number;
|
|
10
|
-
/**
|
|
11
|
-
* Provides RUM auto-instrumentation feature to track resources (fetch, XHR, axios) as RUM events.
|
|
12
|
-
*/
|
|
13
|
-
export declare class DdRumResourceTracking {
|
|
14
|
-
private static isTracking;
|
|
15
|
-
private static tracingSamplingRate;
|
|
16
|
-
private static firstPartyHostsRegex;
|
|
17
|
-
private static originalXhrOpen;
|
|
18
|
-
private static originalXhrSend;
|
|
19
|
-
/**
|
|
20
|
-
* Starts tracking resources and sends a RUM Resource event every time a network request is detected.
|
|
21
|
-
*/
|
|
22
|
-
static startTracking({ tracingSamplingRate, firstPartyHosts }: {
|
|
23
|
-
tracingSamplingRate: number;
|
|
24
|
-
firstPartyHosts: string[];
|
|
25
|
-
}): void;
|
|
26
|
-
/**
|
|
27
|
-
* Starts tracking resources and sends a RUM Resource event every time a fetch or XHR call is detected.
|
|
28
|
-
*/
|
|
29
|
-
static startTrackingInternal(xhrType: typeof XMLHttpRequest, { tracingSamplingRate, firstPartyHosts }: {
|
|
30
|
-
tracingSamplingRate: number;
|
|
31
|
-
firstPartyHosts: string[];
|
|
32
|
-
}): void;
|
|
33
|
-
static stopTracking(): void;
|
|
34
|
-
static getTracingAttributes(url: string): DdRumResourceTracingAttributes;
|
|
35
|
-
static proxyXhr(xhrType: any): void;
|
|
36
|
-
private static proxyOpen;
|
|
37
|
-
private static proxySend;
|
|
38
|
-
private static proxyOnReadyStateChange;
|
|
39
|
-
private static reportXhr;
|
|
40
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/// <reference types="react-native" />
|
|
2
|
-
import type Timer from '../../Timer';
|
|
3
|
-
export interface DdRumXhr extends XMLHttpRequest {
|
|
4
|
-
_datadog_xhr: DdRumXhrContext;
|
|
5
|
-
}
|
|
6
|
-
export interface DdRumXhrContext {
|
|
7
|
-
method: string;
|
|
8
|
-
url: string;
|
|
9
|
-
reported: boolean;
|
|
10
|
-
timer: Timer;
|
|
11
|
-
tracingAttributes: DdRumResourceTracingAttributes;
|
|
12
|
-
}
|
|
13
|
-
export declare type DdRumResourceTracingAttributes = {
|
|
14
|
-
tracingStrategy: 'KEEP';
|
|
15
|
-
traceId: string;
|
|
16
|
-
spanId: string;
|
|
17
|
-
samplingPriorityHeader: '1';
|
|
18
|
-
} | {
|
|
19
|
-
tracingStrategy: 'DISCARD';
|
|
20
|
-
traceId?: void;
|
|
21
|
-
spanId?: void;
|
|
22
|
-
samplingPriorityHeader: '0';
|
|
23
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function generateTraceId(): string;
|