@logbrew/react-native 0.1.0 → 0.1.2
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 +431 -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/global-errors.cjs +366 -0
- package/global-errors.d.cts +63 -0
- package/global-errors.d.ts +63 -0
- package/global-errors.js +7 -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 +128 -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/apollo.js
ADDED
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
import { SdkError } from "@logbrew/sdk";
|
|
2
|
+
import {
|
|
3
|
+
captureReactNativeResourceSpan,
|
|
4
|
+
createReactNativeTraceContext,
|
|
5
|
+
createReactNativeTraceHeaders,
|
|
6
|
+
getActiveLogBrewTrace
|
|
7
|
+
} from "./index.js";
|
|
8
|
+
import {
|
|
9
|
+
safeReactNativeMetadataFactoryResult
|
|
10
|
+
} from "./metadata.js";
|
|
11
|
+
|
|
12
|
+
const MAX_GRAPHQL_OPERATION_NAME_CHARS = 128;
|
|
13
|
+
const GRAPHQL_OPERATION_NAME_RE = /^[_A-Za-z][_0-9A-Za-z]*$/u;
|
|
14
|
+
const GRAPHQL_OPERATION_TYPES = new Set(["query", "mutation", "subscription"]);
|
|
15
|
+
|
|
16
|
+
export function createReactNativeApolloLink(client, {
|
|
17
|
+
ApolloLink,
|
|
18
|
+
appState,
|
|
19
|
+
metadata = {},
|
|
20
|
+
metadataFactory,
|
|
21
|
+
now = () => new Date().toISOString(),
|
|
22
|
+
nowMs = () => Date.now(),
|
|
23
|
+
platform,
|
|
24
|
+
propagateTraceparent = true,
|
|
25
|
+
randomValues,
|
|
26
|
+
screen,
|
|
27
|
+
sessionId,
|
|
28
|
+
trace,
|
|
29
|
+
traceFlags = "01"
|
|
30
|
+
} = {}) {
|
|
31
|
+
if (typeof ApolloLink !== "function") {
|
|
32
|
+
throw new SdkError("configuration_error", "createReactNativeApolloLink requires an app-provided ApolloLink constructor");
|
|
33
|
+
}
|
|
34
|
+
if (metadataFactory !== undefined && typeof metadataFactory !== "function") {
|
|
35
|
+
throw new SdkError("configuration_error", "metadataFactory must be a function");
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return new ApolloLink((operation, forward) => {
|
|
39
|
+
if (typeof forward !== "function") {
|
|
40
|
+
throw new SdkError("configuration_error", "createReactNativeApolloLink requires Apollo forward");
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const startedAtMs = nowMs();
|
|
44
|
+
const timestamp = now();
|
|
45
|
+
const activeTrace = apolloTraceContext({ randomValues, trace, traceFlags });
|
|
46
|
+
const details = apolloOperationDetails(operation);
|
|
47
|
+
if (propagateTraceparent) {
|
|
48
|
+
setOperationTraceparent(operation, activeTrace);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
let forwarded;
|
|
52
|
+
try {
|
|
53
|
+
forwarded = forward(operation);
|
|
54
|
+
} catch (error) {
|
|
55
|
+
captureApolloSpan(client, {
|
|
56
|
+
activeTrace,
|
|
57
|
+
appState,
|
|
58
|
+
details,
|
|
59
|
+
durationMs: elapsedMs(startedAtMs, nowMs),
|
|
60
|
+
error,
|
|
61
|
+
metadata,
|
|
62
|
+
metadataFactory,
|
|
63
|
+
now,
|
|
64
|
+
platform,
|
|
65
|
+
screen,
|
|
66
|
+
sessionId,
|
|
67
|
+
status: "error",
|
|
68
|
+
timestamp
|
|
69
|
+
});
|
|
70
|
+
throw error;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
if (!forwarded || typeof forwarded.subscribe !== "function") {
|
|
74
|
+
throw new SdkError("configuration_error", "Apollo forward must return an observable-like value");
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
return apolloObservable(forwarded, {
|
|
78
|
+
activeTrace,
|
|
79
|
+
appState,
|
|
80
|
+
client,
|
|
81
|
+
details,
|
|
82
|
+
metadata,
|
|
83
|
+
metadataFactory,
|
|
84
|
+
now,
|
|
85
|
+
nowMs,
|
|
86
|
+
platform,
|
|
87
|
+
screen,
|
|
88
|
+
sessionId,
|
|
89
|
+
startedAtMs,
|
|
90
|
+
timestamp
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
function apolloObservable(forwarded, options) {
|
|
96
|
+
return {
|
|
97
|
+
subscribe(observerOrNext, onError, onComplete) {
|
|
98
|
+
const observer = apolloObserver(observerOrNext, onError, onComplete);
|
|
99
|
+
let finished = false;
|
|
100
|
+
let graphqlErrorCount = 0;
|
|
101
|
+
|
|
102
|
+
const finish = ({ error, status }) => {
|
|
103
|
+
if (finished) {
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
finished = true;
|
|
107
|
+
captureApolloSpan(options.client, {
|
|
108
|
+
activeTrace: options.activeTrace,
|
|
109
|
+
appState: options.appState,
|
|
110
|
+
details: options.details,
|
|
111
|
+
durationMs: elapsedMs(options.startedAtMs, options.nowMs),
|
|
112
|
+
error,
|
|
113
|
+
graphqlErrorCount,
|
|
114
|
+
metadata: options.metadata,
|
|
115
|
+
metadataFactory: options.metadataFactory,
|
|
116
|
+
now: options.now,
|
|
117
|
+
platform: options.platform,
|
|
118
|
+
screen: options.screen,
|
|
119
|
+
sessionId: options.sessionId,
|
|
120
|
+
status,
|
|
121
|
+
timestamp: options.timestamp
|
|
122
|
+
});
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
try {
|
|
126
|
+
return forwarded.subscribe({
|
|
127
|
+
next(value) {
|
|
128
|
+
graphqlErrorCount += graphqlErrorCountFromResult(value);
|
|
129
|
+
observer.next?.(value);
|
|
130
|
+
},
|
|
131
|
+
error(error) {
|
|
132
|
+
finish({ error, status: "error" });
|
|
133
|
+
observer.error?.(error);
|
|
134
|
+
},
|
|
135
|
+
complete() {
|
|
136
|
+
finish({ status: graphqlErrorCount > 0 ? "error" : "ok" });
|
|
137
|
+
observer.complete?.();
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
} catch (error) {
|
|
141
|
+
finish({ error, status: "error" });
|
|
142
|
+
throw error;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
function captureApolloSpan(client, {
|
|
149
|
+
activeTrace,
|
|
150
|
+
appState,
|
|
151
|
+
details,
|
|
152
|
+
durationMs,
|
|
153
|
+
error,
|
|
154
|
+
graphqlErrorCount,
|
|
155
|
+
metadata,
|
|
156
|
+
metadataFactory,
|
|
157
|
+
now,
|
|
158
|
+
platform,
|
|
159
|
+
screen,
|
|
160
|
+
sessionId,
|
|
161
|
+
status,
|
|
162
|
+
timestamp
|
|
163
|
+
}) {
|
|
164
|
+
const context = {
|
|
165
|
+
durationMs,
|
|
166
|
+
error,
|
|
167
|
+
operationName: details.operationName,
|
|
168
|
+
operationType: details.operationType,
|
|
169
|
+
screen,
|
|
170
|
+
status
|
|
171
|
+
};
|
|
172
|
+
captureReactNativeResourceSpan(client, {
|
|
173
|
+
appState,
|
|
174
|
+
durationMs,
|
|
175
|
+
id: defaultApolloSpanId({ operationName: details.operationName, operationType: details.operationType, screen }),
|
|
176
|
+
kind: "graphql",
|
|
177
|
+
metadata: {
|
|
178
|
+
...metadata,
|
|
179
|
+
...safeReactNativeMetadataFactoryResult(typeof metadataFactory === "function" ? metadataFactory(context) : undefined),
|
|
180
|
+
errorName: errorName(error),
|
|
181
|
+
errorValueType: error === undefined ? undefined : typeof error,
|
|
182
|
+
framework: "apollo-client",
|
|
183
|
+
graphqlErrorCount: graphqlErrorCount && graphqlErrorCount > 0 ? graphqlErrorCount : undefined,
|
|
184
|
+
graphqlOperationName: details.operationName,
|
|
185
|
+
graphqlOperationType: details.operationType,
|
|
186
|
+
source: "react-native.apollo"
|
|
187
|
+
},
|
|
188
|
+
name: apolloSpanName(details),
|
|
189
|
+
now,
|
|
190
|
+
platform,
|
|
191
|
+
screen,
|
|
192
|
+
sessionId,
|
|
193
|
+
status,
|
|
194
|
+
timestamp,
|
|
195
|
+
trace: activeTrace
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
function setOperationTraceparent(operation, trace) {
|
|
200
|
+
if (!operation || typeof operation.setContext !== "function") {
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
203
|
+
const traceparent = createReactNativeTraceHeaders(trace).traceparent;
|
|
204
|
+
operation.setContext(({ headers = {} } = {}) => ({
|
|
205
|
+
headers: {
|
|
206
|
+
...headers,
|
|
207
|
+
traceparent
|
|
208
|
+
}
|
|
209
|
+
}));
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
function apolloOperationDetails(operation) {
|
|
213
|
+
const definition = operation?.query?.definitions?.find?.((candidate) => (
|
|
214
|
+
candidate?.kind === "OperationDefinition" && GRAPHQL_OPERATION_TYPES.has(candidate?.operation)
|
|
215
|
+
));
|
|
216
|
+
return {
|
|
217
|
+
operationName: safeGraphqlOperationName(operation?.operationName) ?? safeGraphqlOperationName(definition?.name?.value),
|
|
218
|
+
operationType: GRAPHQL_OPERATION_TYPES.has(definition?.operation) ? definition.operation : undefined
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
function apolloSpanName({ operationName, operationType }) {
|
|
223
|
+
const base = `graphql.${operationType ?? "operation"}`;
|
|
224
|
+
return operationName ? `${base} ${operationName}` : base;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
function apolloTraceContext({ randomValues, trace, traceFlags }) {
|
|
228
|
+
if (typeof trace === "string") {
|
|
229
|
+
return createReactNativeTraceContext({ randomValues, traceFlags, traceparent: trace });
|
|
230
|
+
}
|
|
231
|
+
return trace ?? getActiveLogBrewTrace() ?? createReactNativeTraceContext({ randomValues, traceFlags });
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
function apolloObserver(observerOrNext, onError, onComplete) {
|
|
235
|
+
if (typeof observerOrNext === "function") {
|
|
236
|
+
return {
|
|
237
|
+
next: observerOrNext,
|
|
238
|
+
error: onError,
|
|
239
|
+
complete: onComplete
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
return observerOrNext && typeof observerOrNext === "object" ? observerOrNext : {};
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
function graphqlErrorCountFromResult(value) {
|
|
246
|
+
return Array.isArray(value?.errors) ? value.errors.length : 0;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
function safeGraphqlOperationName(value) {
|
|
250
|
+
if (typeof value !== "string") {
|
|
251
|
+
return undefined;
|
|
252
|
+
}
|
|
253
|
+
const name = value.trim();
|
|
254
|
+
if (
|
|
255
|
+
name.length === 0 ||
|
|
256
|
+
name.length > MAX_GRAPHQL_OPERATION_NAME_CHARS ||
|
|
257
|
+
!GRAPHQL_OPERATION_NAME_RE.test(name)
|
|
258
|
+
) {
|
|
259
|
+
return undefined;
|
|
260
|
+
}
|
|
261
|
+
return name;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
function elapsedMs(startedAtMs, nowMs) {
|
|
265
|
+
const durationMs = nowMs() - startedAtMs;
|
|
266
|
+
return Number.isFinite(durationMs) ? Math.max(0, durationMs) : undefined;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
function errorName(error) {
|
|
270
|
+
if (error instanceof Error && typeof error.name === "string" && error.name.trim() !== "") {
|
|
271
|
+
return error.name;
|
|
272
|
+
}
|
|
273
|
+
if (typeof error?.name === "string" && error.name.trim() !== "") {
|
|
274
|
+
return error.name;
|
|
275
|
+
}
|
|
276
|
+
return undefined;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
function defaultApolloSpanId({ operationName, operationType, screen }) {
|
|
280
|
+
return `evt_native_apollo_${slugify([screen, operationType, operationName].filter(Boolean).join("_") || "operation")}`;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
function slugify(value) {
|
|
284
|
+
return String(value)
|
|
285
|
+
.trim()
|
|
286
|
+
.toLowerCase()
|
|
287
|
+
.replace(/[^a-z0-9]+/gu, "_")
|
|
288
|
+
.replace(/^_+|_+$/gu, "")
|
|
289
|
+
.slice(0, 96) || "event";
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
export default {
|
|
293
|
+
createReactNativeApolloLink
|
|
294
|
+
};
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { RecordingTransport } from "@logbrew/sdk";
|
|
2
|
+
import {
|
|
3
|
+
createLogBrewReactNativeClient,
|
|
4
|
+
createReactNativeTraceContext
|
|
5
|
+
} from "@logbrew/react-native";
|
|
6
|
+
import {
|
|
7
|
+
createReactNativeApolloLink
|
|
8
|
+
} from "@logbrew/react-native/apollo";
|
|
9
|
+
|
|
10
|
+
class ApolloLink {
|
|
11
|
+
constructor(request) {
|
|
12
|
+
this.request = request;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function observableFrom(handler) {
|
|
17
|
+
return {
|
|
18
|
+
subscribe(observer) {
|
|
19
|
+
handler(observer);
|
|
20
|
+
return { unsubscribe() {} };
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
let context = {
|
|
26
|
+
headers: {
|
|
27
|
+
accept: "application/json",
|
|
28
|
+
authorization: "RedactedAuthHeader"
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
const operation = {
|
|
32
|
+
operationName: "CheckoutSubmit",
|
|
33
|
+
query: {
|
|
34
|
+
definitions: [
|
|
35
|
+
{ kind: "OperationDefinition", operation: "mutation" }
|
|
36
|
+
]
|
|
37
|
+
},
|
|
38
|
+
getContext() {
|
|
39
|
+
return context;
|
|
40
|
+
},
|
|
41
|
+
setContext(nextContext) {
|
|
42
|
+
const resolved = typeof nextContext === "function" ? nextContext(context) : nextContext;
|
|
43
|
+
context = {
|
|
44
|
+
...context,
|
|
45
|
+
...resolved,
|
|
46
|
+
headers: {
|
|
47
|
+
...(context.headers ?? {}),
|
|
48
|
+
...(resolved?.headers ?? {})
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
const client = createLogBrewReactNativeClient({
|
|
55
|
+
clientKey: "LOGBREW_CLIENT_KEY",
|
|
56
|
+
sdkName: "logbrew-react-native-apollo-link-spans",
|
|
57
|
+
sdkVersion: "0.1.0",
|
|
58
|
+
maxRetries: 1
|
|
59
|
+
});
|
|
60
|
+
const trace = createReactNativeTraceContext({
|
|
61
|
+
traceparent: "00-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-01",
|
|
62
|
+
spanId: "c3ad6b7169205553"
|
|
63
|
+
});
|
|
64
|
+
const times = [1000, 1041, 2000, 2027];
|
|
65
|
+
const timestamps = [
|
|
66
|
+
"2026-06-30T08:10:00Z",
|
|
67
|
+
"2026-06-30T08:10:01Z"
|
|
68
|
+
];
|
|
69
|
+
const link = createReactNativeApolloLink(client, {
|
|
70
|
+
ApolloLink,
|
|
71
|
+
metadata: { flow: "checkout" },
|
|
72
|
+
metadataFactory(details) {
|
|
73
|
+
return {
|
|
74
|
+
feature: details.operationName,
|
|
75
|
+
requestBody: "{ redacted }",
|
|
76
|
+
variables: { email: "hidden@example.test" }
|
|
77
|
+
};
|
|
78
|
+
},
|
|
79
|
+
now: () => timestamps.shift(),
|
|
80
|
+
nowMs: () => times.shift(),
|
|
81
|
+
screen: "Checkout",
|
|
82
|
+
sessionId: "session_mobile_001",
|
|
83
|
+
trace
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
link.request(operation, () => observableFrom((observer) => {
|
|
87
|
+
observer.next({ data: { checkout: { id: "order_123" } } });
|
|
88
|
+
observer.complete();
|
|
89
|
+
})).subscribe({});
|
|
90
|
+
|
|
91
|
+
link.request({
|
|
92
|
+
...operation,
|
|
93
|
+
operationName: "CheckoutRetry"
|
|
94
|
+
}, () => observableFrom((observer) => {
|
|
95
|
+
observer.error(new TypeError("network request failed with private marker"));
|
|
96
|
+
})).subscribe({
|
|
97
|
+
error() {}
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
const events = JSON.parse(client.previewJson()).events;
|
|
101
|
+
if (events.length !== 2) {
|
|
102
|
+
throw new Error(`expected two Apollo spans, got ${events.length}`);
|
|
103
|
+
}
|
|
104
|
+
if (operation.getContext().headers.traceparent !== `00-${trace.traceId}-${trace.spanId}-01`) {
|
|
105
|
+
throw new Error(`expected Apollo traceparent, got ${operation.getContext().headers.traceparent}`);
|
|
106
|
+
}
|
|
107
|
+
const success = events[0].attributes;
|
|
108
|
+
const failure = events[1].attributes;
|
|
109
|
+
if (
|
|
110
|
+
success.name !== "graphql.mutation CheckoutSubmit" ||
|
|
111
|
+
success.status !== "ok" ||
|
|
112
|
+
success.durationMs !== 41 ||
|
|
113
|
+
success.metadata.source !== "react-native.apollo" ||
|
|
114
|
+
success.metadata.framework !== "apollo-client" ||
|
|
115
|
+
success.metadata.graphqlOperationName !== "CheckoutSubmit" ||
|
|
116
|
+
success.metadata.graphqlOperationType !== "mutation" ||
|
|
117
|
+
success.metadata.feature !== "CheckoutSubmit" ||
|
|
118
|
+
success.metadata.requestBody !== undefined ||
|
|
119
|
+
success.metadata.variables !== undefined ||
|
|
120
|
+
success.metadata.traceId !== trace.traceId
|
|
121
|
+
) {
|
|
122
|
+
throw new Error(`unexpected Apollo success span: ${JSON.stringify(success)}`);
|
|
123
|
+
}
|
|
124
|
+
if (
|
|
125
|
+
failure.name !== "graphql.mutation CheckoutRetry" ||
|
|
126
|
+
failure.status !== "error" ||
|
|
127
|
+
failure.durationMs !== 27 ||
|
|
128
|
+
failure.metadata.errorName !== "TypeError" ||
|
|
129
|
+
failure.metadata.errorValueType !== "object" ||
|
|
130
|
+
failure.metadata.traceId !== trace.traceId
|
|
131
|
+
) {
|
|
132
|
+
throw new Error(`unexpected Apollo failure span: ${JSON.stringify(failure)}`);
|
|
133
|
+
}
|
|
134
|
+
if (JSON.stringify(events).includes("hidden@example.test") || JSON.stringify(events).includes("private marker")) {
|
|
135
|
+
throw new Error("Apollo GraphQL span leaked variables or error message");
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
const preview = client.previewJson();
|
|
139
|
+
const response = await client.shutdown(RecordingTransport.alwaysAccept());
|
|
140
|
+
console.log(preview);
|
|
141
|
+
console.error(JSON.stringify({
|
|
142
|
+
ok: true,
|
|
143
|
+
events: events.length,
|
|
144
|
+
status: response.statusCode,
|
|
145
|
+
successSpan: success.name,
|
|
146
|
+
failureSpan: failure.name,
|
|
147
|
+
propagatedTraceparent: operation.getContext().headers.traceparent,
|
|
148
|
+
traceId: trace.traceId
|
|
149
|
+
}));
|
package/examples/index.mjs
CHANGED
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
const commands = new Map([
|
|
4
|
+
["apollo-link-spans", new URL("./apollo-link-spans.mjs", import.meta.url)],
|
|
5
|
+
["instrumentation-kit", new URL("./instrumentation-kit.mjs", import.meta.url)],
|
|
6
|
+
["lifecycle-spans", new URL("./lifecycle-spans.mjs", import.meta.url)],
|
|
7
|
+
["native-bridge-scope", new URL("./native-bridge-scope.mjs", import.meta.url)],
|
|
8
|
+
["navigation-resource-spans", new URL("./navigation-resource-spans.mjs", import.meta.url)],
|
|
4
9
|
["readme-example", new URL("./readme-example.mjs", import.meta.url)],
|
|
5
|
-
["real-user-smoke", new URL("./real-user-smoke.mjs", import.meta.url)]
|
|
10
|
+
["real-user-smoke", new URL("./real-user-smoke.mjs", import.meta.url)],
|
|
11
|
+
["resource-fetch-spans", new URL("./resource-fetch-spans.mjs", import.meta.url)],
|
|
12
|
+
["trace-correlation", new URL("./trace-correlation.mjs", import.meta.url)]
|
|
6
13
|
]);
|
|
7
14
|
|
|
8
15
|
const command = process.argv[2] ?? "real-user-smoke";
|
|
@@ -21,16 +28,37 @@ if (command === "--help" || command === "-h") {
|
|
|
21
28
|
|
|
22
29
|
function printHelp() {
|
|
23
30
|
console.log("LogBrew React Native examples");
|
|
31
|
+
console.log("node node_modules/@logbrew/react-native/examples/index.mjs apollo-link-spans");
|
|
32
|
+
console.log("node node_modules/@logbrew/react-native/examples/index.mjs instrumentation-kit");
|
|
33
|
+
console.log("node node_modules/@logbrew/react-native/examples/index.mjs lifecycle-spans");
|
|
34
|
+
console.log("node node_modules/@logbrew/react-native/examples/index.mjs native-bridge-scope");
|
|
24
35
|
console.log("node node_modules/@logbrew/react-native/examples/index.mjs --list");
|
|
36
|
+
console.log("node node_modules/@logbrew/react-native/examples/index.mjs navigation-resource-spans");
|
|
25
37
|
console.log("node node_modules/@logbrew/react-native/examples/index.mjs readme-example");
|
|
26
38
|
console.log("node node_modules/@logbrew/react-native/examples/index.mjs real-user-smoke");
|
|
39
|
+
console.log("node node_modules/@logbrew/react-native/examples/index.mjs resource-fetch-spans");
|
|
40
|
+
console.log("node node_modules/@logbrew/react-native/examples/index.mjs trace-correlation");
|
|
27
41
|
console.log("node node_modules/@logbrew/react-native/examples/index.mjs");
|
|
28
42
|
console.log("npm --prefix node_modules/@logbrew/react-native/examples run list");
|
|
43
|
+
console.log("npm --prefix node_modules/@logbrew/react-native/examples run apollo-link-spans");
|
|
44
|
+
console.log("npm --prefix node_modules/@logbrew/react-native/examples run instrumentation-kit");
|
|
45
|
+
console.log("npm --prefix node_modules/@logbrew/react-native/examples run lifecycle-spans");
|
|
46
|
+
console.log("npm --prefix node_modules/@logbrew/react-native/examples run native-bridge-scope");
|
|
47
|
+
console.log("npm --prefix node_modules/@logbrew/react-native/examples run navigation-resource-spans");
|
|
29
48
|
console.log("npm --prefix node_modules/@logbrew/react-native/examples run readme-example");
|
|
30
49
|
console.log("npm --prefix node_modules/@logbrew/react-native/examples run real-user-smoke");
|
|
50
|
+
console.log("npm --prefix node_modules/@logbrew/react-native/examples run resource-fetch-spans");
|
|
51
|
+
console.log("npm --prefix node_modules/@logbrew/react-native/examples run trace-correlation");
|
|
31
52
|
}
|
|
32
53
|
|
|
33
54
|
function printList() {
|
|
55
|
+
console.log("apollo-link-spans -> node node_modules/@logbrew/react-native/examples/index.mjs apollo-link-spans");
|
|
56
|
+
console.log("instrumentation-kit -> node node_modules/@logbrew/react-native/examples/index.mjs instrumentation-kit");
|
|
57
|
+
console.log("lifecycle-spans -> node node_modules/@logbrew/react-native/examples/index.mjs lifecycle-spans");
|
|
58
|
+
console.log("native-bridge-scope -> node node_modules/@logbrew/react-native/examples/index.mjs native-bridge-scope");
|
|
59
|
+
console.log("navigation-resource-spans -> node node_modules/@logbrew/react-native/examples/index.mjs navigation-resource-spans");
|
|
34
60
|
console.log("readme-example -> node node_modules/@logbrew/react-native/examples/index.mjs readme-example");
|
|
35
61
|
console.log("real-user-smoke -> node node_modules/@logbrew/react-native/examples/index.mjs real-user-smoke");
|
|
62
|
+
console.log("resource-fetch-spans -> node node_modules/@logbrew/react-native/examples/index.mjs resource-fetch-spans");
|
|
63
|
+
console.log("trace-correlation -> node node_modules/@logbrew/react-native/examples/index.mjs trace-correlation");
|
|
36
64
|
}
|