@logbrew/react-native 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +407 -18
- package/apollo.cjs +301 -0
- package/apollo.d.cts +70 -0
- package/apollo.d.ts +70 -0
- package/apollo.js +294 -0
- package/examples/apollo-link-spans.mjs +149 -0
- package/examples/index.mjs +29 -1
- package/examples/instrumentation-kit.mjs +304 -0
- package/examples/lifecycle-spans.mjs +131 -0
- package/examples/native-bridge-scope.mjs +107 -0
- package/examples/navigation-resource-spans.mjs +156 -0
- package/examples/package.json +8 -1
- package/examples/real-user-smoke.mjs +106 -9
- package/examples/resource-fetch-spans.mjs +133 -0
- package/examples/trace-correlation.mjs +135 -0
- package/index.cjs +625 -111
- package/index.d.cts +236 -0
- package/index.d.ts +236 -0
- package/index.js +613 -95
- package/index.native.js +18 -0
- package/instrumentation.cjs +639 -0
- package/instrumentation.d.cts +84 -0
- package/instrumentation.d.ts +84 -0
- package/instrumentation.js +634 -0
- package/lifecycle.cjs +129 -0
- package/lifecycle.d.cts +50 -0
- package/lifecycle.d.ts +50 -0
- package/lifecycle.js +121 -0
- package/metadata.cjs +175 -0
- package/metadata.js +165 -0
- package/metro.cjs +310 -0
- package/metro.d.cts +37 -0
- package/metro.d.ts +37 -0
- package/metro.js +6 -0
- package/native-bridge.cjs +127 -0
- package/native-bridge.d.cts +60 -0
- package/native-bridge.d.ts +60 -0
- package/native-bridge.js +125 -0
- package/package.json +113 -4
- package/release-artifacts.cjs +344 -0
- package/release-artifacts.d.cts +55 -0
- package/release-artifacts.d.ts +53 -0
- package/release-artifacts.js +8 -0
- package/resource-fetch.cjs +469 -0
- package/resource-fetch.d.cts +60 -0
- package/resource-fetch.d.ts +60 -0
- package/resource-fetch.js +464 -0
package/index.d.cts
CHANGED
|
@@ -46,6 +46,30 @@ export type ReactNativeTraceparentConfig = {
|
|
|
46
46
|
randomValues?: (length: number) => ArrayLike<number>;
|
|
47
47
|
};
|
|
48
48
|
|
|
49
|
+
export type ReactNativeTraceContext = {
|
|
50
|
+
traceId: string;
|
|
51
|
+
spanId: string;
|
|
52
|
+
parentSpanId?: string;
|
|
53
|
+
traceFlags: string;
|
|
54
|
+
sampled: boolean;
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
export type ReactNativeTraceInput = ReactNativeTraceContext | string;
|
|
58
|
+
|
|
59
|
+
export type ReactNativeTraceContextConfig = ReactNativeTraceparentConfig & {
|
|
60
|
+
parentSpanId?: string;
|
|
61
|
+
traceparent?: string;
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
export type ReactNativeSpanAttributesInput = {
|
|
65
|
+
durationMs?: number;
|
|
66
|
+
metadata?: Metadata;
|
|
67
|
+
name?: string;
|
|
68
|
+
spanId?: string;
|
|
69
|
+
status?: SpanAttributes["status"];
|
|
70
|
+
trace?: ReactNativeTraceInput;
|
|
71
|
+
};
|
|
72
|
+
|
|
49
73
|
export type TraceparentFetchLike<TResponse = unknown> = (
|
|
50
74
|
input: any,
|
|
51
75
|
init?: any
|
|
@@ -54,6 +78,7 @@ export type TraceparentFetchLike<TResponse = unknown> = (
|
|
|
54
78
|
export type TraceparentFetchConfig<TResponse = unknown> = {
|
|
55
79
|
fetchImpl?: TraceparentFetchLike<TResponse>;
|
|
56
80
|
randomValues?: (length: number) => ArrayLike<number>;
|
|
81
|
+
trace?: ReactNativeTraceInput;
|
|
57
82
|
traceFlags?: string;
|
|
58
83
|
traceparent?: string;
|
|
59
84
|
traceparentFactory?: (context: {
|
|
@@ -64,10 +89,26 @@ export type TraceparentFetchConfig<TResponse = unknown> = {
|
|
|
64
89
|
tracePropagationTargets?: TracePropagationTarget[];
|
|
65
90
|
};
|
|
66
91
|
|
|
92
|
+
export type ReactNavigationRouteLike = {
|
|
93
|
+
key?: string | number | null;
|
|
94
|
+
name?: string | null;
|
|
95
|
+
path?: string | null;
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
export type ReactNavigationContainerLike = {
|
|
99
|
+
current?: ReactNavigationContainerLike | null;
|
|
100
|
+
addListener(
|
|
101
|
+
eventName: string,
|
|
102
|
+
listener: (event?: unknown) => void
|
|
103
|
+
): { remove(): void } | (() => void) | void;
|
|
104
|
+
getCurrentRoute(): ReactNavigationRouteLike | undefined | null;
|
|
105
|
+
};
|
|
106
|
+
|
|
67
107
|
export type ReactNativeContextOptions = {
|
|
68
108
|
platform?: ReactNativePlatformLike;
|
|
69
109
|
appState?: ReactNativeAppStateLike;
|
|
70
110
|
metadata?: Metadata;
|
|
111
|
+
trace?: ReactNativeTraceInput;
|
|
71
112
|
};
|
|
72
113
|
|
|
73
114
|
export type CaptureScreenViewOptions = ReactNativeContextOptions & {
|
|
@@ -81,6 +122,112 @@ export type CaptureAppStateChangeOptions = ReactNativeContextOptions & {
|
|
|
81
122
|
timestamp?: string;
|
|
82
123
|
};
|
|
83
124
|
|
|
125
|
+
export type ReactNativeActionEvent = {
|
|
126
|
+
id: string;
|
|
127
|
+
timestamp: string;
|
|
128
|
+
attributes: ActionAttributes;
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
export type ReactNativeActionInput = ReactNativeContextOptions & {
|
|
132
|
+
id?: string;
|
|
133
|
+
idFactory?: (context: ReactNativeActionIdFactoryContext) => string;
|
|
134
|
+
name?: string;
|
|
135
|
+
now?: () => string;
|
|
136
|
+
screen?: string;
|
|
137
|
+
sessionId?: string;
|
|
138
|
+
status?: ActionAttributes["status"];
|
|
139
|
+
timestamp?: string;
|
|
140
|
+
traceId?: string;
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
export type ReactNativeActionIdFactoryContext = {
|
|
144
|
+
name?: string;
|
|
145
|
+
screen?: string;
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
export type ReactNativeNetworkInput = ReactNativeContextOptions & {
|
|
149
|
+
durationMs?: number;
|
|
150
|
+
id?: string;
|
|
151
|
+
idFactory?: (context: ReactNativeNetworkIdFactoryContext) => string;
|
|
152
|
+
method?: string;
|
|
153
|
+
name?: string;
|
|
154
|
+
now?: () => string;
|
|
155
|
+
routeTemplate?: string;
|
|
156
|
+
screen?: string;
|
|
157
|
+
sessionId?: string;
|
|
158
|
+
status?: ActionAttributes["status"];
|
|
159
|
+
statusCode?: number;
|
|
160
|
+
timestamp?: string;
|
|
161
|
+
traceId?: string;
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
export type ReactNativeNetworkIdFactoryContext = {
|
|
165
|
+
method?: string;
|
|
166
|
+
routeTemplate?: string;
|
|
167
|
+
screen?: string;
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
export type ReactNativeSpanEvent = {
|
|
171
|
+
id: string;
|
|
172
|
+
timestamp: string;
|
|
173
|
+
attributes: SpanAttributes;
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
export type ReactNativeNavigationSpanInput = ReactNativeContextOptions & {
|
|
177
|
+
actionType?: string;
|
|
178
|
+
durationMs?: number;
|
|
179
|
+
id?: string;
|
|
180
|
+
idFactory?: (context: ReactNativeNavigationSpanIdFactoryContext) => string;
|
|
181
|
+
includeRouteKey?: boolean;
|
|
182
|
+
name?: string;
|
|
183
|
+
now?: () => string;
|
|
184
|
+
previousRouteKey?: string | number | null;
|
|
185
|
+
previousRouteName?: string;
|
|
186
|
+
routeKey?: string | number | null;
|
|
187
|
+
routeName?: string;
|
|
188
|
+
routePath?: string;
|
|
189
|
+
screen?: string;
|
|
190
|
+
status?: SpanAttributes["status"];
|
|
191
|
+
timestamp?: string;
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
export type ReactNativeNavigationSpanIdFactoryContext = {
|
|
195
|
+
routeName?: string;
|
|
196
|
+
routePath?: string;
|
|
197
|
+
screen?: string;
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
export type ReactNativeResourceSpanInput = ReactNativeContextOptions & {
|
|
201
|
+
durationMs?: number;
|
|
202
|
+
id?: string;
|
|
203
|
+
idFactory?: (context: ReactNativeResourceSpanIdFactoryContext) => string;
|
|
204
|
+
kind?: string;
|
|
205
|
+
method?: string;
|
|
206
|
+
name?: string;
|
|
207
|
+
now?: () => string;
|
|
208
|
+
responseSizeBytes?: number;
|
|
209
|
+
routeTemplate?: string;
|
|
210
|
+
screen?: string;
|
|
211
|
+
sessionId?: string;
|
|
212
|
+
status?: SpanAttributes["status"];
|
|
213
|
+
statusCode?: number;
|
|
214
|
+
timestamp?: string;
|
|
215
|
+
};
|
|
216
|
+
|
|
217
|
+
export type ReactNativeResourceSpanIdFactoryContext = {
|
|
218
|
+
method?: string;
|
|
219
|
+
routeTemplate?: string;
|
|
220
|
+
screen?: string;
|
|
221
|
+
};
|
|
222
|
+
|
|
223
|
+
export type ReactNavigationSpanListenerOptions = ReactNativeContextOptions & {
|
|
224
|
+
captureInitialRoute?: boolean;
|
|
225
|
+
includeRouteKey?: boolean;
|
|
226
|
+
now?: () => string;
|
|
227
|
+
nowMs?: () => number;
|
|
228
|
+
onError?: (error: unknown) => void;
|
|
229
|
+
};
|
|
230
|
+
|
|
84
231
|
export type ReactNativeErrorEvent = {
|
|
85
232
|
id: string;
|
|
86
233
|
timestamp: string;
|
|
@@ -94,12 +241,18 @@ export type ReactNativeErrorIdFactoryContext = {
|
|
|
94
241
|
};
|
|
95
242
|
|
|
96
243
|
export type CaptureReactNativeErrorOptions = ReactNativeContextOptions & {
|
|
244
|
+
debugIdMap?: Record<string, string>;
|
|
245
|
+
environment?: string;
|
|
246
|
+
fingerprint?: string;
|
|
97
247
|
id?: string;
|
|
98
248
|
idFactory?: (context: ReactNativeErrorIdFactoryContext) => string;
|
|
99
249
|
includeStack?: boolean;
|
|
100
250
|
level?: IssueAttributes["level"];
|
|
101
251
|
now?: () => string;
|
|
252
|
+
release?: string;
|
|
253
|
+
runtime?: string;
|
|
102
254
|
screen?: string;
|
|
255
|
+
service?: string;
|
|
103
256
|
timestamp?: string;
|
|
104
257
|
};
|
|
105
258
|
|
|
@@ -107,6 +260,7 @@ export type LogBrewNativeProviderProps = {
|
|
|
107
260
|
client: LogBrewClient;
|
|
108
261
|
platform?: ReactNativePlatformLike;
|
|
109
262
|
appState?: ReactNativeAppStateLike;
|
|
263
|
+
trace?: ReactNativeTraceInput;
|
|
110
264
|
children?: React.ReactNode;
|
|
111
265
|
};
|
|
112
266
|
|
|
@@ -114,6 +268,7 @@ export type LogBrewNativeContextValue = {
|
|
|
114
268
|
client: LogBrewClient;
|
|
115
269
|
platform?: ReactNativePlatformLike;
|
|
116
270
|
appState?: ReactNativeAppStateLike;
|
|
271
|
+
trace?: ReactNativeTraceContext;
|
|
117
272
|
};
|
|
118
273
|
|
|
119
274
|
export type LogBrewNativeActions = {
|
|
@@ -127,8 +282,13 @@ export type LogBrewNativeActions = {
|
|
|
127
282
|
shutdown(transport: Transport): Promise<TransportResponse>;
|
|
128
283
|
previewJson(): string;
|
|
129
284
|
pendingEvents(): number;
|
|
285
|
+
trace?: ReactNativeTraceContext;
|
|
130
286
|
captureScreenView(screenName: string, options?: CaptureScreenViewOptions): void;
|
|
131
287
|
captureAppStateChange(state: string, options?: CaptureAppStateChangeOptions): void;
|
|
288
|
+
captureReactNativeAction(input?: ReactNativeActionInput): ReactNativeActionEvent;
|
|
289
|
+
captureReactNativeNetwork(input?: ReactNativeNetworkInput): ReactNativeActionEvent;
|
|
290
|
+
captureReactNativeNavigationSpan(input?: ReactNativeNavigationSpanInput): ReactNativeSpanEvent;
|
|
291
|
+
captureReactNativeResourceSpan(input?: ReactNativeResourceSpanInput): ReactNativeSpanEvent;
|
|
132
292
|
captureReactNativeError(error: unknown, options?: CaptureReactNativeErrorOptions): ReactNativeErrorEvent;
|
|
133
293
|
};
|
|
134
294
|
|
|
@@ -136,6 +296,25 @@ export declare function createLogBrewReactNativeClient(
|
|
|
136
296
|
config: CreateLogBrewReactNativeClientConfig
|
|
137
297
|
): LogBrewClient;
|
|
138
298
|
export declare function createReactNativeTraceparent(config?: ReactNativeTraceparentConfig): string;
|
|
299
|
+
export declare function createReactNativeTraceContext(
|
|
300
|
+
config?: ReactNativeTraceContextConfig
|
|
301
|
+
): ReactNativeTraceContext;
|
|
302
|
+
export declare function getActiveLogBrewTrace(): ReactNativeTraceContext | undefined;
|
|
303
|
+
export declare function withLogBrewTrace<T>(
|
|
304
|
+
trace: ReactNativeTraceInput | undefined,
|
|
305
|
+
callback: (trace: ReactNativeTraceContext) => T
|
|
306
|
+
): T;
|
|
307
|
+
export declare function bindLogBrewTrace<TArgs extends unknown[], TResult>(
|
|
308
|
+
trace: ReactNativeTraceInput | undefined,
|
|
309
|
+
callback: (...args: TArgs) => TResult
|
|
310
|
+
): (...args: TArgs) => TResult;
|
|
311
|
+
export declare function getReactNativeTraceMetadata(trace?: ReactNativeTraceInput): Metadata;
|
|
312
|
+
export declare function createReactNativeSpanAttributes(
|
|
313
|
+
input?: ReactNativeSpanAttributesInput
|
|
314
|
+
): SpanAttributes;
|
|
315
|
+
export declare function createReactNativeTraceHeaders(
|
|
316
|
+
trace?: ReactNativeTraceInput
|
|
317
|
+
): { traceparent: string };
|
|
139
318
|
export declare function createTraceparentFetch<TResponse = unknown>(
|
|
140
319
|
config?: TraceparentFetchConfig<TResponse>
|
|
141
320
|
): TraceparentFetchLike<TResponse>;
|
|
@@ -154,6 +333,39 @@ export declare function captureAppStateChange(
|
|
|
154
333
|
state: string,
|
|
155
334
|
options?: CaptureAppStateChangeOptions
|
|
156
335
|
): void;
|
|
336
|
+
export declare function createReactNativeActionEvent(
|
|
337
|
+
input?: ReactNativeActionInput
|
|
338
|
+
): ReactNativeActionEvent;
|
|
339
|
+
export declare function captureReactNativeAction(
|
|
340
|
+
client: LogBrewClient,
|
|
341
|
+
input?: ReactNativeActionInput
|
|
342
|
+
): ReactNativeActionEvent;
|
|
343
|
+
export declare function createReactNativeNetworkEvent(
|
|
344
|
+
input?: ReactNativeNetworkInput
|
|
345
|
+
): ReactNativeActionEvent;
|
|
346
|
+
export declare function captureReactNativeNetwork(
|
|
347
|
+
client: LogBrewClient,
|
|
348
|
+
input?: ReactNativeNetworkInput
|
|
349
|
+
): ReactNativeActionEvent;
|
|
350
|
+
export declare function createReactNativeNavigationSpanEvent(
|
|
351
|
+
input?: ReactNativeNavigationSpanInput
|
|
352
|
+
): ReactNativeSpanEvent;
|
|
353
|
+
export declare function captureReactNativeNavigationSpan(
|
|
354
|
+
client: LogBrewClient,
|
|
355
|
+
input?: ReactNativeNavigationSpanInput
|
|
356
|
+
): ReactNativeSpanEvent;
|
|
357
|
+
export declare function createReactNativeResourceSpanEvent(
|
|
358
|
+
input?: ReactNativeResourceSpanInput
|
|
359
|
+
): ReactNativeSpanEvent;
|
|
360
|
+
export declare function captureReactNativeResourceSpan(
|
|
361
|
+
client: LogBrewClient,
|
|
362
|
+
input?: ReactNativeResourceSpanInput
|
|
363
|
+
): ReactNativeSpanEvent;
|
|
364
|
+
export declare function createReactNavigationSpanListener(
|
|
365
|
+
client: LogBrewClient,
|
|
366
|
+
navigationContainer: ReactNavigationContainerLike,
|
|
367
|
+
options?: ReactNavigationSpanListenerOptions
|
|
368
|
+
): () => void;
|
|
157
369
|
export declare function createReactNativeErrorEvent(
|
|
158
370
|
error: unknown,
|
|
159
371
|
options?: CaptureReactNativeErrorOptions
|
|
@@ -186,6 +398,14 @@ export declare function captureDefaultAppStateChange(
|
|
|
186
398
|
state: string,
|
|
187
399
|
options?: Omit<CaptureAppStateChangeOptions, "platform" | "appState">
|
|
188
400
|
): void;
|
|
401
|
+
export declare function captureDefaultReactNativeAction(
|
|
402
|
+
client: LogBrewClient,
|
|
403
|
+
input?: Omit<ReactNativeActionInput, "platform" | "appState">
|
|
404
|
+
): ReactNativeActionEvent;
|
|
405
|
+
export declare function captureDefaultReactNativeNetwork(
|
|
406
|
+
client: LogBrewClient,
|
|
407
|
+
input?: Omit<ReactNativeNetworkInput, "platform" | "appState">
|
|
408
|
+
): ReactNativeActionEvent;
|
|
189
409
|
export declare function captureDefaultReactNativeError(
|
|
190
410
|
client: LogBrewClient,
|
|
191
411
|
error: unknown,
|
|
@@ -198,18 +418,34 @@ export declare function createDefaultAppStateListener(
|
|
|
198
418
|
|
|
199
419
|
declare const defaultExport: {
|
|
200
420
|
LogBrewNativeProvider: typeof LogBrewNativeProvider;
|
|
421
|
+
bindLogBrewTrace: typeof bindLogBrewTrace;
|
|
201
422
|
captureAppStateChange: typeof captureAppStateChange;
|
|
423
|
+
captureReactNativeAction: typeof captureReactNativeAction;
|
|
202
424
|
captureReactNativeError: typeof captureReactNativeError;
|
|
425
|
+
captureReactNativeNetwork: typeof captureReactNativeNetwork;
|
|
426
|
+
captureReactNativeNavigationSpan: typeof captureReactNativeNavigationSpan;
|
|
427
|
+
captureReactNativeResourceSpan: typeof captureReactNativeResourceSpan;
|
|
203
428
|
captureScreenView: typeof captureScreenView;
|
|
204
429
|
createAppStateListener: typeof createAppStateListener;
|
|
205
430
|
createLogBrewReactNativeClient: typeof createLogBrewReactNativeClient;
|
|
431
|
+
createReactNavigationSpanListener: typeof createReactNavigationSpanListener;
|
|
432
|
+
createReactNativeSpanAttributes: typeof createReactNativeSpanAttributes;
|
|
433
|
+
createReactNativeTraceContext: typeof createReactNativeTraceContext;
|
|
434
|
+
createReactNativeTraceHeaders: typeof createReactNativeTraceHeaders;
|
|
435
|
+
createReactNativeActionEvent: typeof createReactNativeActionEvent;
|
|
206
436
|
createReactNativeErrorEvent: typeof createReactNativeErrorEvent;
|
|
437
|
+
createReactNativeNetworkEvent: typeof createReactNativeNetworkEvent;
|
|
438
|
+
createReactNativeNavigationSpanEvent: typeof createReactNativeNavigationSpanEvent;
|
|
439
|
+
createReactNativeResourceSpanEvent: typeof createReactNativeResourceSpanEvent;
|
|
207
440
|
createReactNativeTraceparent: typeof createReactNativeTraceparent;
|
|
208
441
|
createTraceparentFetch: typeof createTraceparentFetch;
|
|
442
|
+
getActiveLogBrewTrace: typeof getActiveLogBrewTrace;
|
|
209
443
|
getReactNativeContext: typeof getReactNativeContext;
|
|
444
|
+
getReactNativeTraceMetadata: typeof getReactNativeTraceMetadata;
|
|
210
445
|
shouldPropagateTraceparent: typeof shouldPropagateTraceparent;
|
|
211
446
|
useLogBrewNative: typeof useLogBrewNative;
|
|
212
447
|
useLogBrewNativeActions: typeof useLogBrewNativeActions;
|
|
448
|
+
withLogBrewTrace: typeof withLogBrewTrace;
|
|
213
449
|
};
|
|
214
450
|
|
|
215
451
|
export default defaultExport;
|
package/index.d.ts
CHANGED
|
@@ -46,6 +46,30 @@ export type ReactNativeTraceparentConfig = {
|
|
|
46
46
|
randomValues?: (length: number) => ArrayLike<number>;
|
|
47
47
|
};
|
|
48
48
|
|
|
49
|
+
export type ReactNativeTraceContext = {
|
|
50
|
+
traceId: string;
|
|
51
|
+
spanId: string;
|
|
52
|
+
parentSpanId?: string;
|
|
53
|
+
traceFlags: string;
|
|
54
|
+
sampled: boolean;
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
export type ReactNativeTraceInput = ReactNativeTraceContext | string;
|
|
58
|
+
|
|
59
|
+
export type ReactNativeTraceContextConfig = ReactNativeTraceparentConfig & {
|
|
60
|
+
parentSpanId?: string;
|
|
61
|
+
traceparent?: string;
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
export type ReactNativeSpanAttributesInput = {
|
|
65
|
+
durationMs?: number;
|
|
66
|
+
metadata?: Metadata;
|
|
67
|
+
name?: string;
|
|
68
|
+
spanId?: string;
|
|
69
|
+
status?: SpanAttributes["status"];
|
|
70
|
+
trace?: ReactNativeTraceInput;
|
|
71
|
+
};
|
|
72
|
+
|
|
49
73
|
export type TraceparentFetchLike<TResponse = unknown> = (
|
|
50
74
|
input: any,
|
|
51
75
|
init?: any
|
|
@@ -54,6 +78,7 @@ export type TraceparentFetchLike<TResponse = unknown> = (
|
|
|
54
78
|
export type TraceparentFetchConfig<TResponse = unknown> = {
|
|
55
79
|
fetchImpl?: TraceparentFetchLike<TResponse>;
|
|
56
80
|
randomValues?: (length: number) => ArrayLike<number>;
|
|
81
|
+
trace?: ReactNativeTraceInput;
|
|
57
82
|
traceFlags?: string;
|
|
58
83
|
traceparent?: string;
|
|
59
84
|
traceparentFactory?: (context: {
|
|
@@ -64,10 +89,26 @@ export type TraceparentFetchConfig<TResponse = unknown> = {
|
|
|
64
89
|
tracePropagationTargets?: TracePropagationTarget[];
|
|
65
90
|
};
|
|
66
91
|
|
|
92
|
+
export type ReactNavigationRouteLike = {
|
|
93
|
+
key?: string | number | null;
|
|
94
|
+
name?: string | null;
|
|
95
|
+
path?: string | null;
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
export type ReactNavigationContainerLike = {
|
|
99
|
+
current?: ReactNavigationContainerLike | null;
|
|
100
|
+
addListener(
|
|
101
|
+
eventName: string,
|
|
102
|
+
listener: (event?: unknown) => void
|
|
103
|
+
): { remove(): void } | (() => void) | void;
|
|
104
|
+
getCurrentRoute(): ReactNavigationRouteLike | undefined | null;
|
|
105
|
+
};
|
|
106
|
+
|
|
67
107
|
export type ReactNativeContextOptions = {
|
|
68
108
|
platform?: ReactNativePlatformLike;
|
|
69
109
|
appState?: ReactNativeAppStateLike;
|
|
70
110
|
metadata?: Metadata;
|
|
111
|
+
trace?: ReactNativeTraceInput;
|
|
71
112
|
};
|
|
72
113
|
|
|
73
114
|
export type CaptureScreenViewOptions = ReactNativeContextOptions & {
|
|
@@ -81,6 +122,112 @@ export type CaptureAppStateChangeOptions = ReactNativeContextOptions & {
|
|
|
81
122
|
timestamp?: string;
|
|
82
123
|
};
|
|
83
124
|
|
|
125
|
+
export type ReactNativeActionEvent = {
|
|
126
|
+
id: string;
|
|
127
|
+
timestamp: string;
|
|
128
|
+
attributes: ActionAttributes;
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
export type ReactNativeActionInput = ReactNativeContextOptions & {
|
|
132
|
+
id?: string;
|
|
133
|
+
idFactory?: (context: ReactNativeActionIdFactoryContext) => string;
|
|
134
|
+
name?: string;
|
|
135
|
+
now?: () => string;
|
|
136
|
+
screen?: string;
|
|
137
|
+
sessionId?: string;
|
|
138
|
+
status?: ActionAttributes["status"];
|
|
139
|
+
timestamp?: string;
|
|
140
|
+
traceId?: string;
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
export type ReactNativeActionIdFactoryContext = {
|
|
144
|
+
name?: string;
|
|
145
|
+
screen?: string;
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
export type ReactNativeNetworkInput = ReactNativeContextOptions & {
|
|
149
|
+
durationMs?: number;
|
|
150
|
+
id?: string;
|
|
151
|
+
idFactory?: (context: ReactNativeNetworkIdFactoryContext) => string;
|
|
152
|
+
method?: string;
|
|
153
|
+
name?: string;
|
|
154
|
+
now?: () => string;
|
|
155
|
+
routeTemplate?: string;
|
|
156
|
+
screen?: string;
|
|
157
|
+
sessionId?: string;
|
|
158
|
+
status?: ActionAttributes["status"];
|
|
159
|
+
statusCode?: number;
|
|
160
|
+
timestamp?: string;
|
|
161
|
+
traceId?: string;
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
export type ReactNativeNetworkIdFactoryContext = {
|
|
165
|
+
method?: string;
|
|
166
|
+
routeTemplate?: string;
|
|
167
|
+
screen?: string;
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
export type ReactNativeSpanEvent = {
|
|
171
|
+
id: string;
|
|
172
|
+
timestamp: string;
|
|
173
|
+
attributes: SpanAttributes;
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
export type ReactNativeNavigationSpanInput = ReactNativeContextOptions & {
|
|
177
|
+
actionType?: string;
|
|
178
|
+
durationMs?: number;
|
|
179
|
+
id?: string;
|
|
180
|
+
idFactory?: (context: ReactNativeNavigationSpanIdFactoryContext) => string;
|
|
181
|
+
includeRouteKey?: boolean;
|
|
182
|
+
name?: string;
|
|
183
|
+
now?: () => string;
|
|
184
|
+
previousRouteKey?: string | number | null;
|
|
185
|
+
previousRouteName?: string;
|
|
186
|
+
routeKey?: string | number | null;
|
|
187
|
+
routeName?: string;
|
|
188
|
+
routePath?: string;
|
|
189
|
+
screen?: string;
|
|
190
|
+
status?: SpanAttributes["status"];
|
|
191
|
+
timestamp?: string;
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
export type ReactNativeNavigationSpanIdFactoryContext = {
|
|
195
|
+
routeName?: string;
|
|
196
|
+
routePath?: string;
|
|
197
|
+
screen?: string;
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
export type ReactNativeResourceSpanInput = ReactNativeContextOptions & {
|
|
201
|
+
durationMs?: number;
|
|
202
|
+
id?: string;
|
|
203
|
+
idFactory?: (context: ReactNativeResourceSpanIdFactoryContext) => string;
|
|
204
|
+
kind?: string;
|
|
205
|
+
method?: string;
|
|
206
|
+
name?: string;
|
|
207
|
+
now?: () => string;
|
|
208
|
+
responseSizeBytes?: number;
|
|
209
|
+
routeTemplate?: string;
|
|
210
|
+
screen?: string;
|
|
211
|
+
sessionId?: string;
|
|
212
|
+
status?: SpanAttributes["status"];
|
|
213
|
+
statusCode?: number;
|
|
214
|
+
timestamp?: string;
|
|
215
|
+
};
|
|
216
|
+
|
|
217
|
+
export type ReactNativeResourceSpanIdFactoryContext = {
|
|
218
|
+
method?: string;
|
|
219
|
+
routeTemplate?: string;
|
|
220
|
+
screen?: string;
|
|
221
|
+
};
|
|
222
|
+
|
|
223
|
+
export type ReactNavigationSpanListenerOptions = ReactNativeContextOptions & {
|
|
224
|
+
captureInitialRoute?: boolean;
|
|
225
|
+
includeRouteKey?: boolean;
|
|
226
|
+
now?: () => string;
|
|
227
|
+
nowMs?: () => number;
|
|
228
|
+
onError?: (error: unknown) => void;
|
|
229
|
+
};
|
|
230
|
+
|
|
84
231
|
export type ReactNativeErrorEvent = {
|
|
85
232
|
id: string;
|
|
86
233
|
timestamp: string;
|
|
@@ -94,12 +241,18 @@ export type ReactNativeErrorIdFactoryContext = {
|
|
|
94
241
|
};
|
|
95
242
|
|
|
96
243
|
export type CaptureReactNativeErrorOptions = ReactNativeContextOptions & {
|
|
244
|
+
debugIdMap?: Record<string, string>;
|
|
245
|
+
environment?: string;
|
|
246
|
+
fingerprint?: string;
|
|
97
247
|
id?: string;
|
|
98
248
|
idFactory?: (context: ReactNativeErrorIdFactoryContext) => string;
|
|
99
249
|
includeStack?: boolean;
|
|
100
250
|
level?: IssueAttributes["level"];
|
|
101
251
|
now?: () => string;
|
|
252
|
+
release?: string;
|
|
253
|
+
runtime?: string;
|
|
102
254
|
screen?: string;
|
|
255
|
+
service?: string;
|
|
103
256
|
timestamp?: string;
|
|
104
257
|
};
|
|
105
258
|
|
|
@@ -107,6 +260,7 @@ export type LogBrewNativeProviderProps = {
|
|
|
107
260
|
client: LogBrewClient;
|
|
108
261
|
platform?: ReactNativePlatformLike;
|
|
109
262
|
appState?: ReactNativeAppStateLike;
|
|
263
|
+
trace?: ReactNativeTraceInput;
|
|
110
264
|
children?: React.ReactNode;
|
|
111
265
|
};
|
|
112
266
|
|
|
@@ -114,6 +268,7 @@ export type LogBrewNativeContextValue = {
|
|
|
114
268
|
client: LogBrewClient;
|
|
115
269
|
platform?: ReactNativePlatformLike;
|
|
116
270
|
appState?: ReactNativeAppStateLike;
|
|
271
|
+
trace?: ReactNativeTraceContext;
|
|
117
272
|
};
|
|
118
273
|
|
|
119
274
|
export type LogBrewNativeActions = {
|
|
@@ -127,8 +282,13 @@ export type LogBrewNativeActions = {
|
|
|
127
282
|
shutdown(transport: Transport): Promise<TransportResponse>;
|
|
128
283
|
previewJson(): string;
|
|
129
284
|
pendingEvents(): number;
|
|
285
|
+
trace?: ReactNativeTraceContext;
|
|
130
286
|
captureScreenView(screenName: string, options?: CaptureScreenViewOptions): void;
|
|
131
287
|
captureAppStateChange(state: string, options?: CaptureAppStateChangeOptions): void;
|
|
288
|
+
captureReactNativeAction(input?: ReactNativeActionInput): ReactNativeActionEvent;
|
|
289
|
+
captureReactNativeNetwork(input?: ReactNativeNetworkInput): ReactNativeActionEvent;
|
|
290
|
+
captureReactNativeNavigationSpan(input?: ReactNativeNavigationSpanInput): ReactNativeSpanEvent;
|
|
291
|
+
captureReactNativeResourceSpan(input?: ReactNativeResourceSpanInput): ReactNativeSpanEvent;
|
|
132
292
|
captureReactNativeError(error: unknown, options?: CaptureReactNativeErrorOptions): ReactNativeErrorEvent;
|
|
133
293
|
};
|
|
134
294
|
|
|
@@ -136,6 +296,25 @@ export declare function createLogBrewReactNativeClient(
|
|
|
136
296
|
config: CreateLogBrewReactNativeClientConfig
|
|
137
297
|
): LogBrewClient;
|
|
138
298
|
export declare function createReactNativeTraceparent(config?: ReactNativeTraceparentConfig): string;
|
|
299
|
+
export declare function createReactNativeTraceContext(
|
|
300
|
+
config?: ReactNativeTraceContextConfig
|
|
301
|
+
): ReactNativeTraceContext;
|
|
302
|
+
export declare function getActiveLogBrewTrace(): ReactNativeTraceContext | undefined;
|
|
303
|
+
export declare function withLogBrewTrace<T>(
|
|
304
|
+
trace: ReactNativeTraceInput | undefined,
|
|
305
|
+
callback: (trace: ReactNativeTraceContext) => T
|
|
306
|
+
): T;
|
|
307
|
+
export declare function bindLogBrewTrace<TArgs extends unknown[], TResult>(
|
|
308
|
+
trace: ReactNativeTraceInput | undefined,
|
|
309
|
+
callback: (...args: TArgs) => TResult
|
|
310
|
+
): (...args: TArgs) => TResult;
|
|
311
|
+
export declare function getReactNativeTraceMetadata(trace?: ReactNativeTraceInput): Metadata;
|
|
312
|
+
export declare function createReactNativeSpanAttributes(
|
|
313
|
+
input?: ReactNativeSpanAttributesInput
|
|
314
|
+
): SpanAttributes;
|
|
315
|
+
export declare function createReactNativeTraceHeaders(
|
|
316
|
+
trace?: ReactNativeTraceInput
|
|
317
|
+
): { traceparent: string };
|
|
139
318
|
export declare function createTraceparentFetch<TResponse = unknown>(
|
|
140
319
|
config?: TraceparentFetchConfig<TResponse>
|
|
141
320
|
): TraceparentFetchLike<TResponse>;
|
|
@@ -154,6 +333,39 @@ export declare function captureAppStateChange(
|
|
|
154
333
|
state: string,
|
|
155
334
|
options?: CaptureAppStateChangeOptions
|
|
156
335
|
): void;
|
|
336
|
+
export declare function createReactNativeActionEvent(
|
|
337
|
+
input?: ReactNativeActionInput
|
|
338
|
+
): ReactNativeActionEvent;
|
|
339
|
+
export declare function captureReactNativeAction(
|
|
340
|
+
client: LogBrewClient,
|
|
341
|
+
input?: ReactNativeActionInput
|
|
342
|
+
): ReactNativeActionEvent;
|
|
343
|
+
export declare function createReactNativeNetworkEvent(
|
|
344
|
+
input?: ReactNativeNetworkInput
|
|
345
|
+
): ReactNativeActionEvent;
|
|
346
|
+
export declare function captureReactNativeNetwork(
|
|
347
|
+
client: LogBrewClient,
|
|
348
|
+
input?: ReactNativeNetworkInput
|
|
349
|
+
): ReactNativeActionEvent;
|
|
350
|
+
export declare function createReactNativeNavigationSpanEvent(
|
|
351
|
+
input?: ReactNativeNavigationSpanInput
|
|
352
|
+
): ReactNativeSpanEvent;
|
|
353
|
+
export declare function captureReactNativeNavigationSpan(
|
|
354
|
+
client: LogBrewClient,
|
|
355
|
+
input?: ReactNativeNavigationSpanInput
|
|
356
|
+
): ReactNativeSpanEvent;
|
|
357
|
+
export declare function createReactNativeResourceSpanEvent(
|
|
358
|
+
input?: ReactNativeResourceSpanInput
|
|
359
|
+
): ReactNativeSpanEvent;
|
|
360
|
+
export declare function captureReactNativeResourceSpan(
|
|
361
|
+
client: LogBrewClient,
|
|
362
|
+
input?: ReactNativeResourceSpanInput
|
|
363
|
+
): ReactNativeSpanEvent;
|
|
364
|
+
export declare function createReactNavigationSpanListener(
|
|
365
|
+
client: LogBrewClient,
|
|
366
|
+
navigationContainer: ReactNavigationContainerLike,
|
|
367
|
+
options?: ReactNavigationSpanListenerOptions
|
|
368
|
+
): () => void;
|
|
157
369
|
export declare function createReactNativeErrorEvent(
|
|
158
370
|
error: unknown,
|
|
159
371
|
options?: CaptureReactNativeErrorOptions
|
|
@@ -186,6 +398,14 @@ export declare function captureDefaultAppStateChange(
|
|
|
186
398
|
state: string,
|
|
187
399
|
options?: Omit<CaptureAppStateChangeOptions, "platform" | "appState">
|
|
188
400
|
): void;
|
|
401
|
+
export declare function captureDefaultReactNativeAction(
|
|
402
|
+
client: LogBrewClient,
|
|
403
|
+
input?: Omit<ReactNativeActionInput, "platform" | "appState">
|
|
404
|
+
): ReactNativeActionEvent;
|
|
405
|
+
export declare function captureDefaultReactNativeNetwork(
|
|
406
|
+
client: LogBrewClient,
|
|
407
|
+
input?: Omit<ReactNativeNetworkInput, "platform" | "appState">
|
|
408
|
+
): ReactNativeActionEvent;
|
|
189
409
|
export declare function captureDefaultReactNativeError(
|
|
190
410
|
client: LogBrewClient,
|
|
191
411
|
error: unknown,
|
|
@@ -198,18 +418,34 @@ export declare function createDefaultAppStateListener(
|
|
|
198
418
|
|
|
199
419
|
declare const defaultExport: {
|
|
200
420
|
LogBrewNativeProvider: typeof LogBrewNativeProvider;
|
|
421
|
+
bindLogBrewTrace: typeof bindLogBrewTrace;
|
|
201
422
|
captureAppStateChange: typeof captureAppStateChange;
|
|
423
|
+
captureReactNativeAction: typeof captureReactNativeAction;
|
|
202
424
|
captureReactNativeError: typeof captureReactNativeError;
|
|
425
|
+
captureReactNativeNetwork: typeof captureReactNativeNetwork;
|
|
426
|
+
captureReactNativeNavigationSpan: typeof captureReactNativeNavigationSpan;
|
|
427
|
+
captureReactNativeResourceSpan: typeof captureReactNativeResourceSpan;
|
|
203
428
|
captureScreenView: typeof captureScreenView;
|
|
204
429
|
createAppStateListener: typeof createAppStateListener;
|
|
205
430
|
createLogBrewReactNativeClient: typeof createLogBrewReactNativeClient;
|
|
431
|
+
createReactNavigationSpanListener: typeof createReactNavigationSpanListener;
|
|
432
|
+
createReactNativeSpanAttributes: typeof createReactNativeSpanAttributes;
|
|
433
|
+
createReactNativeTraceContext: typeof createReactNativeTraceContext;
|
|
434
|
+
createReactNativeTraceHeaders: typeof createReactNativeTraceHeaders;
|
|
435
|
+
createReactNativeActionEvent: typeof createReactNativeActionEvent;
|
|
206
436
|
createReactNativeErrorEvent: typeof createReactNativeErrorEvent;
|
|
437
|
+
createReactNativeNetworkEvent: typeof createReactNativeNetworkEvent;
|
|
438
|
+
createReactNativeNavigationSpanEvent: typeof createReactNativeNavigationSpanEvent;
|
|
439
|
+
createReactNativeResourceSpanEvent: typeof createReactNativeResourceSpanEvent;
|
|
207
440
|
createReactNativeTraceparent: typeof createReactNativeTraceparent;
|
|
208
441
|
createTraceparentFetch: typeof createTraceparentFetch;
|
|
442
|
+
getActiveLogBrewTrace: typeof getActiveLogBrewTrace;
|
|
209
443
|
getReactNativeContext: typeof getReactNativeContext;
|
|
444
|
+
getReactNativeTraceMetadata: typeof getReactNativeTraceMetadata;
|
|
210
445
|
shouldPropagateTraceparent: typeof shouldPropagateTraceparent;
|
|
211
446
|
useLogBrewNative: typeof useLogBrewNative;
|
|
212
447
|
useLogBrewNativeActions: typeof useLogBrewNativeActions;
|
|
448
|
+
withLogBrewTrace: typeof withLogBrewTrace;
|
|
213
449
|
};
|
|
214
450
|
|
|
215
451
|
export default defaultExport;
|