@squide/firefly 14.0.0 → 14.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/CHANGELOG.md +14 -0
- package/dist/honeycomb/registerHoneycombInstrumentation.d.ts +1 -1
- package/dist/honeycomb/registerHoneycombInstrumentation.js +153 -62
- package/dist/honeycomb/registerHoneycombInstrumentation.js.map +1 -1
- package/package.json +5 -5
- package/src/honeycomb/registerHoneycombInstrumentation.ts +218 -61
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @squide/firefly
|
|
2
2
|
|
|
3
|
+
## 14.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#313](https://github.com/workleap/wl-squide/pull/313) [`bea660b`](https://github.com/workleap/wl-squide/commit/bea660bf827dd123a52f6062a7be8865dc99055b) Thanks [@patricklafrance](https://github.com/patricklafrance)! - Hardened Honeycomb integration and added support for React Router relative paths.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [[`bea660b`](https://github.com/workleap/wl-squide/commit/bea660bf827dd123a52f6062a7be8865dc99055b)]:
|
|
12
|
+
- @squide/react-router@8.1.0
|
|
13
|
+
- @squide/core@6.1.0
|
|
14
|
+
- @squide/module-federation@7.0.1
|
|
15
|
+
- @squide/msw@4.0.1
|
|
16
|
+
|
|
3
17
|
## 14.0.0
|
|
4
18
|
|
|
5
19
|
### Major Changes
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { FireflyRuntime } from "../FireflyRuntime.tsx";
|
|
2
|
-
export declare function reduceDataFetchEvents(runtime: FireflyRuntime, onDataFetchStarted: () => void, onDataReady: () => void, onPublicDataFetchStarted: () => void, onPublicDataReady: () => void, onProtectedDataFetchStarted: () => void, onProtectedDataReady: () => void, onDataFetchFailed: (queriesErrors: Error[]) => void): void;
|
|
2
|
+
export declare function reduceDataFetchEvents(runtime: FireflyRuntime, onDataFetchStarted: () => void, onDataReady: () => void, onPublicDataFetchStarted: () => void, onPublicDataReady: () => void, onProtectedDataFetchStarted: () => void, onProtectedDataReady: () => void, onDataFetchFailed: (queriesErrors: Error[]) => void, onUnmanagedError: (error: unknown) => void): void;
|
|
3
3
|
export declare function registerHoneycombInstrumentation(runtime: FireflyRuntime): void;
|
|
@@ -36,18 +36,29 @@ import { endActiveSpan, startActiveChildSpan, startChildSpan, startSpan, traceEr
|
|
|
36
36
|
|
|
37
37
|
|
|
38
38
|
|
|
39
|
-
function
|
|
39
|
+
function addProtectedListener(runtime, eventName, callback, options) {
|
|
40
|
+
const protectedCallback = (...args)=>{
|
|
41
|
+
try {
|
|
42
|
+
callback(...args);
|
|
43
|
+
} catch (error) {
|
|
44
|
+
runtime.logger.withText(`[squide] An unmanaged error occurred while handling event "${eventName.toString()}" for Honeycomb instrumentation:`).withError(error).error();
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
runtime.eventBus.addListener(eventName, protectedCallback, options);
|
|
48
|
+
}
|
|
49
|
+
function reduceDataFetchEvents(runtime, onDataFetchStarted, onDataReady, onPublicDataFetchStarted, onPublicDataReady, onProtectedDataFetchStarted, onProtectedDataReady, onDataFetchFailed, onUnmanagedError) {
|
|
40
50
|
let dataFetchState = "none";
|
|
41
|
-
runtime
|
|
51
|
+
addProtectedListener(runtime, PublicDataFetchStartedEvent, ()=>{
|
|
42
52
|
if (dataFetchState === "none") {
|
|
43
53
|
dataFetchState = "fetching-data";
|
|
44
54
|
onDataFetchStarted();
|
|
45
55
|
}
|
|
46
56
|
onPublicDataFetchStarted();
|
|
47
57
|
}, {
|
|
48
|
-
once: true
|
|
58
|
+
once: true,
|
|
59
|
+
onError: onUnmanagedError
|
|
49
60
|
});
|
|
50
|
-
runtime
|
|
61
|
+
addProtectedListener(runtime, PublicDataReadyEvent, (payload)=>{
|
|
51
62
|
onPublicDataReady();
|
|
52
63
|
if (dataFetchState === "fetching-data") {
|
|
53
64
|
if (payload && !payload.waitForProtectedData) {
|
|
@@ -61,18 +72,20 @@ function reduceDataFetchEvents(runtime, onDataFetchStarted, onDataReady, onPubli
|
|
|
61
72
|
onDataReady();
|
|
62
73
|
}
|
|
63
74
|
}, {
|
|
64
|
-
once: true
|
|
75
|
+
once: true,
|
|
76
|
+
onError: onUnmanagedError
|
|
65
77
|
});
|
|
66
|
-
runtime
|
|
78
|
+
addProtectedListener(runtime, ProtectedDataFetchStartedEvent, ()=>{
|
|
67
79
|
if (dataFetchState === "none") {
|
|
68
80
|
dataFetchState = "fetching-data";
|
|
69
81
|
onDataFetchStarted();
|
|
70
82
|
}
|
|
71
83
|
onProtectedDataFetchStarted();
|
|
72
84
|
}, {
|
|
73
|
-
once: true
|
|
85
|
+
once: true,
|
|
86
|
+
onError: onUnmanagedError
|
|
74
87
|
});
|
|
75
|
-
runtime
|
|
88
|
+
addProtectedListener(runtime, ProtectedDataReadyEvent, (payload)=>{
|
|
76
89
|
onProtectedDataReady();
|
|
77
90
|
if (dataFetchState === "fetching-data") {
|
|
78
91
|
if (payload && !payload.waitForPublicData) {
|
|
@@ -86,7 +99,8 @@ function reduceDataFetchEvents(runtime, onDataFetchStarted, onDataReady, onPubli
|
|
|
86
99
|
onDataReady();
|
|
87
100
|
}
|
|
88
101
|
}, {
|
|
89
|
-
once: true
|
|
102
|
+
once: true,
|
|
103
|
+
onError: onUnmanagedError
|
|
90
104
|
});
|
|
91
105
|
const handleDataFetchFailed = (payload)=>{
|
|
92
106
|
if (dataFetchState !== "data-fetch-failed") {
|
|
@@ -94,15 +108,18 @@ function reduceDataFetchEvents(runtime, onDataFetchStarted, onDataReady, onPubli
|
|
|
94
108
|
onDataFetchFailed(payload);
|
|
95
109
|
}
|
|
96
110
|
};
|
|
97
|
-
runtime
|
|
98
|
-
once: true
|
|
111
|
+
addProtectedListener(runtime, PublicDataFetchFailedEvent, handleDataFetchFailed, {
|
|
112
|
+
once: true,
|
|
113
|
+
onError: onUnmanagedError
|
|
99
114
|
});
|
|
100
|
-
runtime
|
|
101
|
-
once: true
|
|
115
|
+
addProtectedListener(runtime, ProtectedDataFetchFailedEvent, handleDataFetchFailed, {
|
|
116
|
+
once: true,
|
|
117
|
+
onError: onUnmanagedError
|
|
102
118
|
});
|
|
103
119
|
}
|
|
104
120
|
function registerTrackingListeners(runtime) {
|
|
105
121
|
let bootstrappingSpan;
|
|
122
|
+
let bootstrappingSpanHasEnded = false;
|
|
106
123
|
let localModuleRegistrationSpan;
|
|
107
124
|
let localModuleDeferredRegistrationSpan;
|
|
108
125
|
let remoteModuleRegistrationSpan;
|
|
@@ -111,26 +128,61 @@ function registerTrackingListeners(runtime) {
|
|
|
111
128
|
let deferredRegistrationsUpdateSpan;
|
|
112
129
|
let localModuleDeferredRegistrationsUpdateSpan;
|
|
113
130
|
let remoteModuleDeferredRegistrationsUpdateSpan;
|
|
114
|
-
|
|
131
|
+
const handleUnmanagedError = (error)=>{
|
|
132
|
+
if (bootstrappingSpan && !bootstrappingSpanHasEnded) {
|
|
133
|
+
traceError(bootstrappingSpan, error);
|
|
134
|
+
bootstrappingSpan.end();
|
|
135
|
+
bootstrappingSpanHasEnded = true;
|
|
136
|
+
}
|
|
137
|
+
if (localModuleRegistrationSpan) {
|
|
138
|
+
localModuleRegistrationSpan.end();
|
|
139
|
+
}
|
|
140
|
+
if (localModuleDeferredRegistrationSpan) {
|
|
141
|
+
localModuleDeferredRegistrationSpan.end();
|
|
142
|
+
}
|
|
143
|
+
if (remoteModuleRegistrationSpan) {
|
|
144
|
+
remoteModuleRegistrationSpan.end();
|
|
145
|
+
}
|
|
146
|
+
if (remoteModuleDeferredRegistrationSpan) {
|
|
147
|
+
remoteModuleDeferredRegistrationSpan.end();
|
|
148
|
+
}
|
|
149
|
+
if (dataFetchSpan) {
|
|
150
|
+
dataFetchSpan.instance.end();
|
|
151
|
+
}
|
|
152
|
+
if (deferredRegistrationsUpdateSpan) {
|
|
153
|
+
deferredRegistrationsUpdateSpan.end();
|
|
154
|
+
}
|
|
155
|
+
if (localModuleDeferredRegistrationsUpdateSpan) {
|
|
156
|
+
localModuleDeferredRegistrationsUpdateSpan.instance.end();
|
|
157
|
+
}
|
|
158
|
+
if (remoteModuleDeferredRegistrationsUpdateSpan) {
|
|
159
|
+
remoteModuleDeferredRegistrationsUpdateSpan.instance.end();
|
|
160
|
+
}
|
|
161
|
+
};
|
|
162
|
+
addProtectedListener(runtime, ApplicationBootstrappingStartedEvent, ()=>{
|
|
115
163
|
bootstrappingSpan = startSpan((options, context)=>getTracer().startSpan("squide-bootstrapping", options, context));
|
|
116
164
|
}, {
|
|
117
|
-
once: true
|
|
165
|
+
once: true,
|
|
166
|
+
onError: handleUnmanagedError
|
|
118
167
|
});
|
|
119
|
-
runtime
|
|
168
|
+
addProtectedListener(runtime, ApplicationBoostrappedEvent, ()=>{
|
|
120
169
|
if (bootstrappingSpan) {
|
|
121
170
|
bootstrappingSpan.end();
|
|
171
|
+
bootstrappingSpanHasEnded = true;
|
|
122
172
|
}
|
|
123
173
|
}, {
|
|
124
|
-
once: true
|
|
174
|
+
once: true,
|
|
175
|
+
onError: handleUnmanagedError
|
|
125
176
|
});
|
|
126
|
-
runtime
|
|
177
|
+
addProtectedListener(runtime, MswReadyEvent, ()=>{
|
|
127
178
|
if (bootstrappingSpan) {
|
|
128
179
|
bootstrappingSpan.addEvent("msw-ready");
|
|
129
180
|
}
|
|
130
181
|
}, {
|
|
131
|
-
once: true
|
|
182
|
+
once: true,
|
|
183
|
+
onError: handleUnmanagedError
|
|
132
184
|
});
|
|
133
|
-
runtime
|
|
185
|
+
addProtectedListener(runtime, LocalModulesRegistrationStartedEvent, (payload)=>{
|
|
134
186
|
const attributes = {
|
|
135
187
|
"app.squide.module_count": payload.moduleCount
|
|
136
188
|
};
|
|
@@ -144,9 +196,10 @@ function registerTrackingListeners(runtime) {
|
|
|
144
196
|
}, context);
|
|
145
197
|
});
|
|
146
198
|
}, {
|
|
147
|
-
once: true
|
|
199
|
+
once: true,
|
|
200
|
+
onError: handleUnmanagedError
|
|
148
201
|
});
|
|
149
|
-
runtime
|
|
202
|
+
addProtectedListener(runtime, LocalModulesRegistrationCompletedEvent, (payload)=>{
|
|
150
203
|
if (bootstrappingSpan) {
|
|
151
204
|
bootstrappingSpan.addEvent("local-module-registration-completed", {
|
|
152
205
|
"app.squide.module_count": payload.moduleCount
|
|
@@ -156,16 +209,19 @@ function registerTrackingListeners(runtime) {
|
|
|
156
209
|
localModuleRegistrationSpan.end();
|
|
157
210
|
}
|
|
158
211
|
}, {
|
|
159
|
-
once: true
|
|
212
|
+
once: true,
|
|
213
|
+
onError: handleUnmanagedError
|
|
160
214
|
});
|
|
161
215
|
// Can occur multiple times.
|
|
162
|
-
runtime
|
|
216
|
+
addProtectedListener(runtime, LocalModuleRegistrationFailedEvent, (payload)=>{
|
|
163
217
|
const registrationError = payload;
|
|
164
218
|
if (localModuleRegistrationSpan) {
|
|
165
219
|
traceError(localModuleRegistrationSpan, registrationError);
|
|
166
220
|
}
|
|
221
|
+
}, {
|
|
222
|
+
onError: handleUnmanagedError
|
|
167
223
|
});
|
|
168
|
-
runtime
|
|
224
|
+
addProtectedListener(runtime, LocalModulesDeferredRegistrationStartedEvent, (payload)=>{
|
|
169
225
|
const attributes = {
|
|
170
226
|
"app.squide.registration_count": payload.registrationCount
|
|
171
227
|
};
|
|
@@ -179,9 +235,10 @@ function registerTrackingListeners(runtime) {
|
|
|
179
235
|
}, context);
|
|
180
236
|
});
|
|
181
237
|
}, {
|
|
182
|
-
once: true
|
|
238
|
+
once: true,
|
|
239
|
+
onError: handleUnmanagedError
|
|
183
240
|
});
|
|
184
|
-
runtime
|
|
241
|
+
addProtectedListener(runtime, LocalModulesDeferredRegistrationCompletedEvent, (payload)=>{
|
|
185
242
|
if (bootstrappingSpan) {
|
|
186
243
|
bootstrappingSpan.addEvent("local-module-deferred-registration-completed", {
|
|
187
244
|
"app.squide.registration_count": payload.registrationCount
|
|
@@ -191,16 +248,19 @@ function registerTrackingListeners(runtime) {
|
|
|
191
248
|
localModuleDeferredRegistrationSpan.end();
|
|
192
249
|
}
|
|
193
250
|
}, {
|
|
194
|
-
once: true
|
|
251
|
+
once: true,
|
|
252
|
+
onError: handleUnmanagedError
|
|
195
253
|
});
|
|
196
254
|
// Can occur multiple times.
|
|
197
|
-
runtime
|
|
255
|
+
addProtectedListener(runtime, LocalModuleDeferredRegistrationFailedEvent, (payload)=>{
|
|
198
256
|
const registrationError = payload;
|
|
199
257
|
if (localModuleDeferredRegistrationSpan) {
|
|
200
258
|
traceError(localModuleRegistrationSpan, registrationError);
|
|
201
259
|
}
|
|
260
|
+
}, {
|
|
261
|
+
onError: handleUnmanagedError
|
|
202
262
|
});
|
|
203
|
-
runtime
|
|
263
|
+
addProtectedListener(runtime, RemoteModulesRegistrationStartedEvent, (payload)=>{
|
|
204
264
|
const attributes = {
|
|
205
265
|
"app.squide.remote_count": payload.remoteCount
|
|
206
266
|
};
|
|
@@ -214,9 +274,10 @@ function registerTrackingListeners(runtime) {
|
|
|
214
274
|
}, context);
|
|
215
275
|
});
|
|
216
276
|
}, {
|
|
217
|
-
once: true
|
|
277
|
+
once: true,
|
|
278
|
+
onError: handleUnmanagedError
|
|
218
279
|
});
|
|
219
|
-
runtime
|
|
280
|
+
addProtectedListener(runtime, RemoteModulesRegistrationCompletedEvent, (payload)=>{
|
|
220
281
|
if (bootstrappingSpan) {
|
|
221
282
|
bootstrappingSpan.addEvent("remote-module-registration-completed", {
|
|
222
283
|
"app.squide.remote_count": payload.remoteCount
|
|
@@ -226,16 +287,19 @@ function registerTrackingListeners(runtime) {
|
|
|
226
287
|
remoteModuleRegistrationSpan.end();
|
|
227
288
|
}
|
|
228
289
|
}, {
|
|
229
|
-
once: true
|
|
290
|
+
once: true,
|
|
291
|
+
onError: handleUnmanagedError
|
|
230
292
|
});
|
|
231
293
|
// Can occur multiple times.
|
|
232
|
-
runtime
|
|
294
|
+
addProtectedListener(runtime, RemoteModuleRegistrationFailedEvent, (payload)=>{
|
|
233
295
|
const registrationError = payload;
|
|
234
296
|
if (remoteModuleRegistrationSpan) {
|
|
235
297
|
traceError(remoteModuleRegistrationSpan, registrationError);
|
|
236
298
|
}
|
|
299
|
+
}, {
|
|
300
|
+
onError: handleUnmanagedError
|
|
237
301
|
});
|
|
238
|
-
runtime
|
|
302
|
+
addProtectedListener(runtime, RemoteModulesDeferredRegistrationStartedEvent, (payload)=>{
|
|
239
303
|
const attributes = {
|
|
240
304
|
"app.squide.registration_count": payload.registrationCount
|
|
241
305
|
};
|
|
@@ -249,9 +313,10 @@ function registerTrackingListeners(runtime) {
|
|
|
249
313
|
}, context);
|
|
250
314
|
});
|
|
251
315
|
}, {
|
|
252
|
-
once: true
|
|
316
|
+
once: true,
|
|
317
|
+
onError: handleUnmanagedError
|
|
253
318
|
});
|
|
254
|
-
runtime
|
|
319
|
+
addProtectedListener(runtime, RemoteModulesDeferredRegistrationCompletedEvent, (payload)=>{
|
|
255
320
|
if (bootstrappingSpan) {
|
|
256
321
|
bootstrappingSpan.addEvent("remote-module-deferred-registration-completed", {
|
|
257
322
|
"app.squide.registration_count": payload.registrationCount
|
|
@@ -261,14 +326,17 @@ function registerTrackingListeners(runtime) {
|
|
|
261
326
|
remoteModuleDeferredRegistrationSpan.end();
|
|
262
327
|
}
|
|
263
328
|
}, {
|
|
264
|
-
once: true
|
|
329
|
+
once: true,
|
|
330
|
+
onError: handleUnmanagedError
|
|
265
331
|
});
|
|
266
332
|
// Can occur multiple times.
|
|
267
|
-
runtime
|
|
333
|
+
addProtectedListener(runtime, RemoteModuleDeferredRegistrationFailedEvent, (payload)=>{
|
|
268
334
|
const registrationError = payload;
|
|
269
335
|
if (remoteModuleDeferredRegistrationSpan) {
|
|
270
336
|
traceError(remoteModuleDeferredRegistrationSpan, registrationError);
|
|
271
337
|
}
|
|
338
|
+
}, {
|
|
339
|
+
onError: handleUnmanagedError
|
|
272
340
|
});
|
|
273
341
|
const handleFetchDataStarted = ()=>{
|
|
274
342
|
dataFetchSpan = startActiveChildSpan(bootstrappingSpan, (options, context)=>{
|
|
@@ -315,36 +383,43 @@ function registerTrackingListeners(runtime) {
|
|
|
315
383
|
// will be aborted and a react-router error boundary will be rendered.
|
|
316
384
|
if (bootstrappingSpan) {
|
|
317
385
|
bootstrappingSpan.end();
|
|
386
|
+
bootstrappingSpanHasEnded = true;
|
|
318
387
|
}
|
|
319
388
|
}
|
|
320
389
|
};
|
|
321
|
-
reduceDataFetchEvents(runtime, handleFetchDataStarted, handleDataReady, handlePublicDataFetchStarted, handlePublicDataReady, handleProtectedDataFetchStarted, handleProtectedDataReady, handleDataFetchFailed);
|
|
322
|
-
runtime
|
|
390
|
+
reduceDataFetchEvents(runtime, handleFetchDataStarted, handleDataReady, handlePublicDataFetchStarted, handlePublicDataReady, handleProtectedDataFetchStarted, handleProtectedDataReady, handleDataFetchFailed, handleUnmanagedError);
|
|
391
|
+
addProtectedListener(runtime, ModulesRegisteredEvent, ()=>{
|
|
323
392
|
if (bootstrappingSpan) {
|
|
324
393
|
bootstrappingSpan.addEvent("modules-registered");
|
|
325
394
|
}
|
|
326
395
|
}, {
|
|
327
|
-
once: true
|
|
396
|
+
once: true,
|
|
397
|
+
onError: handleUnmanagedError
|
|
328
398
|
});
|
|
329
|
-
runtime
|
|
399
|
+
addProtectedListener(runtime, ModulesReadyEvent, ()=>{
|
|
330
400
|
if (bootstrappingSpan) {
|
|
331
401
|
bootstrappingSpan.addEvent("modules-ready");
|
|
332
402
|
}
|
|
333
403
|
}, {
|
|
334
|
-
once: true
|
|
404
|
+
once: true,
|
|
405
|
+
onError: handleUnmanagedError
|
|
335
406
|
});
|
|
336
407
|
// Can occur multiple times.
|
|
337
|
-
runtime
|
|
408
|
+
addProtectedListener(runtime, DeferredRegistrationsUpdateStartedEvent, ()=>{
|
|
338
409
|
deferredRegistrationsUpdateSpan = startSpan((options, context)=>getTracer().startSpan("squide-deferred-registrations-update", options, context));
|
|
410
|
+
}, {
|
|
411
|
+
onError: handleUnmanagedError
|
|
339
412
|
});
|
|
340
413
|
// Can occur multiple times.
|
|
341
|
-
runtime
|
|
414
|
+
addProtectedListener(runtime, DeferredRegistrationsUpdateCompletedEvent, ()=>{
|
|
342
415
|
if (deferredRegistrationsUpdateSpan) {
|
|
343
416
|
deferredRegistrationsUpdateSpan.end();
|
|
344
417
|
}
|
|
418
|
+
}, {
|
|
419
|
+
onError: handleUnmanagedError
|
|
345
420
|
});
|
|
346
421
|
// Can occur multiple times.
|
|
347
|
-
runtime
|
|
422
|
+
addProtectedListener(runtime, LocalModulesDeferredRegistrationsUpdateStartedEvent, (payload)=>{
|
|
348
423
|
const attributes = {
|
|
349
424
|
"app.squide.registration_count": payload.registrationCount
|
|
350
425
|
};
|
|
@@ -362,9 +437,11 @@ function registerTrackingListeners(runtime) {
|
|
|
362
437
|
span
|
|
363
438
|
};
|
|
364
439
|
});
|
|
440
|
+
}, {
|
|
441
|
+
onError: handleUnmanagedError
|
|
365
442
|
});
|
|
366
443
|
// Can occur multiple times.
|
|
367
|
-
runtime
|
|
444
|
+
addProtectedListener(runtime, LocalModulesDeferredRegistrationsUpdateCompletedEvent, (payload)=>{
|
|
368
445
|
if (deferredRegistrationsUpdateSpan) {
|
|
369
446
|
deferredRegistrationsUpdateSpan.addEvent("local-module-deferred-registrations-update-completed", {
|
|
370
447
|
"app.squide.registration_count": payload.registrationCount
|
|
@@ -373,16 +450,20 @@ function registerTrackingListeners(runtime) {
|
|
|
373
450
|
if (localModuleDeferredRegistrationsUpdateSpan) {
|
|
374
451
|
endActiveSpan(localModuleDeferredRegistrationsUpdateSpan);
|
|
375
452
|
}
|
|
453
|
+
}, {
|
|
454
|
+
onError: handleUnmanagedError
|
|
376
455
|
});
|
|
377
456
|
// Can occur multiple times.
|
|
378
|
-
runtime
|
|
457
|
+
addProtectedListener(runtime, LocalModuleDeferredRegistrationUpdateFailedEvent, (payload)=>{
|
|
379
458
|
const registrationError = payload;
|
|
380
459
|
if (localModuleDeferredRegistrationsUpdateSpan) {
|
|
381
460
|
traceError(localModuleDeferredRegistrationsUpdateSpan.instance, registrationError);
|
|
382
461
|
}
|
|
462
|
+
}, {
|
|
463
|
+
onError: handleUnmanagedError
|
|
383
464
|
});
|
|
384
465
|
// Can occur multiple times.
|
|
385
|
-
runtime
|
|
466
|
+
addProtectedListener(runtime, RemoteModulesDeferredRegistrationsUpdateStartedEvent, (payload)=>{
|
|
386
467
|
const attributes = {
|
|
387
468
|
"app.squide.registration_count": payload.registrationCount
|
|
388
469
|
};
|
|
@@ -400,9 +481,11 @@ function registerTrackingListeners(runtime) {
|
|
|
400
481
|
span
|
|
401
482
|
};
|
|
402
483
|
});
|
|
484
|
+
}, {
|
|
485
|
+
onError: handleUnmanagedError
|
|
403
486
|
});
|
|
404
487
|
// Can occur multiple times.
|
|
405
|
-
runtime
|
|
488
|
+
addProtectedListener(runtime, RemoteModulesDeferredRegistrationsUpdateCompletedEvent, (payload)=>{
|
|
406
489
|
if (deferredRegistrationsUpdateSpan) {
|
|
407
490
|
deferredRegistrationsUpdateSpan.addEvent("remote-module-deferred-registrations-update-completed", {
|
|
408
491
|
"app.squide.registration_count": payload.registrationCount
|
|
@@ -411,13 +494,17 @@ function registerTrackingListeners(runtime) {
|
|
|
411
494
|
if (remoteModuleDeferredRegistrationsUpdateSpan) {
|
|
412
495
|
endActiveSpan(remoteModuleDeferredRegistrationsUpdateSpan);
|
|
413
496
|
}
|
|
497
|
+
}, {
|
|
498
|
+
onError: handleUnmanagedError
|
|
414
499
|
});
|
|
415
500
|
// Can occur multiple times.
|
|
416
|
-
runtime
|
|
501
|
+
addProtectedListener(runtime, RemoteModuleDeferredRegistrationUpdateFailedEvent, (payload)=>{
|
|
417
502
|
const registrationError = payload;
|
|
418
503
|
if (remoteModuleDeferredRegistrationsUpdateSpan) {
|
|
419
504
|
traceError(remoteModuleDeferredRegistrationsUpdateSpan.instance, registrationError);
|
|
420
505
|
}
|
|
506
|
+
}, {
|
|
507
|
+
onError: handleUnmanagedError
|
|
421
508
|
});
|
|
422
509
|
}
|
|
423
510
|
function getRegisterFetchRequestHookFunction() {
|
|
@@ -434,17 +521,21 @@ function getRegisterFetchRequestHookFunction() {
|
|
|
434
521
|
return globalThis.__WLP_HONEYCOMB_REGISTER_DYNAMIC_FETCH_REQUEST_HOOK;
|
|
435
522
|
}
|
|
436
523
|
function registerHoneycombInstrumentation(runtime) {
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
524
|
+
try {
|
|
525
|
+
const registerFetchRequestHookFunction = getRegisterFetchRequestHookFunction();
|
|
526
|
+
if (registerFetchRequestHookFunction) {
|
|
527
|
+
registerActiveSpanStack();
|
|
528
|
+
const activeSpanOverrideFunction = createOverrideFetchRequestSpanWithActiveSpanContext(runtime.logger);
|
|
529
|
+
// Dynamically registering this request hook function to nest the HTTP requests
|
|
530
|
+
// of squide bootstrapping under the appropriate Honeycomb span.
|
|
531
|
+
registerFetchRequestHookFunction(activeSpanOverrideFunction);
|
|
532
|
+
} else {
|
|
533
|
+
runtime.logger.warning("[squide] Cannot register Honeycomb fetch request hook because \"globalThis.__WLP_HONEYCOMB_REGISTER_DYNAMIC_FETCH_REQUEST_HOOK__\" is not available. Honeycomb instrumentation is still functional but in degraded mode.");
|
|
534
|
+
}
|
|
535
|
+
registerTrackingListeners(runtime);
|
|
536
|
+
} catch (error) {
|
|
537
|
+
runtime.logger.withText("[squide] An error occurred while registering Honeycomb instrumentation:").withError(error).error();
|
|
446
538
|
}
|
|
447
|
-
registerTrackingListeners(runtime);
|
|
448
539
|
}
|
|
449
540
|
|
|
450
541
|
export { reduceDataFetchEvents, registerHoneycombInstrumentation };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"honeycomb/registerHoneycombInstrumentation.js","sources":["webpack://@squide/firefly/./src/honeycomb/registerHoneycombInstrumentation.ts"],"sourcesContent":["import type { Span } from \"@opentelemetry/api\";\nimport {\n LocalModuleDeferredRegistrationFailedEvent,\n LocalModuleDeferredRegistrationUpdateFailedEvent,\n LocalModuleRegistrationFailedEvent,\n LocalModulesDeferredRegistrationCompletedEvent,\n type LocalModulesDeferredRegistrationCompletedEventPayload,\n LocalModulesDeferredRegistrationStartedEvent,\n type LocalModulesDeferredRegistrationStartedEventPayload,\n LocalModulesDeferredRegistrationsUpdateCompletedEvent,\n type LocalModulesDeferredRegistrationsUpdateCompletedEventPayload,\n LocalModulesDeferredRegistrationsUpdateStartedEvent,\n type LocalModulesDeferredRegistrationsUpdateStartedEventPayload,\n LocalModulesRegistrationCompletedEvent,\n type LocalModulesRegistrationCompletedEventPayload,\n LocalModulesRegistrationStartedEvent,\n type LocalModulesRegistrationStartedEventPayload,\n type ModuleRegistrationError\n} from \"@squide/core\";\nimport {\n DeferredRegistrationsUpdateCompletedEvent,\n DeferredRegistrationsUpdateStartedEvent,\n RemoteModuleDeferredRegistrationFailedEvent,\n RemoteModuleDeferredRegistrationUpdateFailedEvent,\n type RemoteModuleRegistrationError,\n RemoteModuleRegistrationFailedEvent,\n RemoteModulesDeferredRegistrationCompletedEvent,\n type RemoteModulesDeferredRegistrationCompletedEventPayload,\n RemoteModulesDeferredRegistrationStartedEvent,\n type RemoteModulesDeferredRegistrationStartedEventPayload,\n RemoteModulesDeferredRegistrationsUpdateCompletedEvent,\n type RemoteModulesDeferredRegistrationsUpdateCompletedEventPayload,\n RemoteModulesDeferredRegistrationsUpdateStartedEvent,\n type RemoteModulesDeferredRegistrationsUpdateStartedEventPayload,\n RemoteModulesRegistrationCompletedEvent,\n type RemoteModulesRegistrationCompletedEventPayload,\n RemoteModulesRegistrationStartedEvent,\n type RemoteModulesRegistrationStartedEventPayload\n} from \"@squide/module-federation\";\nimport { ApplicationBoostrappedEvent, type AppRouterWaitState, ModulesReadyEvent, ModulesRegisteredEvent, MswReadyEvent, ProtectedDataReadyEvent, PublicDataReadyEvent } from \"../AppRouterReducer.ts\";\nimport type { FireflyRuntime } from \"../FireflyRuntime.tsx\";\nimport { ApplicationBootstrappingStartedEvent } from \"../initializeFirefly.ts\";\nimport { ProtectedDataFetchFailedEvent, ProtectedDataFetchStartedEvent } from \"../useProtectedDataQueries.ts\";\nimport { PublicDataFetchFailedEvent, PublicDataFetchStartedEvent } from \"../usePublicDataQueries.ts\";\nimport { type ActiveSpan, createOverrideFetchRequestSpanWithActiveSpanContext, registerActiveSpanStack } from \"./activeSpan.ts\";\nimport { getTracer } from \"./tracer.ts\";\nimport { endActiveSpan, startActiveChildSpan, startChildSpan, startSpan, traceError } from \"./utils.ts\";\n\n// TIPS:\n// To query those traces in Honeycomb, use the following query filter: \"root.name = squide-bootstrapping\".\n\ntype DataFetchState = \"none\" | \"fetching-data\" | \"public-data-ready\" | \"protected-data-ready\" | \"data-ready\" | \"data-fetch-failed\";\n\nexport function reduceDataFetchEvents(\n runtime: FireflyRuntime,\n onDataFetchStarted: () => void,\n onDataReady: () => void,\n onPublicDataFetchStarted: () => void,\n onPublicDataReady: () => void,\n onProtectedDataFetchStarted: () => void,\n onProtectedDataReady: () => void,\n onDataFetchFailed: (queriesErrors: Error[]) => void\n) {\n let dataFetchState: DataFetchState = \"none\";\n\n runtime.eventBus.addListener(PublicDataFetchStartedEvent, () => {\n if (dataFetchState === \"none\") {\n dataFetchState = \"fetching-data\";\n onDataFetchStarted();\n }\n\n onPublicDataFetchStarted();\n }, { once: true });\n\n runtime.eventBus.addListener(PublicDataReadyEvent, payload => {\n onPublicDataReady();\n\n if (dataFetchState === \"fetching-data\") {\n if (payload && !(payload as AppRouterWaitState).waitForProtectedData) {\n dataFetchState = \"data-ready\";\n onDataReady();\n } else {\n dataFetchState = \"public-data-ready\";\n }\n } else if (dataFetchState === \"protected-data-ready\") {\n dataFetchState = \"data-ready\";\n onDataReady();\n }\n }, { once: true });\n\n runtime.eventBus.addListener(ProtectedDataFetchStartedEvent, () => {\n if (dataFetchState === \"none\") {\n dataFetchState = \"fetching-data\";\n onDataFetchStarted();\n }\n\n onProtectedDataFetchStarted();\n }, { once: true });\n\n runtime.eventBus.addListener(ProtectedDataReadyEvent, payload => {\n onProtectedDataReady();\n\n if (dataFetchState === \"fetching-data\") {\n if (payload && !(payload as AppRouterWaitState).waitForPublicData) {\n dataFetchState = \"data-ready\";\n onDataReady();\n } else {\n dataFetchState = \"protected-data-ready\";\n }\n } else if (dataFetchState === \"public-data-ready\") {\n dataFetchState = \"data-ready\";\n onDataReady();\n }\n }, { once: true });\n\n const handleDataFetchFailed = (payload: unknown) => {\n if (dataFetchState !== \"data-fetch-failed\") {\n dataFetchState = \"data-fetch-failed\";\n\n onDataFetchFailed(payload as Error[]);\n }\n };\n\n runtime.eventBus.addListener(PublicDataFetchFailedEvent, handleDataFetchFailed, { once: true });\n runtime.eventBus.addListener(ProtectedDataFetchFailedEvent, handleDataFetchFailed, { once: true });\n}\n\nfunction registerTrackingListeners(runtime: FireflyRuntime) {\n let bootstrappingSpan: Span;\n let localModuleRegistrationSpan: Span;\n let localModuleDeferredRegistrationSpan: Span;\n let remoteModuleRegistrationSpan: Span;\n let remoteModuleDeferredRegistrationSpan: Span;\n let dataFetchSpan: ActiveSpan;\n let deferredRegistrationsUpdateSpan: Span;\n let localModuleDeferredRegistrationsUpdateSpan: ActiveSpan;\n let remoteModuleDeferredRegistrationsUpdateSpan: ActiveSpan;\n\n runtime.eventBus.addListener(ApplicationBootstrappingStartedEvent, () => {\n bootstrappingSpan = startSpan((options, context) => getTracer().startSpan(\"squide-bootstrapping\", options, context));\n }, { once: true });\n\n runtime.eventBus.addListener(ApplicationBoostrappedEvent, () => {\n if (bootstrappingSpan) {\n bootstrappingSpan.end();\n }\n }, { once: true });\n\n runtime.eventBus.addListener(MswReadyEvent, () => {\n if (bootstrappingSpan) {\n bootstrappingSpan.addEvent(\"msw-ready\");\n }\n }, { once: true });\n\n runtime.eventBus.addListener(LocalModulesRegistrationStartedEvent, (payload: unknown) => {\n const attributes = {\n \"app.squide.module_count\": (payload as LocalModulesRegistrationStartedEventPayload).moduleCount\n };\n\n if (bootstrappingSpan) {\n bootstrappingSpan.addEvent(\"local-module-registration-started\", attributes);\n }\n\n localModuleRegistrationSpan = startChildSpan(bootstrappingSpan, (options, context) => {\n return getTracer().startSpan(\"local-module-registration\", { ...options, attributes }, context);\n });\n }, { once: true });\n\n runtime.eventBus.addListener(LocalModulesRegistrationCompletedEvent, (payload: unknown) => {\n if (bootstrappingSpan) {\n bootstrappingSpan.addEvent(\"local-module-registration-completed\", {\n \"app.squide.module_count\": (payload as LocalModulesRegistrationCompletedEventPayload).moduleCount\n });\n }\n\n if (localModuleRegistrationSpan) {\n localModuleRegistrationSpan.end();\n }\n }, { once: true });\n\n // Can occur multiple times.\n runtime.eventBus.addListener(LocalModuleRegistrationFailedEvent, (payload: unknown) => {\n const registrationError = payload as ModuleRegistrationError;\n\n if (localModuleRegistrationSpan) {\n traceError(localModuleRegistrationSpan, registrationError);\n }\n });\n\n runtime.eventBus.addListener(LocalModulesDeferredRegistrationStartedEvent, (payload: unknown) => {\n const attributes = {\n \"app.squide.registration_count\": (payload as LocalModulesDeferredRegistrationStartedEventPayload).registrationCount\n };\n\n if (bootstrappingSpan) {\n bootstrappingSpan.addEvent(\"local-module-deferred-registration-started\", attributes);\n }\n\n localModuleDeferredRegistrationSpan = startChildSpan(bootstrappingSpan, (options, context) => {\n return getTracer().startSpan(\"local-module-deferred-registration\", { ...options, attributes }, context);\n });\n }, { once: true });\n\n runtime.eventBus.addListener(LocalModulesDeferredRegistrationCompletedEvent, (payload: unknown) => {\n if (bootstrappingSpan) {\n bootstrappingSpan.addEvent(\"local-module-deferred-registration-completed\", {\n \"app.squide.registration_count\": (payload as LocalModulesDeferredRegistrationCompletedEventPayload).registrationCount\n });\n }\n\n if (localModuleDeferredRegistrationSpan) {\n localModuleDeferredRegistrationSpan.end();\n }\n }, { once: true });\n\n // Can occur multiple times.\n runtime.eventBus.addListener(LocalModuleDeferredRegistrationFailedEvent, (payload: unknown) => {\n const registrationError = payload as ModuleRegistrationError;\n\n if (localModuleDeferredRegistrationSpan) {\n traceError(localModuleRegistrationSpan, registrationError);\n }\n });\n\n runtime.eventBus.addListener(RemoteModulesRegistrationStartedEvent, (payload: unknown) => {\n const attributes = {\n \"app.squide.remote_count\": (payload as RemoteModulesRegistrationStartedEventPayload).remoteCount\n };\n\n if (bootstrappingSpan) {\n bootstrappingSpan.addEvent(\"remote-module-registration-started\", attributes);\n }\n\n remoteModuleRegistrationSpan = startChildSpan(bootstrappingSpan, (options, context) => {\n return getTracer().startSpan(\"remote-module-registration\", { ...options, attributes }, context);\n });\n }, { once: true });\n\n runtime.eventBus.addListener(RemoteModulesRegistrationCompletedEvent, (payload: unknown) => {\n if (bootstrappingSpan) {\n bootstrappingSpan.addEvent(\"remote-module-registration-completed\", {\n \"app.squide.remote_count\": (payload as RemoteModulesRegistrationCompletedEventPayload).remoteCount\n });\n }\n\n if (remoteModuleRegistrationSpan) {\n remoteModuleRegistrationSpan.end();\n }\n }, { once: true });\n\n // Can occur multiple times.\n runtime.eventBus.addListener(RemoteModuleRegistrationFailedEvent, (payload: unknown) => {\n const registrationError = payload as RemoteModuleRegistrationError;\n\n if (remoteModuleRegistrationSpan) {\n traceError(remoteModuleRegistrationSpan, registrationError);\n }\n });\n\n runtime.eventBus.addListener(RemoteModulesDeferredRegistrationStartedEvent, (payload: unknown) => {\n const attributes = {\n \"app.squide.registration_count\": (payload as RemoteModulesDeferredRegistrationStartedEventPayload).registrationCount\n };\n\n if (bootstrappingSpan) {\n bootstrappingSpan.addEvent(\"remote-module-deferred-registration-started\", attributes);\n }\n\n remoteModuleDeferredRegistrationSpan = startChildSpan(bootstrappingSpan, (options, context) => {\n return getTracer().startSpan(\"remote-module-deferred-registration\", { ...options, attributes }, context);\n });\n }, { once: true });\n\n runtime.eventBus.addListener(RemoteModulesDeferredRegistrationCompletedEvent, (payload: unknown) => {\n if (bootstrappingSpan) {\n bootstrappingSpan.addEvent(\"remote-module-deferred-registration-completed\", {\n \"app.squide.registration_count\": (payload as RemoteModulesDeferredRegistrationCompletedEventPayload).registrationCount\n });\n }\n\n if (remoteModuleDeferredRegistrationSpan) {\n remoteModuleDeferredRegistrationSpan.end();\n }\n }, { once: true });\n\n // Can occur multiple times.\n runtime.eventBus.addListener(RemoteModuleDeferredRegistrationFailedEvent, (payload: unknown) => {\n const registrationError = payload as RemoteModuleRegistrationError;\n\n if (remoteModuleDeferredRegistrationSpan) {\n traceError(remoteModuleDeferredRegistrationSpan, registrationError);\n }\n });\n\n const handleFetchDataStarted = () => {\n dataFetchSpan = startActiveChildSpan(bootstrappingSpan, (options, context) => {\n const name = \"data-fetch\";\n const span = getTracer().startSpan(name, options, context);\n\n return {\n name,\n span\n };\n });\n };\n\n const handleDataReady = () => {\n if (dataFetchSpan) {\n endActiveSpan(dataFetchSpan);\n }\n };\n\n const handlePublicDataFetchStarted = () => {\n if (dataFetchSpan) {\n dataFetchSpan.instance.addEvent(\"public-data-fetch-started\");\n }\n };\n\n const handlePublicDataReady = () => {\n if (dataFetchSpan) {\n dataFetchSpan.instance.addEvent(\"public-data-ready\");\n }\n };\n\n const handleProtectedDataFetchStarted = () => {\n if (dataFetchSpan) {\n dataFetchSpan.instance.addEvent(\"protected-data-fetch-started\");\n }\n };\n\n const handleProtectedDataReady = () => {\n if (dataFetchSpan) {\n dataFetchSpan.instance.addEvent(\"protected-data-ready\");\n }\n };\n\n const handleDataFetchFailed = (queriesErrors: Error[]) => {\n if (dataFetchSpan) {\n queriesErrors.forEach(x => {\n traceError(dataFetchSpan.instance, x);\n });\n\n endActiveSpan(dataFetchSpan);\n\n // Global data fetch errors are unmanaged, which mean the host application bootstrapping flow\n // will be aborted and a react-router error boundary will be rendered.\n if (bootstrappingSpan) {\n bootstrappingSpan.end();\n }\n }\n };\n\n reduceDataFetchEvents(\n runtime,\n handleFetchDataStarted,\n handleDataReady,\n handlePublicDataFetchStarted,\n handlePublicDataReady,\n handleProtectedDataFetchStarted,\n handleProtectedDataReady,\n handleDataFetchFailed\n );\n\n runtime.eventBus.addListener(ModulesRegisteredEvent, () => {\n if (bootstrappingSpan) {\n bootstrappingSpan.addEvent(\"modules-registered\");\n }\n }, { once: true });\n\n runtime.eventBus.addListener(ModulesReadyEvent, () => {\n if (bootstrappingSpan) {\n bootstrappingSpan.addEvent(\"modules-ready\");\n }\n }, { once: true });\n\n // Can occur multiple times.\n runtime.eventBus.addListener(DeferredRegistrationsUpdateStartedEvent, () => {\n deferredRegistrationsUpdateSpan = startSpan((options, context) => getTracer().startSpan(\"squide-deferred-registrations-update\", options, context));\n });\n\n // Can occur multiple times.\n runtime.eventBus.addListener(DeferredRegistrationsUpdateCompletedEvent, () => {\n if (deferredRegistrationsUpdateSpan) {\n deferredRegistrationsUpdateSpan.end();\n }\n });\n\n // Can occur multiple times.\n runtime.eventBus.addListener(LocalModulesDeferredRegistrationsUpdateStartedEvent, (payload: unknown) => {\n const attributes = {\n \"app.squide.registration_count\": (payload as LocalModulesDeferredRegistrationsUpdateStartedEventPayload).registrationCount\n };\n\n if (deferredRegistrationsUpdateSpan) {\n deferredRegistrationsUpdateSpan.addEvent(\"local-module-deferred-registrations-update-started\", attributes);\n }\n\n localModuleDeferredRegistrationsUpdateSpan = startActiveChildSpan(deferredRegistrationsUpdateSpan, (options, context) => {\n const name = \"local-module-deferred-registrations-update\";\n\n const span = getTracer().startSpan(name, {\n attributes,\n ...options\n }, context);\n\n return {\n name,\n span\n };\n });\n });\n\n // Can occur multiple times.\n runtime.eventBus.addListener(LocalModulesDeferredRegistrationsUpdateCompletedEvent, (payload: unknown) => {\n if (deferredRegistrationsUpdateSpan) {\n deferredRegistrationsUpdateSpan.addEvent(\"local-module-deferred-registrations-update-completed\", {\n \"app.squide.registration_count\": (payload as LocalModulesDeferredRegistrationsUpdateCompletedEventPayload).registrationCount\n });\n }\n\n if (localModuleDeferredRegistrationsUpdateSpan) {\n endActiveSpan(localModuleDeferredRegistrationsUpdateSpan);\n }\n });\n\n // Can occur multiple times.\n runtime.eventBus.addListener(LocalModuleDeferredRegistrationUpdateFailedEvent, (payload: unknown) => {\n const registrationError = payload as ModuleRegistrationError;\n\n if (localModuleDeferredRegistrationsUpdateSpan) {\n traceError(localModuleDeferredRegistrationsUpdateSpan.instance, registrationError);\n }\n });\n\n // Can occur multiple times.\n runtime.eventBus.addListener(RemoteModulesDeferredRegistrationsUpdateStartedEvent, (payload: unknown) => {\n const attributes = {\n \"app.squide.registration_count\": (payload as RemoteModulesDeferredRegistrationsUpdateStartedEventPayload).registrationCount\n };\n\n if (deferredRegistrationsUpdateSpan) {\n deferredRegistrationsUpdateSpan.addEvent(\"remote-module-deferred-registrations-update-started\", attributes);\n }\n\n remoteModuleDeferredRegistrationsUpdateSpan = startActiveChildSpan(deferredRegistrationsUpdateSpan, (options, context) => {\n const name = \"remote-module-deferred-registrations-update\";\n\n const span = getTracer().startSpan(name, {\n attributes,\n ...options\n }, context);\n\n return {\n name,\n span\n };\n });\n });\n\n // Can occur multiple times.\n runtime.eventBus.addListener(RemoteModulesDeferredRegistrationsUpdateCompletedEvent, (payload: unknown) => {\n if (deferredRegistrationsUpdateSpan) {\n deferredRegistrationsUpdateSpan.addEvent(\"remote-module-deferred-registrations-update-completed\", {\n \"app.squide.registration_count\": (payload as RemoteModulesDeferredRegistrationsUpdateCompletedEventPayload).registrationCount\n });\n }\n\n if (remoteModuleDeferredRegistrationsUpdateSpan) {\n endActiveSpan(remoteModuleDeferredRegistrationsUpdateSpan);\n }\n });\n\n // Can occur multiple times.\n runtime.eventBus.addListener(RemoteModuleDeferredRegistrationUpdateFailedEvent, (payload: unknown) => {\n const registrationError = payload as RemoteModuleRegistrationError;\n\n if (remoteModuleDeferredRegistrationsUpdateSpan) {\n traceError(remoteModuleDeferredRegistrationsUpdateSpan.instance, registrationError);\n }\n });\n}\n\nfunction getRegisterFetchRequestHookFunction() {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n if (globalThis.__WLP_HONEYCOMB_REGISTER_DYNAMIC_FETCH_REQUEST_HOOK__) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n return globalThis.__WLP_HONEYCOMB_REGISTER_DYNAMIC_FETCH_REQUEST_HOOK__;\n }\n\n // Fallback to fix an error. Will remove soon.\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n return globalThis.__WLP_HONEYCOMB_REGISTER_DYNAMIC_FETCH_REQUEST_HOOK;\n}\n\nexport function registerHoneycombInstrumentation(runtime: FireflyRuntime) {\n const registerFetchRequestHookFunction = getRegisterFetchRequestHookFunction();\n\n if (registerFetchRequestHookFunction) {\n registerActiveSpanStack();\n\n const activeSpanOverrideFunction = createOverrideFetchRequestSpanWithActiveSpanContext(runtime.logger);\n\n // Dynamically registering this request hook function to nest the HTTP requests\n // of squide bootstrapping under the appropriate Honeycomb span.\n registerFetchRequestHookFunction(activeSpanOverrideFunction);\n } else {\n runtime.logger.warning(\"[squide] Cannot register Honeycomb fetch request hook because \\\"globalThis.__WLP_HONEYCOMB_REGISTER_DYNAMIC_FETCH_REQUEST_HOOK__\\\" is not available. Honeycomb instrumentation is still functional but in degraded mode.\");\n }\n\n registerTrackingListeners(runtime);\n}\n"],"names":["LocalModuleDeferredRegistrationFailedEvent","LocalModuleDeferredRegistrationUpdateFailedEvent","LocalModuleRegistrationFailedEvent","LocalModulesDeferredRegistrationCompletedEvent","LocalModulesDeferredRegistrationStartedEvent","LocalModulesDeferredRegistrationsUpdateCompletedEvent","LocalModulesDeferredRegistrationsUpdateStartedEvent","LocalModulesRegistrationCompletedEvent","LocalModulesRegistrationStartedEvent","DeferredRegistrationsUpdateCompletedEvent","DeferredRegistrationsUpdateStartedEvent","RemoteModuleDeferredRegistrationFailedEvent","RemoteModuleDeferredRegistrationUpdateFailedEvent","RemoteModuleRegistrationFailedEvent","RemoteModulesDeferredRegistrationCompletedEvent","RemoteModulesDeferredRegistrationStartedEvent","RemoteModulesDeferredRegistrationsUpdateCompletedEvent","RemoteModulesDeferredRegistrationsUpdateStartedEvent","RemoteModulesRegistrationCompletedEvent","RemoteModulesRegistrationStartedEvent","ApplicationBoostrappedEvent","ModulesReadyEvent","ModulesRegisteredEvent","MswReadyEvent","ProtectedDataReadyEvent","PublicDataReadyEvent","ApplicationBootstrappingStartedEvent","ProtectedDataFetchFailedEvent","ProtectedDataFetchStartedEvent","PublicDataFetchFailedEvent","PublicDataFetchStartedEvent","createOverrideFetchRequestSpanWithActiveSpanContext","registerActiveSpanStack","getTracer","endActiveSpan","startActiveChildSpan","startChildSpan","startSpan","traceError","reduceDataFetchEvents","runtime","onDataFetchStarted","onDataReady","onPublicDataFetchStarted","onPublicDataReady","onProtectedDataFetchStarted","onProtectedDataReady","onDataFetchFailed","dataFetchState","payload","handleDataFetchFailed","registerTrackingListeners","bootstrappingSpan","localModuleRegistrationSpan","localModuleDeferredRegistrationSpan","remoteModuleRegistrationSpan","remoteModuleDeferredRegistrationSpan","dataFetchSpan","deferredRegistrationsUpdateSpan","localModuleDeferredRegistrationsUpdateSpan","remoteModuleDeferredRegistrationsUpdateSpan","options","context","attributes","registrationError","handleFetchDataStarted","name","span","handleDataReady","handlePublicDataFetchStarted","handlePublicDataReady","handleProtectedDataFetchStarted","handleProtectedDataReady","queriesErrors","x","getRegisterFetchRequestHookFunction","globalThis","registerHoneycombInstrumentation","registerFetchRequestHookFunction","activeSpanOverrideFunction"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkBsB;AAoBa;AACoK;AAExH;AAC+B;AACT;AAC2B;AACxF;AACgE;AAOjG,SAASuC,sBACZC,OAAuB,EACvBC,kBAA8B,EAC9BC,WAAuB,EACvBC,wBAAoC,EACpCC,iBAA6B,EAC7BC,2BAAuC,EACvCC,oBAAgC,EAChCC,iBAAmD;IAEnD,IAAIC,iBAAiC;IAErCR,QAAQ,QAAQ,CAAC,WAAW,CAACV,2BAA2BA,EAAE;QACtD,IAAIkB,mBAAmB,QAAQ;YAC3BA,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B;IAEAW,0BAA0BX;AAC9B"}
|
|
1
|
+
{"version":3,"file":"honeycomb/registerHoneycombInstrumentation.js","sources":["webpack://@squide/firefly/./src/honeycomb/registerHoneycombInstrumentation.ts"],"sourcesContent":["import type { Span } from \"@opentelemetry/api\";\nimport {\n type AddListenerOptions,\n type EventCallbackFunction,\n type EventName,\n LocalModuleDeferredRegistrationFailedEvent,\n LocalModuleDeferredRegistrationUpdateFailedEvent,\n LocalModuleRegistrationFailedEvent,\n LocalModulesDeferredRegistrationCompletedEvent,\n type LocalModulesDeferredRegistrationCompletedEventPayload,\n LocalModulesDeferredRegistrationStartedEvent,\n type LocalModulesDeferredRegistrationStartedEventPayload,\n LocalModulesDeferredRegistrationsUpdateCompletedEvent,\n type LocalModulesDeferredRegistrationsUpdateCompletedEventPayload,\n LocalModulesDeferredRegistrationsUpdateStartedEvent,\n type LocalModulesDeferredRegistrationsUpdateStartedEventPayload,\n LocalModulesRegistrationCompletedEvent,\n type LocalModulesRegistrationCompletedEventPayload,\n LocalModulesRegistrationStartedEvent,\n type LocalModulesRegistrationStartedEventPayload,\n type ModuleRegistrationError\n} from \"@squide/core\";\nimport {\n DeferredRegistrationsUpdateCompletedEvent,\n DeferredRegistrationsUpdateStartedEvent,\n RemoteModuleDeferredRegistrationFailedEvent,\n RemoteModuleDeferredRegistrationUpdateFailedEvent,\n type RemoteModuleRegistrationError,\n RemoteModuleRegistrationFailedEvent,\n RemoteModulesDeferredRegistrationCompletedEvent,\n type RemoteModulesDeferredRegistrationCompletedEventPayload,\n RemoteModulesDeferredRegistrationStartedEvent,\n type RemoteModulesDeferredRegistrationStartedEventPayload,\n RemoteModulesDeferredRegistrationsUpdateCompletedEvent,\n type RemoteModulesDeferredRegistrationsUpdateCompletedEventPayload,\n RemoteModulesDeferredRegistrationsUpdateStartedEvent,\n type RemoteModulesDeferredRegistrationsUpdateStartedEventPayload,\n RemoteModulesRegistrationCompletedEvent,\n type RemoteModulesRegistrationCompletedEventPayload,\n RemoteModulesRegistrationStartedEvent,\n type RemoteModulesRegistrationStartedEventPayload\n} from \"@squide/module-federation\";\nimport { ApplicationBoostrappedEvent, type AppRouterWaitState, ModulesReadyEvent, ModulesRegisteredEvent, MswReadyEvent, ProtectedDataReadyEvent, PublicDataReadyEvent } from \"../AppRouterReducer.ts\";\nimport type { FireflyRuntime } from \"../FireflyRuntime.tsx\";\nimport { ApplicationBootstrappingStartedEvent } from \"../initializeFirefly.ts\";\nimport { ProtectedDataFetchFailedEvent, ProtectedDataFetchStartedEvent } from \"../useProtectedDataQueries.ts\";\nimport { PublicDataFetchFailedEvent, PublicDataFetchStartedEvent } from \"../usePublicDataQueries.ts\";\nimport { type ActiveSpan, createOverrideFetchRequestSpanWithActiveSpanContext, registerActiveSpanStack } from \"./activeSpan.ts\";\nimport { getTracer } from \"./tracer.ts\";\nimport { endActiveSpan, startActiveChildSpan, startChildSpan, startSpan, traceError } from \"./utils.ts\";\n\n// TIPS:\n// To query those traces in Honeycomb, use the following query filter: \"root.name = squide-bootstrapping\".\n\ninterface AddProtectedListenerOptions extends AddListenerOptions {\n onError?: (error: unknown) => void;\n}\n\nfunction addProtectedListener(runtime: FireflyRuntime, eventName: EventName, callback: EventCallbackFunction, options?: AddProtectedListenerOptions) {\n const protectedCallback = (...args: unknown[]) => {\n try {\n callback(...args);\n } catch (error: unknown) {\n runtime.logger\n .withText(`[squide] An unmanaged error occurred while handling event \"${eventName.toString()}\" for Honeycomb instrumentation:`)\n .withError(error as Error)\n .error();\n }\n };\n\n runtime.eventBus.addListener(eventName, protectedCallback, options);\n}\n\ntype DataFetchState = \"none\" | \"fetching-data\" | \"public-data-ready\" | \"protected-data-ready\" | \"data-ready\" | \"data-fetch-failed\";\n\nexport function reduceDataFetchEvents(\n runtime: FireflyRuntime,\n onDataFetchStarted: () => void,\n onDataReady: () => void,\n onPublicDataFetchStarted: () => void,\n onPublicDataReady: () => void,\n onProtectedDataFetchStarted: () => void,\n onProtectedDataReady: () => void,\n onDataFetchFailed: (queriesErrors: Error[]) => void,\n onUnmanagedError: (error: unknown) => void\n) {\n let dataFetchState: DataFetchState = \"none\";\n\n addProtectedListener(runtime, PublicDataFetchStartedEvent, () => {\n if (dataFetchState === \"none\") {\n dataFetchState = \"fetching-data\";\n onDataFetchStarted();\n }\n\n onPublicDataFetchStarted();\n }, {\n once: true,\n onError: onUnmanagedError\n });\n\n addProtectedListener(runtime, PublicDataReadyEvent, payload => {\n onPublicDataReady();\n\n if (dataFetchState === \"fetching-data\") {\n if (payload && !(payload as AppRouterWaitState).waitForProtectedData) {\n dataFetchState = \"data-ready\";\n onDataReady();\n } else {\n dataFetchState = \"public-data-ready\";\n }\n } else if (dataFetchState === \"protected-data-ready\") {\n dataFetchState = \"data-ready\";\n onDataReady();\n }\n }, {\n once: true,\n onError: onUnmanagedError\n });\n\n addProtectedListener(runtime, ProtectedDataFetchStartedEvent, () => {\n if (dataFetchState === \"none\") {\n dataFetchState = \"fetching-data\";\n onDataFetchStarted();\n }\n\n onProtectedDataFetchStarted();\n }, {\n once: true,\n onError: onUnmanagedError\n });\n\n addProtectedListener(runtime, ProtectedDataReadyEvent, payload => {\n onProtectedDataReady();\n\n if (dataFetchState === \"fetching-data\") {\n if (payload && !(payload as AppRouterWaitState).waitForPublicData) {\n dataFetchState = \"data-ready\";\n onDataReady();\n } else {\n dataFetchState = \"protected-data-ready\";\n }\n } else if (dataFetchState === \"public-data-ready\") {\n dataFetchState = \"data-ready\";\n onDataReady();\n }\n }, {\n once: true,\n onError: onUnmanagedError\n });\n\n const handleDataFetchFailed = (payload: unknown) => {\n if (dataFetchState !== \"data-fetch-failed\") {\n dataFetchState = \"data-fetch-failed\";\n\n onDataFetchFailed(payload as Error[]);\n }\n };\n\n addProtectedListener(runtime, PublicDataFetchFailedEvent, handleDataFetchFailed, {\n once: true,\n onError: onUnmanagedError\n });\n\n addProtectedListener(runtime, ProtectedDataFetchFailedEvent, handleDataFetchFailed, {\n once: true,\n onError: onUnmanagedError\n });\n}\n\nfunction registerTrackingListeners(runtime: FireflyRuntime) {\n let bootstrappingSpan: Span;\n let bootstrappingSpanHasEnded: boolean = false;\n let localModuleRegistrationSpan: Span;\n let localModuleDeferredRegistrationSpan: Span;\n let remoteModuleRegistrationSpan: Span;\n let remoteModuleDeferredRegistrationSpan: Span;\n let dataFetchSpan: ActiveSpan;\n let deferredRegistrationsUpdateSpan: Span;\n let localModuleDeferredRegistrationsUpdateSpan: ActiveSpan;\n let remoteModuleDeferredRegistrationsUpdateSpan: ActiveSpan;\n\n const handleUnmanagedError = (error: unknown) => {\n if (bootstrappingSpan && !bootstrappingSpanHasEnded) {\n traceError(bootstrappingSpan, error as Error);\n\n bootstrappingSpan.end();\n bootstrappingSpanHasEnded = true;\n }\n\n if (localModuleRegistrationSpan) {\n localModuleRegistrationSpan.end();\n }\n\n if (localModuleDeferredRegistrationSpan) {\n localModuleDeferredRegistrationSpan.end();\n }\n\n if (remoteModuleRegistrationSpan) {\n remoteModuleRegistrationSpan.end();\n }\n\n if (remoteModuleDeferredRegistrationSpan) {\n remoteModuleDeferredRegistrationSpan.end();\n }\n\n if (dataFetchSpan) {\n dataFetchSpan.instance.end();\n }\n\n if (deferredRegistrationsUpdateSpan) {\n deferredRegistrationsUpdateSpan.end();\n }\n\n if (localModuleDeferredRegistrationsUpdateSpan) {\n localModuleDeferredRegistrationsUpdateSpan.instance.end();\n }\n\n if (remoteModuleDeferredRegistrationsUpdateSpan) {\n remoteModuleDeferredRegistrationsUpdateSpan.instance.end();\n }\n };\n\n addProtectedListener(runtime, ApplicationBootstrappingStartedEvent, () => {\n bootstrappingSpan = startSpan((options, context) => getTracer().startSpan(\"squide-bootstrapping\", options, context));\n }, {\n once: true,\n onError: handleUnmanagedError\n });\n\n addProtectedListener(runtime, ApplicationBoostrappedEvent, () => {\n if (bootstrappingSpan) {\n bootstrappingSpan.end();\n bootstrappingSpanHasEnded = true;\n }\n }, {\n once: true,\n onError: handleUnmanagedError\n });\n\n addProtectedListener(runtime, MswReadyEvent, () => {\n if (bootstrappingSpan) {\n bootstrappingSpan.addEvent(\"msw-ready\");\n }\n }, {\n once: true,\n onError: handleUnmanagedError\n });\n\n addProtectedListener(runtime, LocalModulesRegistrationStartedEvent, (payload: unknown) => {\n const attributes = {\n \"app.squide.module_count\": (payload as LocalModulesRegistrationStartedEventPayload).moduleCount\n };\n\n if (bootstrappingSpan) {\n bootstrappingSpan.addEvent(\"local-module-registration-started\", attributes);\n }\n\n localModuleRegistrationSpan = startChildSpan(bootstrappingSpan, (options, context) => {\n return getTracer().startSpan(\"local-module-registration\", { ...options, attributes }, context);\n });\n }, {\n once: true,\n onError: handleUnmanagedError\n });\n\n addProtectedListener(runtime, LocalModulesRegistrationCompletedEvent, (payload: unknown) => {\n if (bootstrappingSpan) {\n bootstrappingSpan.addEvent(\"local-module-registration-completed\", {\n \"app.squide.module_count\": (payload as LocalModulesRegistrationCompletedEventPayload).moduleCount\n });\n }\n\n if (localModuleRegistrationSpan) {\n localModuleRegistrationSpan.end();\n }\n }, {\n once: true,\n onError: handleUnmanagedError\n });\n\n // Can occur multiple times.\n addProtectedListener(runtime, LocalModuleRegistrationFailedEvent, (payload: unknown) => {\n const registrationError = payload as ModuleRegistrationError;\n\n if (localModuleRegistrationSpan) {\n traceError(localModuleRegistrationSpan, registrationError);\n }\n }, {\n onError: handleUnmanagedError\n });\n\n addProtectedListener(runtime, LocalModulesDeferredRegistrationStartedEvent, (payload: unknown) => {\n const attributes = {\n \"app.squide.registration_count\": (payload as LocalModulesDeferredRegistrationStartedEventPayload).registrationCount\n };\n\n if (bootstrappingSpan) {\n bootstrappingSpan.addEvent(\"local-module-deferred-registration-started\", attributes);\n }\n\n localModuleDeferredRegistrationSpan = startChildSpan(bootstrappingSpan, (options, context) => {\n return getTracer().startSpan(\"local-module-deferred-registration\", { ...options, attributes }, context);\n });\n }, {\n once: true,\n onError: handleUnmanagedError\n });\n\n addProtectedListener(runtime, LocalModulesDeferredRegistrationCompletedEvent, (payload: unknown) => {\n if (bootstrappingSpan) {\n bootstrappingSpan.addEvent(\"local-module-deferred-registration-completed\", {\n \"app.squide.registration_count\": (payload as LocalModulesDeferredRegistrationCompletedEventPayload).registrationCount\n });\n }\n\n if (localModuleDeferredRegistrationSpan) {\n localModuleDeferredRegistrationSpan.end();\n }\n }, {\n once: true,\n onError: handleUnmanagedError\n });\n\n // Can occur multiple times.\n addProtectedListener(runtime, LocalModuleDeferredRegistrationFailedEvent, (payload: unknown) => {\n const registrationError = payload as ModuleRegistrationError;\n\n if (localModuleDeferredRegistrationSpan) {\n traceError(localModuleRegistrationSpan, registrationError);\n }\n }, {\n onError: handleUnmanagedError\n });\n\n addProtectedListener(runtime, RemoteModulesRegistrationStartedEvent, (payload: unknown) => {\n const attributes = {\n \"app.squide.remote_count\": (payload as RemoteModulesRegistrationStartedEventPayload).remoteCount\n };\n\n if (bootstrappingSpan) {\n bootstrappingSpan.addEvent(\"remote-module-registration-started\", attributes);\n }\n\n remoteModuleRegistrationSpan = startChildSpan(bootstrappingSpan, (options, context) => {\n return getTracer().startSpan(\"remote-module-registration\", { ...options, attributes }, context);\n });\n }, {\n once: true,\n onError: handleUnmanagedError\n });\n\n addProtectedListener(runtime, RemoteModulesRegistrationCompletedEvent, (payload: unknown) => {\n if (bootstrappingSpan) {\n bootstrappingSpan.addEvent(\"remote-module-registration-completed\", {\n \"app.squide.remote_count\": (payload as RemoteModulesRegistrationCompletedEventPayload).remoteCount\n });\n }\n\n if (remoteModuleRegistrationSpan) {\n remoteModuleRegistrationSpan.end();\n }\n }, {\n once: true,\n onError: handleUnmanagedError\n });\n\n // Can occur multiple times.\n addProtectedListener(runtime, RemoteModuleRegistrationFailedEvent, (payload: unknown) => {\n const registrationError = payload as RemoteModuleRegistrationError;\n\n if (remoteModuleRegistrationSpan) {\n traceError(remoteModuleRegistrationSpan, registrationError);\n }\n }, {\n onError: handleUnmanagedError\n });\n\n addProtectedListener(runtime, RemoteModulesDeferredRegistrationStartedEvent, (payload: unknown) => {\n const attributes = {\n \"app.squide.registration_count\": (payload as RemoteModulesDeferredRegistrationStartedEventPayload).registrationCount\n };\n\n if (bootstrappingSpan) {\n bootstrappingSpan.addEvent(\"remote-module-deferred-registration-started\", attributes);\n }\n\n remoteModuleDeferredRegistrationSpan = startChildSpan(bootstrappingSpan, (options, context) => {\n return getTracer().startSpan(\"remote-module-deferred-registration\", { ...options, attributes }, context);\n });\n }, {\n once: true,\n onError: handleUnmanagedError\n });\n\n addProtectedListener(runtime, RemoteModulesDeferredRegistrationCompletedEvent, (payload: unknown) => {\n if (bootstrappingSpan) {\n bootstrappingSpan.addEvent(\"remote-module-deferred-registration-completed\", {\n \"app.squide.registration_count\": (payload as RemoteModulesDeferredRegistrationCompletedEventPayload).registrationCount\n });\n }\n\n if (remoteModuleDeferredRegistrationSpan) {\n remoteModuleDeferredRegistrationSpan.end();\n }\n }, {\n once: true,\n onError: handleUnmanagedError\n });\n\n // Can occur multiple times.\n addProtectedListener(runtime, RemoteModuleDeferredRegistrationFailedEvent, (payload: unknown) => {\n const registrationError = payload as RemoteModuleRegistrationError;\n\n if (remoteModuleDeferredRegistrationSpan) {\n traceError(remoteModuleDeferredRegistrationSpan, registrationError);\n }\n }, {\n onError: handleUnmanagedError\n });\n\n const handleFetchDataStarted = () => {\n dataFetchSpan = startActiveChildSpan(bootstrappingSpan, (options, context) => {\n const name = \"data-fetch\";\n const span = getTracer().startSpan(name, options, context);\n\n return {\n name,\n span\n };\n });\n };\n\n const handleDataReady = () => {\n if (dataFetchSpan) {\n endActiveSpan(dataFetchSpan);\n }\n };\n\n const handlePublicDataFetchStarted = () => {\n if (dataFetchSpan) {\n dataFetchSpan.instance.addEvent(\"public-data-fetch-started\");\n }\n };\n\n const handlePublicDataReady = () => {\n if (dataFetchSpan) {\n dataFetchSpan.instance.addEvent(\"public-data-ready\");\n }\n };\n\n const handleProtectedDataFetchStarted = () => {\n if (dataFetchSpan) {\n dataFetchSpan.instance.addEvent(\"protected-data-fetch-started\");\n }\n };\n\n const handleProtectedDataReady = () => {\n if (dataFetchSpan) {\n dataFetchSpan.instance.addEvent(\"protected-data-ready\");\n }\n };\n\n const handleDataFetchFailed = (queriesErrors: Error[]) => {\n if (dataFetchSpan) {\n queriesErrors.forEach(x => {\n traceError(dataFetchSpan.instance, x);\n });\n\n endActiveSpan(dataFetchSpan);\n\n // Global data fetch errors are unmanaged, which mean the host application bootstrapping flow\n // will be aborted and a react-router error boundary will be rendered.\n if (bootstrappingSpan) {\n bootstrappingSpan.end();\n bootstrappingSpanHasEnded = true;\n }\n }\n };\n\n reduceDataFetchEvents(\n runtime,\n handleFetchDataStarted,\n handleDataReady,\n handlePublicDataFetchStarted,\n handlePublicDataReady,\n handleProtectedDataFetchStarted,\n handleProtectedDataReady,\n handleDataFetchFailed,\n handleUnmanagedError\n );\n\n addProtectedListener(runtime, ModulesRegisteredEvent, () => {\n if (bootstrappingSpan) {\n bootstrappingSpan.addEvent(\"modules-registered\");\n }\n }, {\n once: true,\n onError: handleUnmanagedError\n });\n\n addProtectedListener(runtime, ModulesReadyEvent, () => {\n if (bootstrappingSpan) {\n bootstrappingSpan.addEvent(\"modules-ready\");\n }\n }, {\n once: true,\n onError: handleUnmanagedError\n });\n\n // Can occur multiple times.\n addProtectedListener(runtime, DeferredRegistrationsUpdateStartedEvent, () => {\n deferredRegistrationsUpdateSpan = startSpan((options, context) => getTracer().startSpan(\"squide-deferred-registrations-update\", options, context));\n }, {\n onError: handleUnmanagedError\n });\n\n // Can occur multiple times.\n addProtectedListener(runtime, DeferredRegistrationsUpdateCompletedEvent, () => {\n if (deferredRegistrationsUpdateSpan) {\n deferredRegistrationsUpdateSpan.end();\n }\n }, {\n onError: handleUnmanagedError\n });\n\n // Can occur multiple times.\n addProtectedListener(runtime, LocalModulesDeferredRegistrationsUpdateStartedEvent, (payload: unknown) => {\n const attributes = {\n \"app.squide.registration_count\": (payload as LocalModulesDeferredRegistrationsUpdateStartedEventPayload).registrationCount\n };\n\n if (deferredRegistrationsUpdateSpan) {\n deferredRegistrationsUpdateSpan.addEvent(\"local-module-deferred-registrations-update-started\", attributes);\n }\n\n localModuleDeferredRegistrationsUpdateSpan = startActiveChildSpan(deferredRegistrationsUpdateSpan, (options, context) => {\n const name = \"local-module-deferred-registrations-update\";\n\n const span = getTracer().startSpan(name, {\n attributes,\n ...options\n }, context);\n\n return {\n name,\n span\n };\n });\n }, {\n onError: handleUnmanagedError\n });\n\n // Can occur multiple times.\n addProtectedListener(runtime, LocalModulesDeferredRegistrationsUpdateCompletedEvent, (payload: unknown) => {\n if (deferredRegistrationsUpdateSpan) {\n deferredRegistrationsUpdateSpan.addEvent(\"local-module-deferred-registrations-update-completed\", {\n \"app.squide.registration_count\": (payload as LocalModulesDeferredRegistrationsUpdateCompletedEventPayload).registrationCount\n });\n }\n\n if (localModuleDeferredRegistrationsUpdateSpan) {\n endActiveSpan(localModuleDeferredRegistrationsUpdateSpan);\n }\n }, {\n onError: handleUnmanagedError\n });\n\n // Can occur multiple times.\n addProtectedListener(runtime, LocalModuleDeferredRegistrationUpdateFailedEvent, (payload: unknown) => {\n const registrationError = payload as ModuleRegistrationError;\n\n if (localModuleDeferredRegistrationsUpdateSpan) {\n traceError(localModuleDeferredRegistrationsUpdateSpan.instance, registrationError);\n }\n }, {\n onError: handleUnmanagedError\n });\n\n // Can occur multiple times.\n addProtectedListener(runtime, RemoteModulesDeferredRegistrationsUpdateStartedEvent, (payload: unknown) => {\n const attributes = {\n \"app.squide.registration_count\": (payload as RemoteModulesDeferredRegistrationsUpdateStartedEventPayload).registrationCount\n };\n\n if (deferredRegistrationsUpdateSpan) {\n deferredRegistrationsUpdateSpan.addEvent(\"remote-module-deferred-registrations-update-started\", attributes);\n }\n\n remoteModuleDeferredRegistrationsUpdateSpan = startActiveChildSpan(deferredRegistrationsUpdateSpan, (options, context) => {\n const name = \"remote-module-deferred-registrations-update\";\n\n const span = getTracer().startSpan(name, {\n attributes,\n ...options\n }, context);\n\n return {\n name,\n span\n };\n });\n }, {\n onError: handleUnmanagedError\n });\n\n // Can occur multiple times.\n addProtectedListener(runtime, RemoteModulesDeferredRegistrationsUpdateCompletedEvent, (payload: unknown) => {\n if (deferredRegistrationsUpdateSpan) {\n deferredRegistrationsUpdateSpan.addEvent(\"remote-module-deferred-registrations-update-completed\", {\n \"app.squide.registration_count\": (payload as RemoteModulesDeferredRegistrationsUpdateCompletedEventPayload).registrationCount\n });\n }\n\n if (remoteModuleDeferredRegistrationsUpdateSpan) {\n endActiveSpan(remoteModuleDeferredRegistrationsUpdateSpan);\n }\n }, {\n onError: handleUnmanagedError\n });\n\n // Can occur multiple times.\n addProtectedListener(runtime, RemoteModuleDeferredRegistrationUpdateFailedEvent, (payload: unknown) => {\n const registrationError = payload as RemoteModuleRegistrationError;\n\n if (remoteModuleDeferredRegistrationsUpdateSpan) {\n traceError(remoteModuleDeferredRegistrationsUpdateSpan.instance, registrationError);\n }\n }, {\n onError: handleUnmanagedError\n });\n}\n\nfunction getRegisterFetchRequestHookFunction() {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n if (globalThis.__WLP_HONEYCOMB_REGISTER_DYNAMIC_FETCH_REQUEST_HOOK__) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n return globalThis.__WLP_HONEYCOMB_REGISTER_DYNAMIC_FETCH_REQUEST_HOOK__;\n }\n\n // Fallback to fix an error. Will remove soon.\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n return globalThis.__WLP_HONEYCOMB_REGISTER_DYNAMIC_FETCH_REQUEST_HOOK;\n}\n\nexport function registerHoneycombInstrumentation(runtime: FireflyRuntime) {\n try {\n const registerFetchRequestHookFunction = getRegisterFetchRequestHookFunction();\n\n if (registerFetchRequestHookFunction) {\n registerActiveSpanStack();\n\n const activeSpanOverrideFunction = createOverrideFetchRequestSpanWithActiveSpanContext(runtime.logger);\n\n // Dynamically registering this request hook function to nest the HTTP requests\n // of squide bootstrapping under the appropriate Honeycomb span.\n registerFetchRequestHookFunction(activeSpanOverrideFunction);\n } else {\n runtime.logger.warning(\"[squide] Cannot register Honeycomb fetch request hook because \\\"globalThis.__WLP_HONEYCOMB_REGISTER_DYNAMIC_FETCH_REQUEST_HOOK__\\\" is not available. Honeycomb instrumentation is still functional but in degraded mode.\");\n }\n\n registerTrackingListeners(runtime);\n } catch (error: unknown) {\n runtime.logger\n .withText(\"[squide] An error occurred while registering Honeycomb instrumentation:\")\n .withError(error as Error)\n .error();\n }\n}\n"],"names":["LocalModuleDeferredRegistrationFailedEvent","LocalModuleDeferredRegistrationUpdateFailedEvent","LocalModuleRegistrationFailedEvent","LocalModulesDeferredRegistrationCompletedEvent","LocalModulesDeferredRegistrationStartedEvent","LocalModulesDeferredRegistrationsUpdateCompletedEvent","LocalModulesDeferredRegistrationsUpdateStartedEvent","LocalModulesRegistrationCompletedEvent","LocalModulesRegistrationStartedEvent","DeferredRegistrationsUpdateCompletedEvent","DeferredRegistrationsUpdateStartedEvent","RemoteModuleDeferredRegistrationFailedEvent","RemoteModuleDeferredRegistrationUpdateFailedEvent","RemoteModuleRegistrationFailedEvent","RemoteModulesDeferredRegistrationCompletedEvent","RemoteModulesDeferredRegistrationStartedEvent","RemoteModulesDeferredRegistrationsUpdateCompletedEvent","RemoteModulesDeferredRegistrationsUpdateStartedEvent","RemoteModulesRegistrationCompletedEvent","RemoteModulesRegistrationStartedEvent","ApplicationBoostrappedEvent","ModulesReadyEvent","ModulesRegisteredEvent","MswReadyEvent","ProtectedDataReadyEvent","PublicDataReadyEvent","ApplicationBootstrappingStartedEvent","ProtectedDataFetchFailedEvent","ProtectedDataFetchStartedEvent","PublicDataFetchFailedEvent","PublicDataFetchStartedEvent","createOverrideFetchRequestSpanWithActiveSpanContext","registerActiveSpanStack","getTracer","endActiveSpan","startActiveChildSpan","startChildSpan","startSpan","traceError","addProtectedListener","runtime","eventName","callback","options","protectedCallback","args","error","reduceDataFetchEvents","onDataFetchStarted","onDataReady","onPublicDataFetchStarted","onPublicDataReady","onProtectedDataFetchStarted","onProtectedDataReady","onDataFetchFailed","onUnmanagedError","dataFetchState","payload","handleDataFetchFailed","registerTrackingListeners","bootstrappingSpan","bootstrappingSpanHasEnded","localModuleRegistrationSpan","localModuleDeferredRegistrationSpan","remoteModuleRegistrationSpan","remoteModuleDeferredRegistrationSpan","dataFetchSpan","deferredRegistrationsUpdateSpan","localModuleDeferredRegistrationsUpdateSpan","remoteModuleDeferredRegistrationsUpdateSpan","handleUnmanagedError","context","attributes","registrationError","handleFetchDataStarted","name","span","handleDataReady","handlePublicDataFetchStarted","handlePublicDataReady","handleProtectedDataFetchStarted","handleProtectedDataReady","queriesErrors","x","getRegisterFetchRequestHookFunction","globalThis","registerHoneycombInstrumentation","registerFetchRequestHookFunction","activeSpanOverrideFunction"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqBsB;AAoBa;AACoK;AAExH;AAC+B;AACT;AAC2B;AACxF;AACgE;AASxG,SAASuC,qBAAqBC,OAAuB,EAAEC,SAAoB,EAAEC,QAA+B,EAAEC,OAAqC;IAC/I,MAAMC,oBAAoB,CAAC,GAAGC;QAC1B,IAAI;YACAH,YAAYG;QAChB,EAAE,OAAOC,OAAgB;YACrBN,QAAQ,MAAM,CACT,QAAQ,CAAC,CAAC,2DAA2D,EAAEC,UAAU,QAAQ,GAAG,gCAAgC,CAAC,EAC7H,SAAS,CAACK,OACV,KAAK;QACd;IACJ;IAEAN,QAAQ,QAAQ,CAAC,WAAW,CAACC,WAAWG,mBAAmBD;AAC/D;AAIO,SAASI,sBACZP,OAAuB,EACvBQ,kBAA8B,EAC9BC,WAAuB,EACvBC,wBAAoC,EACpCC,iBAA6B,EAC7BC,2BAAuC,EACvCC,oBAAgC,EAChCC,iBAAmD,EACnDC,gBAA0C;IAE1C,IAAIC,iBAAiC;IAErCjB,qBAAqBC,SAASV,2BAA2BA,EAAE;QACvD,IAAI0B,mBAAmB,QAAQ;YAC3BA,iBAAiB;YACjBR;QACJ;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,CAAC6C;QAC9E,MAAMgB,oBAAoBhB;QAE1B,IAAIY,6CAA6C;YAC7C/B,UAAUA,CAAC+B,4CAA4C,QAAQ,EAAEI;QACrE;IACJ,GAAG;QACC,SAASH;IACb;AACJ;AAEA,SAASc;IACL,6DAA6D;IAC7D,aAAa;IACb,IAAIC,WAAW,qDAAqD,EAAE;QAClE,6DAA6D;QAC7D,aAAa;QACb,OAAOA,WAAW,qDAAqD;IAC3E;IAEA,8CAA8C;IAC9C,6DAA6D;IAC7D,aAAa;IACb,OAAOA,WAAW,mDAAmD;AACzE;AAEO,SAASC,iCAAiC9C,OAAuB;IACpE,IAAI;QACA,MAAM+C,mCAAmCH;QAEzC,IAAIG,kCAAkC;YAClCvD,uBAAuBA;YAEvB,MAAMwD,6BAA6BzD,mDAAmDA,CAACS,QAAQ,MAAM;YAErG,+EAA+E;YAC/E,gEAAgE;YAChE+C,iCAAiCC;QACrC,OAAO;YACHhD,QAAQ,MAAM,CAAC,OAAO,CAAC;QAC3B;QAEAmB,0BAA0BnB;IAC9B,EAAE,OAAOM,OAAgB;QACrBN,QAAQ,MAAM,CACT,QAAQ,CAAC,2EACT,SAAS,CAACM,OACV,KAAK;IACd;AACJ"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@squide/firefly",
|
|
3
3
|
"author": "Workleap",
|
|
4
|
-
"version": "14.
|
|
4
|
+
"version": "14.1.0",
|
|
5
5
|
"description": "Helpers to facilitate the creation of an application with the Squide firefly technology stack.",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"repository": {
|
|
@@ -38,10 +38,10 @@
|
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@workleap/logging": "^1.3.0",
|
|
40
40
|
"uuid": "^12.0.0",
|
|
41
|
-
"@squide/core": "6.
|
|
42
|
-
"@squide/module-federation": "7.0.
|
|
43
|
-
"@squide/msw": "4.0.
|
|
44
|
-
"@squide/react-router": "8.
|
|
41
|
+
"@squide/core": "6.1.0",
|
|
42
|
+
"@squide/module-federation": "7.0.1",
|
|
43
|
+
"@squide/msw": "4.0.1",
|
|
44
|
+
"@squide/react-router": "8.1.0"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@rsbuild/core": "1.5.4",
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import type { Span } from "@opentelemetry/api";
|
|
2
2
|
import {
|
|
3
|
+
type AddListenerOptions,
|
|
4
|
+
type EventCallbackFunction,
|
|
5
|
+
type EventName,
|
|
3
6
|
LocalModuleDeferredRegistrationFailedEvent,
|
|
4
7
|
LocalModuleDeferredRegistrationUpdateFailedEvent,
|
|
5
8
|
LocalModuleRegistrationFailedEvent,
|
|
@@ -49,6 +52,25 @@ import { endActiveSpan, startActiveChildSpan, startChildSpan, startSpan, traceEr
|
|
|
49
52
|
// TIPS:
|
|
50
53
|
// To query those traces in Honeycomb, use the following query filter: "root.name = squide-bootstrapping".
|
|
51
54
|
|
|
55
|
+
interface AddProtectedListenerOptions extends AddListenerOptions {
|
|
56
|
+
onError?: (error: unknown) => void;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function addProtectedListener(runtime: FireflyRuntime, eventName: EventName, callback: EventCallbackFunction, options?: AddProtectedListenerOptions) {
|
|
60
|
+
const protectedCallback = (...args: unknown[]) => {
|
|
61
|
+
try {
|
|
62
|
+
callback(...args);
|
|
63
|
+
} catch (error: unknown) {
|
|
64
|
+
runtime.logger
|
|
65
|
+
.withText(`[squide] An unmanaged error occurred while handling event "${eventName.toString()}" for Honeycomb instrumentation:`)
|
|
66
|
+
.withError(error as Error)
|
|
67
|
+
.error();
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
runtime.eventBus.addListener(eventName, protectedCallback, options);
|
|
72
|
+
}
|
|
73
|
+
|
|
52
74
|
type DataFetchState = "none" | "fetching-data" | "public-data-ready" | "protected-data-ready" | "data-ready" | "data-fetch-failed";
|
|
53
75
|
|
|
54
76
|
export function reduceDataFetchEvents(
|
|
@@ -59,20 +81,24 @@ export function reduceDataFetchEvents(
|
|
|
59
81
|
onPublicDataReady: () => void,
|
|
60
82
|
onProtectedDataFetchStarted: () => void,
|
|
61
83
|
onProtectedDataReady: () => void,
|
|
62
|
-
onDataFetchFailed: (queriesErrors: Error[]) => void
|
|
84
|
+
onDataFetchFailed: (queriesErrors: Error[]) => void,
|
|
85
|
+
onUnmanagedError: (error: unknown) => void
|
|
63
86
|
) {
|
|
64
87
|
let dataFetchState: DataFetchState = "none";
|
|
65
88
|
|
|
66
|
-
runtime
|
|
89
|
+
addProtectedListener(runtime, PublicDataFetchStartedEvent, () => {
|
|
67
90
|
if (dataFetchState === "none") {
|
|
68
91
|
dataFetchState = "fetching-data";
|
|
69
92
|
onDataFetchStarted();
|
|
70
93
|
}
|
|
71
94
|
|
|
72
95
|
onPublicDataFetchStarted();
|
|
73
|
-
}, {
|
|
96
|
+
}, {
|
|
97
|
+
once: true,
|
|
98
|
+
onError: onUnmanagedError
|
|
99
|
+
});
|
|
74
100
|
|
|
75
|
-
runtime
|
|
101
|
+
addProtectedListener(runtime, PublicDataReadyEvent, payload => {
|
|
76
102
|
onPublicDataReady();
|
|
77
103
|
|
|
78
104
|
if (dataFetchState === "fetching-data") {
|
|
@@ -86,18 +112,24 @@ export function reduceDataFetchEvents(
|
|
|
86
112
|
dataFetchState = "data-ready";
|
|
87
113
|
onDataReady();
|
|
88
114
|
}
|
|
89
|
-
}, {
|
|
115
|
+
}, {
|
|
116
|
+
once: true,
|
|
117
|
+
onError: onUnmanagedError
|
|
118
|
+
});
|
|
90
119
|
|
|
91
|
-
runtime
|
|
120
|
+
addProtectedListener(runtime, ProtectedDataFetchStartedEvent, () => {
|
|
92
121
|
if (dataFetchState === "none") {
|
|
93
122
|
dataFetchState = "fetching-data";
|
|
94
123
|
onDataFetchStarted();
|
|
95
124
|
}
|
|
96
125
|
|
|
97
126
|
onProtectedDataFetchStarted();
|
|
98
|
-
}, {
|
|
127
|
+
}, {
|
|
128
|
+
once: true,
|
|
129
|
+
onError: onUnmanagedError
|
|
130
|
+
});
|
|
99
131
|
|
|
100
|
-
runtime
|
|
132
|
+
addProtectedListener(runtime, ProtectedDataReadyEvent, payload => {
|
|
101
133
|
onProtectedDataReady();
|
|
102
134
|
|
|
103
135
|
if (dataFetchState === "fetching-data") {
|
|
@@ -111,7 +143,10 @@ export function reduceDataFetchEvents(
|
|
|
111
143
|
dataFetchState = "data-ready";
|
|
112
144
|
onDataReady();
|
|
113
145
|
}
|
|
114
|
-
}, {
|
|
146
|
+
}, {
|
|
147
|
+
once: true,
|
|
148
|
+
onError: onUnmanagedError
|
|
149
|
+
});
|
|
115
150
|
|
|
116
151
|
const handleDataFetchFailed = (payload: unknown) => {
|
|
117
152
|
if (dataFetchState !== "data-fetch-failed") {
|
|
@@ -121,12 +156,20 @@ export function reduceDataFetchEvents(
|
|
|
121
156
|
}
|
|
122
157
|
};
|
|
123
158
|
|
|
124
|
-
runtime
|
|
125
|
-
|
|
159
|
+
addProtectedListener(runtime, PublicDataFetchFailedEvent, handleDataFetchFailed, {
|
|
160
|
+
once: true,
|
|
161
|
+
onError: onUnmanagedError
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
addProtectedListener(runtime, ProtectedDataFetchFailedEvent, handleDataFetchFailed, {
|
|
165
|
+
once: true,
|
|
166
|
+
onError: onUnmanagedError
|
|
167
|
+
});
|
|
126
168
|
}
|
|
127
169
|
|
|
128
170
|
function registerTrackingListeners(runtime: FireflyRuntime) {
|
|
129
171
|
let bootstrappingSpan: Span;
|
|
172
|
+
let bootstrappingSpanHasEnded: boolean = false;
|
|
130
173
|
let localModuleRegistrationSpan: Span;
|
|
131
174
|
let localModuleDeferredRegistrationSpan: Span;
|
|
132
175
|
let remoteModuleRegistrationSpan: Span;
|
|
@@ -136,23 +179,74 @@ function registerTrackingListeners(runtime: FireflyRuntime) {
|
|
|
136
179
|
let localModuleDeferredRegistrationsUpdateSpan: ActiveSpan;
|
|
137
180
|
let remoteModuleDeferredRegistrationsUpdateSpan: ActiveSpan;
|
|
138
181
|
|
|
139
|
-
|
|
182
|
+
const handleUnmanagedError = (error: unknown) => {
|
|
183
|
+
if (bootstrappingSpan && !bootstrappingSpanHasEnded) {
|
|
184
|
+
traceError(bootstrappingSpan, error as Error);
|
|
185
|
+
|
|
186
|
+
bootstrappingSpan.end();
|
|
187
|
+
bootstrappingSpanHasEnded = true;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
if (localModuleRegistrationSpan) {
|
|
191
|
+
localModuleRegistrationSpan.end();
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
if (localModuleDeferredRegistrationSpan) {
|
|
195
|
+
localModuleDeferredRegistrationSpan.end();
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
if (remoteModuleRegistrationSpan) {
|
|
199
|
+
remoteModuleRegistrationSpan.end();
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
if (remoteModuleDeferredRegistrationSpan) {
|
|
203
|
+
remoteModuleDeferredRegistrationSpan.end();
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
if (dataFetchSpan) {
|
|
207
|
+
dataFetchSpan.instance.end();
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
if (deferredRegistrationsUpdateSpan) {
|
|
211
|
+
deferredRegistrationsUpdateSpan.end();
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
if (localModuleDeferredRegistrationsUpdateSpan) {
|
|
215
|
+
localModuleDeferredRegistrationsUpdateSpan.instance.end();
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
if (remoteModuleDeferredRegistrationsUpdateSpan) {
|
|
219
|
+
remoteModuleDeferredRegistrationsUpdateSpan.instance.end();
|
|
220
|
+
}
|
|
221
|
+
};
|
|
222
|
+
|
|
223
|
+
addProtectedListener(runtime, ApplicationBootstrappingStartedEvent, () => {
|
|
140
224
|
bootstrappingSpan = startSpan((options, context) => getTracer().startSpan("squide-bootstrapping", options, context));
|
|
141
|
-
}, {
|
|
225
|
+
}, {
|
|
226
|
+
once: true,
|
|
227
|
+
onError: handleUnmanagedError
|
|
228
|
+
});
|
|
142
229
|
|
|
143
|
-
runtime
|
|
230
|
+
addProtectedListener(runtime, ApplicationBoostrappedEvent, () => {
|
|
144
231
|
if (bootstrappingSpan) {
|
|
145
232
|
bootstrappingSpan.end();
|
|
233
|
+
bootstrappingSpanHasEnded = true;
|
|
146
234
|
}
|
|
147
|
-
}, {
|
|
235
|
+
}, {
|
|
236
|
+
once: true,
|
|
237
|
+
onError: handleUnmanagedError
|
|
238
|
+
});
|
|
148
239
|
|
|
149
|
-
runtime
|
|
240
|
+
addProtectedListener(runtime, MswReadyEvent, () => {
|
|
150
241
|
if (bootstrappingSpan) {
|
|
151
242
|
bootstrappingSpan.addEvent("msw-ready");
|
|
152
243
|
}
|
|
153
|
-
}, {
|
|
244
|
+
}, {
|
|
245
|
+
once: true,
|
|
246
|
+
onError: handleUnmanagedError
|
|
247
|
+
});
|
|
154
248
|
|
|
155
|
-
runtime
|
|
249
|
+
addProtectedListener(runtime, LocalModulesRegistrationStartedEvent, (payload: unknown) => {
|
|
156
250
|
const attributes = {
|
|
157
251
|
"app.squide.module_count": (payload as LocalModulesRegistrationStartedEventPayload).moduleCount
|
|
158
252
|
};
|
|
@@ -164,9 +258,12 @@ function registerTrackingListeners(runtime: FireflyRuntime) {
|
|
|
164
258
|
localModuleRegistrationSpan = startChildSpan(bootstrappingSpan, (options, context) => {
|
|
165
259
|
return getTracer().startSpan("local-module-registration", { ...options, attributes }, context);
|
|
166
260
|
});
|
|
167
|
-
}, {
|
|
261
|
+
}, {
|
|
262
|
+
once: true,
|
|
263
|
+
onError: handleUnmanagedError
|
|
264
|
+
});
|
|
168
265
|
|
|
169
|
-
runtime
|
|
266
|
+
addProtectedListener(runtime, LocalModulesRegistrationCompletedEvent, (payload: unknown) => {
|
|
170
267
|
if (bootstrappingSpan) {
|
|
171
268
|
bootstrappingSpan.addEvent("local-module-registration-completed", {
|
|
172
269
|
"app.squide.module_count": (payload as LocalModulesRegistrationCompletedEventPayload).moduleCount
|
|
@@ -176,18 +273,23 @@ function registerTrackingListeners(runtime: FireflyRuntime) {
|
|
|
176
273
|
if (localModuleRegistrationSpan) {
|
|
177
274
|
localModuleRegistrationSpan.end();
|
|
178
275
|
}
|
|
179
|
-
}, {
|
|
276
|
+
}, {
|
|
277
|
+
once: true,
|
|
278
|
+
onError: handleUnmanagedError
|
|
279
|
+
});
|
|
180
280
|
|
|
181
281
|
// Can occur multiple times.
|
|
182
|
-
runtime
|
|
282
|
+
addProtectedListener(runtime, LocalModuleRegistrationFailedEvent, (payload: unknown) => {
|
|
183
283
|
const registrationError = payload as ModuleRegistrationError;
|
|
184
284
|
|
|
185
285
|
if (localModuleRegistrationSpan) {
|
|
186
286
|
traceError(localModuleRegistrationSpan, registrationError);
|
|
187
287
|
}
|
|
288
|
+
}, {
|
|
289
|
+
onError: handleUnmanagedError
|
|
188
290
|
});
|
|
189
291
|
|
|
190
|
-
runtime
|
|
292
|
+
addProtectedListener(runtime, LocalModulesDeferredRegistrationStartedEvent, (payload: unknown) => {
|
|
191
293
|
const attributes = {
|
|
192
294
|
"app.squide.registration_count": (payload as LocalModulesDeferredRegistrationStartedEventPayload).registrationCount
|
|
193
295
|
};
|
|
@@ -199,9 +301,12 @@ function registerTrackingListeners(runtime: FireflyRuntime) {
|
|
|
199
301
|
localModuleDeferredRegistrationSpan = startChildSpan(bootstrappingSpan, (options, context) => {
|
|
200
302
|
return getTracer().startSpan("local-module-deferred-registration", { ...options, attributes }, context);
|
|
201
303
|
});
|
|
202
|
-
}, {
|
|
304
|
+
}, {
|
|
305
|
+
once: true,
|
|
306
|
+
onError: handleUnmanagedError
|
|
307
|
+
});
|
|
203
308
|
|
|
204
|
-
runtime
|
|
309
|
+
addProtectedListener(runtime, LocalModulesDeferredRegistrationCompletedEvent, (payload: unknown) => {
|
|
205
310
|
if (bootstrappingSpan) {
|
|
206
311
|
bootstrappingSpan.addEvent("local-module-deferred-registration-completed", {
|
|
207
312
|
"app.squide.registration_count": (payload as LocalModulesDeferredRegistrationCompletedEventPayload).registrationCount
|
|
@@ -211,18 +316,23 @@ function registerTrackingListeners(runtime: FireflyRuntime) {
|
|
|
211
316
|
if (localModuleDeferredRegistrationSpan) {
|
|
212
317
|
localModuleDeferredRegistrationSpan.end();
|
|
213
318
|
}
|
|
214
|
-
}, {
|
|
319
|
+
}, {
|
|
320
|
+
once: true,
|
|
321
|
+
onError: handleUnmanagedError
|
|
322
|
+
});
|
|
215
323
|
|
|
216
324
|
// Can occur multiple times.
|
|
217
|
-
runtime
|
|
325
|
+
addProtectedListener(runtime, LocalModuleDeferredRegistrationFailedEvent, (payload: unknown) => {
|
|
218
326
|
const registrationError = payload as ModuleRegistrationError;
|
|
219
327
|
|
|
220
328
|
if (localModuleDeferredRegistrationSpan) {
|
|
221
329
|
traceError(localModuleRegistrationSpan, registrationError);
|
|
222
330
|
}
|
|
331
|
+
}, {
|
|
332
|
+
onError: handleUnmanagedError
|
|
223
333
|
});
|
|
224
334
|
|
|
225
|
-
runtime
|
|
335
|
+
addProtectedListener(runtime, RemoteModulesRegistrationStartedEvent, (payload: unknown) => {
|
|
226
336
|
const attributes = {
|
|
227
337
|
"app.squide.remote_count": (payload as RemoteModulesRegistrationStartedEventPayload).remoteCount
|
|
228
338
|
};
|
|
@@ -234,9 +344,12 @@ function registerTrackingListeners(runtime: FireflyRuntime) {
|
|
|
234
344
|
remoteModuleRegistrationSpan = startChildSpan(bootstrappingSpan, (options, context) => {
|
|
235
345
|
return getTracer().startSpan("remote-module-registration", { ...options, attributes }, context);
|
|
236
346
|
});
|
|
237
|
-
}, {
|
|
347
|
+
}, {
|
|
348
|
+
once: true,
|
|
349
|
+
onError: handleUnmanagedError
|
|
350
|
+
});
|
|
238
351
|
|
|
239
|
-
runtime
|
|
352
|
+
addProtectedListener(runtime, RemoteModulesRegistrationCompletedEvent, (payload: unknown) => {
|
|
240
353
|
if (bootstrappingSpan) {
|
|
241
354
|
bootstrappingSpan.addEvent("remote-module-registration-completed", {
|
|
242
355
|
"app.squide.remote_count": (payload as RemoteModulesRegistrationCompletedEventPayload).remoteCount
|
|
@@ -246,18 +359,23 @@ function registerTrackingListeners(runtime: FireflyRuntime) {
|
|
|
246
359
|
if (remoteModuleRegistrationSpan) {
|
|
247
360
|
remoteModuleRegistrationSpan.end();
|
|
248
361
|
}
|
|
249
|
-
}, {
|
|
362
|
+
}, {
|
|
363
|
+
once: true,
|
|
364
|
+
onError: handleUnmanagedError
|
|
365
|
+
});
|
|
250
366
|
|
|
251
367
|
// Can occur multiple times.
|
|
252
|
-
runtime
|
|
368
|
+
addProtectedListener(runtime, RemoteModuleRegistrationFailedEvent, (payload: unknown) => {
|
|
253
369
|
const registrationError = payload as RemoteModuleRegistrationError;
|
|
254
370
|
|
|
255
371
|
if (remoteModuleRegistrationSpan) {
|
|
256
372
|
traceError(remoteModuleRegistrationSpan, registrationError);
|
|
257
373
|
}
|
|
374
|
+
}, {
|
|
375
|
+
onError: handleUnmanagedError
|
|
258
376
|
});
|
|
259
377
|
|
|
260
|
-
runtime
|
|
378
|
+
addProtectedListener(runtime, RemoteModulesDeferredRegistrationStartedEvent, (payload: unknown) => {
|
|
261
379
|
const attributes = {
|
|
262
380
|
"app.squide.registration_count": (payload as RemoteModulesDeferredRegistrationStartedEventPayload).registrationCount
|
|
263
381
|
};
|
|
@@ -269,9 +387,12 @@ function registerTrackingListeners(runtime: FireflyRuntime) {
|
|
|
269
387
|
remoteModuleDeferredRegistrationSpan = startChildSpan(bootstrappingSpan, (options, context) => {
|
|
270
388
|
return getTracer().startSpan("remote-module-deferred-registration", { ...options, attributes }, context);
|
|
271
389
|
});
|
|
272
|
-
}, {
|
|
390
|
+
}, {
|
|
391
|
+
once: true,
|
|
392
|
+
onError: handleUnmanagedError
|
|
393
|
+
});
|
|
273
394
|
|
|
274
|
-
runtime
|
|
395
|
+
addProtectedListener(runtime, RemoteModulesDeferredRegistrationCompletedEvent, (payload: unknown) => {
|
|
275
396
|
if (bootstrappingSpan) {
|
|
276
397
|
bootstrappingSpan.addEvent("remote-module-deferred-registration-completed", {
|
|
277
398
|
"app.squide.registration_count": (payload as RemoteModulesDeferredRegistrationCompletedEventPayload).registrationCount
|
|
@@ -281,15 +402,20 @@ function registerTrackingListeners(runtime: FireflyRuntime) {
|
|
|
281
402
|
if (remoteModuleDeferredRegistrationSpan) {
|
|
282
403
|
remoteModuleDeferredRegistrationSpan.end();
|
|
283
404
|
}
|
|
284
|
-
}, {
|
|
405
|
+
}, {
|
|
406
|
+
once: true,
|
|
407
|
+
onError: handleUnmanagedError
|
|
408
|
+
});
|
|
285
409
|
|
|
286
410
|
// Can occur multiple times.
|
|
287
|
-
runtime
|
|
411
|
+
addProtectedListener(runtime, RemoteModuleDeferredRegistrationFailedEvent, (payload: unknown) => {
|
|
288
412
|
const registrationError = payload as RemoteModuleRegistrationError;
|
|
289
413
|
|
|
290
414
|
if (remoteModuleDeferredRegistrationSpan) {
|
|
291
415
|
traceError(remoteModuleDeferredRegistrationSpan, registrationError);
|
|
292
416
|
}
|
|
417
|
+
}, {
|
|
418
|
+
onError: handleUnmanagedError
|
|
293
419
|
});
|
|
294
420
|
|
|
295
421
|
const handleFetchDataStarted = () => {
|
|
@@ -346,6 +472,7 @@ function registerTrackingListeners(runtime: FireflyRuntime) {
|
|
|
346
472
|
// will be aborted and a react-router error boundary will be rendered.
|
|
347
473
|
if (bootstrappingSpan) {
|
|
348
474
|
bootstrappingSpan.end();
|
|
475
|
+
bootstrappingSpanHasEnded = true;
|
|
349
476
|
}
|
|
350
477
|
}
|
|
351
478
|
};
|
|
@@ -358,35 +485,46 @@ function registerTrackingListeners(runtime: FireflyRuntime) {
|
|
|
358
485
|
handlePublicDataReady,
|
|
359
486
|
handleProtectedDataFetchStarted,
|
|
360
487
|
handleProtectedDataReady,
|
|
361
|
-
handleDataFetchFailed
|
|
488
|
+
handleDataFetchFailed,
|
|
489
|
+
handleUnmanagedError
|
|
362
490
|
);
|
|
363
491
|
|
|
364
|
-
runtime
|
|
492
|
+
addProtectedListener(runtime, ModulesRegisteredEvent, () => {
|
|
365
493
|
if (bootstrappingSpan) {
|
|
366
494
|
bootstrappingSpan.addEvent("modules-registered");
|
|
367
495
|
}
|
|
368
|
-
}, {
|
|
496
|
+
}, {
|
|
497
|
+
once: true,
|
|
498
|
+
onError: handleUnmanagedError
|
|
499
|
+
});
|
|
369
500
|
|
|
370
|
-
runtime
|
|
501
|
+
addProtectedListener(runtime, ModulesReadyEvent, () => {
|
|
371
502
|
if (bootstrappingSpan) {
|
|
372
503
|
bootstrappingSpan.addEvent("modules-ready");
|
|
373
504
|
}
|
|
374
|
-
}, {
|
|
505
|
+
}, {
|
|
506
|
+
once: true,
|
|
507
|
+
onError: handleUnmanagedError
|
|
508
|
+
});
|
|
375
509
|
|
|
376
510
|
// Can occur multiple times.
|
|
377
|
-
runtime
|
|
511
|
+
addProtectedListener(runtime, DeferredRegistrationsUpdateStartedEvent, () => {
|
|
378
512
|
deferredRegistrationsUpdateSpan = startSpan((options, context) => getTracer().startSpan("squide-deferred-registrations-update", options, context));
|
|
513
|
+
}, {
|
|
514
|
+
onError: handleUnmanagedError
|
|
379
515
|
});
|
|
380
516
|
|
|
381
517
|
// Can occur multiple times.
|
|
382
|
-
runtime
|
|
518
|
+
addProtectedListener(runtime, DeferredRegistrationsUpdateCompletedEvent, () => {
|
|
383
519
|
if (deferredRegistrationsUpdateSpan) {
|
|
384
520
|
deferredRegistrationsUpdateSpan.end();
|
|
385
521
|
}
|
|
522
|
+
}, {
|
|
523
|
+
onError: handleUnmanagedError
|
|
386
524
|
});
|
|
387
525
|
|
|
388
526
|
// Can occur multiple times.
|
|
389
|
-
runtime
|
|
527
|
+
addProtectedListener(runtime, LocalModulesDeferredRegistrationsUpdateStartedEvent, (payload: unknown) => {
|
|
390
528
|
const attributes = {
|
|
391
529
|
"app.squide.registration_count": (payload as LocalModulesDeferredRegistrationsUpdateStartedEventPayload).registrationCount
|
|
392
530
|
};
|
|
@@ -408,10 +546,12 @@ function registerTrackingListeners(runtime: FireflyRuntime) {
|
|
|
408
546
|
span
|
|
409
547
|
};
|
|
410
548
|
});
|
|
549
|
+
}, {
|
|
550
|
+
onError: handleUnmanagedError
|
|
411
551
|
});
|
|
412
552
|
|
|
413
553
|
// Can occur multiple times.
|
|
414
|
-
runtime
|
|
554
|
+
addProtectedListener(runtime, LocalModulesDeferredRegistrationsUpdateCompletedEvent, (payload: unknown) => {
|
|
415
555
|
if (deferredRegistrationsUpdateSpan) {
|
|
416
556
|
deferredRegistrationsUpdateSpan.addEvent("local-module-deferred-registrations-update-completed", {
|
|
417
557
|
"app.squide.registration_count": (payload as LocalModulesDeferredRegistrationsUpdateCompletedEventPayload).registrationCount
|
|
@@ -421,19 +561,23 @@ function registerTrackingListeners(runtime: FireflyRuntime) {
|
|
|
421
561
|
if (localModuleDeferredRegistrationsUpdateSpan) {
|
|
422
562
|
endActiveSpan(localModuleDeferredRegistrationsUpdateSpan);
|
|
423
563
|
}
|
|
564
|
+
}, {
|
|
565
|
+
onError: handleUnmanagedError
|
|
424
566
|
});
|
|
425
567
|
|
|
426
568
|
// Can occur multiple times.
|
|
427
|
-
runtime
|
|
569
|
+
addProtectedListener(runtime, LocalModuleDeferredRegistrationUpdateFailedEvent, (payload: unknown) => {
|
|
428
570
|
const registrationError = payload as ModuleRegistrationError;
|
|
429
571
|
|
|
430
572
|
if (localModuleDeferredRegistrationsUpdateSpan) {
|
|
431
573
|
traceError(localModuleDeferredRegistrationsUpdateSpan.instance, registrationError);
|
|
432
574
|
}
|
|
575
|
+
}, {
|
|
576
|
+
onError: handleUnmanagedError
|
|
433
577
|
});
|
|
434
578
|
|
|
435
579
|
// Can occur multiple times.
|
|
436
|
-
runtime
|
|
580
|
+
addProtectedListener(runtime, RemoteModulesDeferredRegistrationsUpdateStartedEvent, (payload: unknown) => {
|
|
437
581
|
const attributes = {
|
|
438
582
|
"app.squide.registration_count": (payload as RemoteModulesDeferredRegistrationsUpdateStartedEventPayload).registrationCount
|
|
439
583
|
};
|
|
@@ -455,10 +599,12 @@ function registerTrackingListeners(runtime: FireflyRuntime) {
|
|
|
455
599
|
span
|
|
456
600
|
};
|
|
457
601
|
});
|
|
602
|
+
}, {
|
|
603
|
+
onError: handleUnmanagedError
|
|
458
604
|
});
|
|
459
605
|
|
|
460
606
|
// Can occur multiple times.
|
|
461
|
-
runtime
|
|
607
|
+
addProtectedListener(runtime, RemoteModulesDeferredRegistrationsUpdateCompletedEvent, (payload: unknown) => {
|
|
462
608
|
if (deferredRegistrationsUpdateSpan) {
|
|
463
609
|
deferredRegistrationsUpdateSpan.addEvent("remote-module-deferred-registrations-update-completed", {
|
|
464
610
|
"app.squide.registration_count": (payload as RemoteModulesDeferredRegistrationsUpdateCompletedEventPayload).registrationCount
|
|
@@ -468,15 +614,19 @@ function registerTrackingListeners(runtime: FireflyRuntime) {
|
|
|
468
614
|
if (remoteModuleDeferredRegistrationsUpdateSpan) {
|
|
469
615
|
endActiveSpan(remoteModuleDeferredRegistrationsUpdateSpan);
|
|
470
616
|
}
|
|
617
|
+
}, {
|
|
618
|
+
onError: handleUnmanagedError
|
|
471
619
|
});
|
|
472
620
|
|
|
473
621
|
// Can occur multiple times.
|
|
474
|
-
runtime
|
|
622
|
+
addProtectedListener(runtime, RemoteModuleDeferredRegistrationUpdateFailedEvent, (payload: unknown) => {
|
|
475
623
|
const registrationError = payload as RemoteModuleRegistrationError;
|
|
476
624
|
|
|
477
625
|
if (remoteModuleDeferredRegistrationsUpdateSpan) {
|
|
478
626
|
traceError(remoteModuleDeferredRegistrationsUpdateSpan.instance, registrationError);
|
|
479
627
|
}
|
|
628
|
+
}, {
|
|
629
|
+
onError: handleUnmanagedError
|
|
480
630
|
});
|
|
481
631
|
}
|
|
482
632
|
|
|
@@ -496,19 +646,26 @@ function getRegisterFetchRequestHookFunction() {
|
|
|
496
646
|
}
|
|
497
647
|
|
|
498
648
|
export function registerHoneycombInstrumentation(runtime: FireflyRuntime) {
|
|
499
|
-
|
|
649
|
+
try {
|
|
650
|
+
const registerFetchRequestHookFunction = getRegisterFetchRequestHookFunction();
|
|
500
651
|
|
|
501
|
-
|
|
502
|
-
|
|
652
|
+
if (registerFetchRequestHookFunction) {
|
|
653
|
+
registerActiveSpanStack();
|
|
503
654
|
|
|
504
|
-
|
|
655
|
+
const activeSpanOverrideFunction = createOverrideFetchRequestSpanWithActiveSpanContext(runtime.logger);
|
|
505
656
|
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
657
|
+
// Dynamically registering this request hook function to nest the HTTP requests
|
|
658
|
+
// of squide bootstrapping under the appropriate Honeycomb span.
|
|
659
|
+
registerFetchRequestHookFunction(activeSpanOverrideFunction);
|
|
660
|
+
} else {
|
|
661
|
+
runtime.logger.warning("[squide] Cannot register Honeycomb fetch request hook because \"globalThis.__WLP_HONEYCOMB_REGISTER_DYNAMIC_FETCH_REQUEST_HOOK__\" is not available. Honeycomb instrumentation is still functional but in degraded mode.");
|
|
662
|
+
}
|
|
512
663
|
|
|
513
|
-
|
|
664
|
+
registerTrackingListeners(runtime);
|
|
665
|
+
} catch (error: unknown) {
|
|
666
|
+
runtime.logger
|
|
667
|
+
.withText("[squide] An error occurred while registering Honeycomb instrumentation:")
|
|
668
|
+
.withError(error as Error)
|
|
669
|
+
.error();
|
|
670
|
+
}
|
|
514
671
|
}
|