@datadog/mobile-react-native-navigation 1.0.0-rc8 → 1.0.0-rc9

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 (17) hide show
  1. package/lib/typescript/core/src/rum/instrumentation/resourceTracking/DdRumResourceTracking.d.ts +15 -0
  2. package/lib/typescript/core/src/rum/instrumentation/resourceTracking/domain/distributedTracing.d.ts +18 -0
  3. package/lib/typescript/core/src/rum/instrumentation/resourceTracking/domain/firstPartyHosts.d.ts +6 -0
  4. package/lib/typescript/core/src/rum/instrumentation/resourceTracking/domain/interfaces/RequestProxy.d.ts +8 -0
  5. package/lib/typescript/core/src/rum/instrumentation/resourceTracking/domain/interfaces/RumResource.d.ts +19 -0
  6. package/lib/typescript/core/src/rum/instrumentation/resourceTracking/implementation/DatadogRumResource/ResourceReporter.d.ts +8 -0
  7. package/lib/typescript/core/src/rum/instrumentation/resourceTracking/implementation/DatadogRumResource/internalDevResourceBlocklist.d.ts +6 -0
  8. package/lib/typescript/core/src/rum/instrumentation/resourceTracking/implementation/DatadogRumResource/resourceTiming.d.ts +17 -0
  9. package/lib/typescript/core/src/rum/instrumentation/resourceTracking/implementation/URLHostParser.d.ts +6 -0
  10. package/lib/typescript/core/src/rum/instrumentation/resourceTracking/implementation/XHRProxy.d.ts +25 -0
  11. package/lib/typescript/core/src/rum/instrumentation/resourceTracking/implementation/responseSize.d.ts +3 -0
  12. package/lib/typescript/core/src/version.d.ts +1 -1
  13. package/package.json +3 -3
  14. package/lib/typescript/core/src/rum/instrumentation/DdRumResourceTracking.d.ts +0 -40
  15. package/lib/typescript/core/src/rum/instrumentation/DdRumXhr.d.ts +0 -23
  16. package/lib/typescript/core/src/rum/instrumentation/TraceIdentifier.d.ts +0 -1
  17. package/lib/typescript/core/src/rum/instrumentation/URLHostParser.d.ts +0 -6
@@ -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
+ }
@@ -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;
@@ -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,8 @@
1
+ export interface RequestProxyOptions {
2
+ tracingSamplingRate: number;
3
+ firstPartyHostsRegex: RegExp;
4
+ }
5
+ export declare abstract class RequestProxy {
6
+ abstract onTrackingStart: (context: RequestProxyOptions) => void;
7
+ abstract onTrackingStop: () => void;
8
+ }
@@ -0,0 +1,19 @@
1
+ import type { DdRumResourceTracingAttributes } from '../distributedTracing';
2
+ export interface RUMResource {
3
+ key: string;
4
+ request: {
5
+ method: string;
6
+ url: string;
7
+ kind: string;
8
+ };
9
+ tracingAttributes: DdRumResourceTracingAttributes;
10
+ response: {
11
+ statusCode: number;
12
+ size: number;
13
+ };
14
+ timings: {
15
+ startTime: number;
16
+ stopTime: number;
17
+ responseStartTime?: number;
18
+ };
19
+ }
@@ -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 {};
@@ -0,0 +1,6 @@
1
+ import type { Hostname } from '../domain/firstPartyHosts';
2
+ /**
3
+ * Returns the host from an URL.
4
+ * @returns the host (without the port) or null if could not cast the URL as host
5
+ */
6
+ export declare const URLHostParser: (url: string) => Hostname | null;
@@ -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 {};
@@ -0,0 +1,3 @@
1
+ /// <reference types="react-native" />
2
+ export declare const RESOURCE_SIZE_ERROR_MESSAGE = "Couldn't get resource size, because an error occured: ";
3
+ export declare function calculateResponseSize(xhr: XMLHttpRequest): number;
@@ -1 +1 @@
1
- export declare const version = "1.0.0-rc8";
1
+ export declare const version = "1.0.0-rc9";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datadog/mobile-react-native-navigation",
3
- "version": "1.0.0-rc8",
3
+ "version": "1.0.0-rc9",
4
4
  "description": "A client-side React Native module to interact with Datadog",
5
5
  "keywords": [
6
6
  "datadog",
@@ -36,7 +36,7 @@
36
36
  "prepare": "bob build"
37
37
  },
38
38
  "devDependencies": {
39
- "@datadog/mobile-react-native": "^1.0.0-rc8",
39
+ "@datadog/mobile-react-native": "^1.0.0-rc9",
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": "67456f90ac95007f8f99beb065ccbf6ec9a6f478"
73
+ "gitHead": "552457ced3fc826cb42120402eb9e98f80228890"
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;
@@ -1,6 +0,0 @@
1
- /**
2
- * Returns the host from an URL.
3
- * @returns the host (without the port)
4
- * @throws if URL is not well formatted
5
- */
6
- export declare const URLHostParser: (url: string) => string;