@squide/firefly 14.1.0 → 15.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -0
- package/dist/FireflyRuntime.d.ts +7 -1
- package/dist/FireflyRuntime.js +9 -1
- package/dist/FireflyRuntime.js.map +1 -1
- package/dist/honeycomb/initializeHoneycomb.js +3 -7
- package/dist/honeycomb/initializeHoneycomb.js.map +1 -1
- package/dist/honeycomb/registerHoneycombInstrumentation.js +5 -23
- package/dist/honeycomb/registerHoneycombInstrumentation.js.map +1 -1
- package/dist/initializeFirefly.d.ts +2 -0
- package/dist/initializeFirefly.js +2 -1
- package/dist/initializeFirefly.js.map +1 -1
- package/package.json +18 -17
- package/src/FireflyRuntime.tsx +14 -1
- package/src/honeycomb/initializeHoneycomb.ts +3 -4
- package/src/honeycomb/registerHoneycombInstrumentation.ts +6 -27
- package/src/initializeFirefly.ts +4 -0
- package/dist/honeycomb/canRegisterHoneycombInstrumentation.d.ts +0 -1
- package/dist/honeycomb/canRegisterHoneycombInstrumentation.js +0 -12
- package/dist/honeycomb/canRegisterHoneycombInstrumentation.js.map +0 -1
- package/src/honeycomb/canRegisterHoneycombInstrumentation.ts +0 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @squide/firefly
|
|
2
2
|
|
|
3
|
+
## 15.0.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#323](https://github.com/workleap/wl-squide/pull/323) [`8388f6d`](https://github.com/workleap/wl-squide/commit/8388f6dc03e45a0823da8d29fc73b7654c733db7) Thanks [@patricklafrance](https://github.com/patricklafrance)! - Added the honeycomb client to Squide runtime.
|
|
8
|
+
|
|
9
|
+
## 15.0.0
|
|
10
|
+
|
|
11
|
+
### Major Changes
|
|
12
|
+
|
|
13
|
+
- [#318](https://github.com/workleap/wl-squide/pull/318) [`6bf9a65`](https://github.com/workleap/wl-squide/commit/6bf9a65f222a6201655cf1ee525e94211aabe0b7) Thanks [@patricklafrance](https://github.com/patricklafrance)! - Honeycomb instrumentation is now registered when an Honeycomb client is provided to the `initializeFirefly` function rather than by implicitly using global variables. Also updated dependency versions.
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- Updated dependencies [[`6bf9a65`](https://github.com/workleap/wl-squide/commit/6bf9a65f222a6201655cf1ee525e94211aabe0b7)]:
|
|
18
|
+
- @squide/module-federation@7.0.2
|
|
19
|
+
- @squide/react-router@8.1.1
|
|
20
|
+
- @squide/core@6.1.1
|
|
21
|
+
- @squide/msw@4.0.2
|
|
22
|
+
|
|
3
23
|
## 14.1.0
|
|
4
24
|
|
|
5
25
|
### Minor Changes
|
package/dist/FireflyRuntime.d.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import type { RegisterRouteOptions, RuntimeMethodOptions, RuntimeOptions } from "@squide/core";
|
|
2
2
|
import { type IReactRouterRuntime, ReactRouterRuntime, ReactRouterRuntimeScope, type Route } from "@squide/react-router";
|
|
3
|
+
import type { HoneycombInstrumentationPartialClient } from "@workleap-telemetry/core";
|
|
3
4
|
import type { Logger } from "@workleap/logging";
|
|
4
5
|
import type { RequestHandler } from "msw";
|
|
5
6
|
import { type AppRouterStore } from "./AppRouterStore.ts";
|
|
6
7
|
export interface FireflyRuntimeOptions extends RuntimeOptions {
|
|
7
8
|
useMsw?: boolean;
|
|
9
|
+
honeycombInstrumentationClient?: HoneycombInstrumentationPartialClient;
|
|
8
10
|
}
|
|
9
11
|
export interface RegisterRequestHandlersOptions extends RuntimeMethodOptions {
|
|
10
12
|
}
|
|
@@ -13,16 +15,19 @@ export interface IFireflyRuntime extends IReactRouterRuntime {
|
|
|
13
15
|
get requestHandlers(): RequestHandler[];
|
|
14
16
|
get appRouterStore(): AppRouterStore;
|
|
15
17
|
get isMswEnabled(): boolean;
|
|
18
|
+
get honeycombInstrumentationClient(): HoneycombInstrumentationPartialClient | undefined;
|
|
16
19
|
}
|
|
17
20
|
export declare class FireflyRuntime extends ReactRouterRuntime implements IFireflyRuntime {
|
|
18
21
|
protected _appRouterStore: AppRouterStore;
|
|
19
22
|
protected _useMsw: boolean;
|
|
20
|
-
|
|
23
|
+
protected _honeycombInstrumentationClient: HoneycombInstrumentationPartialClient | undefined;
|
|
24
|
+
constructor({ plugins, useMsw, honeycombInstrumentationClient, ...options }?: FireflyRuntimeOptions);
|
|
21
25
|
registerRequestHandlers(handlers: RequestHandler[], options?: RegisterRequestHandlersOptions): void;
|
|
22
26
|
get requestHandlers(): RequestHandler[];
|
|
23
27
|
registerRoute(route: Route, options?: RegisterRouteOptions): void;
|
|
24
28
|
get appRouterStore(): AppRouterStore;
|
|
25
29
|
get isMswEnabled(): boolean;
|
|
30
|
+
get honeycombInstrumentationClient(): HoneycombInstrumentationPartialClient | undefined;
|
|
26
31
|
startScope(logger: Logger): FireflyRuntime;
|
|
27
32
|
}
|
|
28
33
|
export declare class FireflyRuntimeScope<TRuntime extends FireflyRuntime = FireflyRuntime> extends ReactRouterRuntimeScope<TRuntime> implements IFireflyRuntime {
|
|
@@ -30,4 +35,5 @@ export declare class FireflyRuntimeScope<TRuntime extends FireflyRuntime = Firef
|
|
|
30
35
|
get requestHandlers(): RequestHandler[];
|
|
31
36
|
get appRouterStore(): AppRouterStore;
|
|
32
37
|
get isMswEnabled(): boolean;
|
|
38
|
+
get honeycombInstrumentationClient(): HoneycombInstrumentationPartialClient | undefined;
|
|
33
39
|
}
|
package/dist/FireflyRuntime.js
CHANGED
|
@@ -19,7 +19,8 @@ import { createAppRouterStore } from "./AppRouterStore.js";
|
|
|
19
19
|
class FireflyRuntime extends ReactRouterRuntime {
|
|
20
20
|
_appRouterStore;
|
|
21
21
|
_useMsw;
|
|
22
|
-
|
|
22
|
+
_honeycombInstrumentationClient;
|
|
23
|
+
constructor({ plugins, useMsw, honeycombInstrumentationClient, ...options } = {}){
|
|
23
24
|
if (useMsw) {
|
|
24
25
|
super({
|
|
25
26
|
plugins: [
|
|
@@ -37,6 +38,7 @@ class FireflyRuntime extends ReactRouterRuntime {
|
|
|
37
38
|
this._useMsw = false;
|
|
38
39
|
}
|
|
39
40
|
this._appRouterStore = createAppRouterStore(this._logger);
|
|
41
|
+
this._honeycombInstrumentationClient = honeycombInstrumentationClient;
|
|
40
42
|
}
|
|
41
43
|
registerRequestHandlers(handlers, options = {}) {
|
|
42
44
|
const logger = this._getLogger(options);
|
|
@@ -71,6 +73,9 @@ class FireflyRuntime extends ReactRouterRuntime {
|
|
|
71
73
|
get isMswEnabled() {
|
|
72
74
|
return this._useMsw;
|
|
73
75
|
}
|
|
76
|
+
get honeycombInstrumentationClient() {
|
|
77
|
+
return this._honeycombInstrumentationClient;
|
|
78
|
+
}
|
|
74
79
|
startScope(logger) {
|
|
75
80
|
return new FireflyRuntimeScope(this, logger);
|
|
76
81
|
}
|
|
@@ -91,6 +96,9 @@ class FireflyRuntimeScope extends ReactRouterRuntimeScope {
|
|
|
91
96
|
get isMswEnabled() {
|
|
92
97
|
return this._runtime.isMswEnabled;
|
|
93
98
|
}
|
|
99
|
+
get honeycombInstrumentationClient() {
|
|
100
|
+
return this._runtime.honeycombInstrumentationClient;
|
|
101
|
+
}
|
|
94
102
|
}
|
|
95
103
|
|
|
96
104
|
export { FireflyRuntime, FireflyRuntimeScope };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FireflyRuntime.js","sources":["webpack://@squide/firefly/./src/FireflyRuntime.tsx"],"sourcesContent":["import type { RegisterRouteOptions, RuntimeMethodOptions, RuntimeOptions } from \"@squide/core\";\nimport { MswPlugin, MswPluginName } from \"@squide/msw\";\nimport { type IReactRouterRuntime, ReactRouterRuntime, ReactRouterRuntimeScope, type Route } from \"@squide/react-router\";\nimport type { Logger } from \"@workleap/logging\";\nimport type { RequestHandler } from \"msw\";\nimport { getAreModulesRegistered } from \"./AppRouterReducer.ts\";\nimport { type AppRouterStore, createAppRouterStore } from \"./AppRouterStore.ts\";\n\nexport interface FireflyRuntimeOptions extends RuntimeOptions {\n useMsw?: boolean;\n}\n\nexport interface RegisterRequestHandlersOptions extends RuntimeMethodOptions {}\n\nexport interface IFireflyRuntime extends IReactRouterRuntime {\n registerRequestHandlers: (handlers: RequestHandler[]) => void;\n get requestHandlers(): RequestHandler[];\n get appRouterStore(): AppRouterStore;\n get isMswEnabled(): boolean;\n}\n\nexport class FireflyRuntime extends ReactRouterRuntime implements IFireflyRuntime {\n protected _appRouterStore: AppRouterStore;\n protected _useMsw: boolean;\n\n constructor({ plugins, useMsw, ...options }: FireflyRuntimeOptions = {}) {\n if (useMsw) {\n super({\n plugins: [\n ...(plugins ?? []),\n runtime => new MswPlugin(runtime)\n ],\n ...options\n });\n\n this._useMsw = true;\n } else {\n super({\n plugins,\n ...options\n });\n\n this._useMsw = false;\n }\n\n this._appRouterStore = createAppRouterStore(this._logger);\n }\n\n registerRequestHandlers(handlers: RequestHandler[], options: RegisterRequestHandlersOptions = {}) {\n const logger = this._getLogger(options);\n const mswPlugin = this.getPlugin(MswPluginName) as MswPlugin;\n\n if (!mswPlugin) {\n throw new Error(\"[squide] Cannot register the provided MSW request handlers because the runtime hasn't been initialized with MSW. Did you instanciate the FireflyRuntime with the \\\"useMsw\\\" option?\");\n }\n\n if (getAreModulesRegistered()) {\n throw new Error(\"[squide] Cannot register an MSW request handlers once the modules are registered. Are you trying to register an MSW request handler in a deferred registration function? Only navigation items can be registered in a deferred registration function.\");\n }\n\n mswPlugin.registerRequestHandlers(handlers, {\n logger\n });\n }\n\n // Must define a return type otherwise we get an \"error TS2742: The inferred type of 'requestHandlers' cannot be named\" error.\n get requestHandlers(): RequestHandler[] {\n const mswPlugin = this.getPlugin(MswPluginName) as MswPlugin;\n\n if (!mswPlugin) {\n throw new Error(\"[squide] Cannot retrieve MSW request handlers because the runtime hasn't been initialized with MSW. Did you instanciate the FireflyRuntime with the \\\"useMsw\\\" option?\");\n }\n\n return mswPlugin.requestHandlers;\n }\n\n registerRoute(route: Route, options: RegisterRouteOptions = {}) {\n if (getAreModulesRegistered()) {\n throw new Error(\"[squide] Cannot register a route once the modules are registered. Are you trying to register a route in a deferred registration function? Only navigation items can be registered in a deferred registration function.\");\n }\n\n super.registerRoute(route, options);\n }\n\n get appRouterStore() {\n return this._appRouterStore;\n }\n\n get isMswEnabled() {\n return this._useMsw;\n }\n\n startScope(logger: Logger): FireflyRuntime {\n return (new FireflyRuntimeScope(this, logger) as unknown) as FireflyRuntime;\n }\n}\n\nexport class FireflyRuntimeScope<TRuntime extends FireflyRuntime = FireflyRuntime> extends ReactRouterRuntimeScope<TRuntime> implements IFireflyRuntime {\n registerRequestHandlers(handlers: RequestHandler[], options: RegisterRequestHandlersOptions = {}) {\n this._runtime.registerRequestHandlers(handlers, {\n ...options,\n logger: this._getLogger(options)\n });\n }\n\n get requestHandlers(): RequestHandler[] {\n return this._runtime.requestHandlers;\n }\n\n get appRouterStore() {\n return this._runtime.appRouterStore;\n }\n\n get isMswEnabled() {\n return this._runtime.isMswEnabled;\n }\n}\n"],"names":["MswPlugin","MswPluginName","ReactRouterRuntime","ReactRouterRuntimeScope","getAreModulesRegistered","createAppRouterStore","FireflyRuntime","plugins","useMsw","options","runtime","handlers","logger","mswPlugin","Error","route","FireflyRuntimeScope"],"mappings":";;;;;;;;;;;;;;AACuD;AACkE;
|
|
1
|
+
{"version":3,"file":"FireflyRuntime.js","sources":["webpack://@squide/firefly/./src/FireflyRuntime.tsx"],"sourcesContent":["import type { RegisterRouteOptions, RuntimeMethodOptions, RuntimeOptions } from \"@squide/core\";\nimport { MswPlugin, MswPluginName } from \"@squide/msw\";\nimport { type IReactRouterRuntime, ReactRouterRuntime, ReactRouterRuntimeScope, type Route } from \"@squide/react-router\";\nimport type { HoneycombInstrumentationPartialClient } from \"@workleap-telemetry/core\";\nimport type { Logger } from \"@workleap/logging\";\nimport type { RequestHandler } from \"msw\";\nimport { getAreModulesRegistered } from \"./AppRouterReducer.ts\";\nimport { type AppRouterStore, createAppRouterStore } from \"./AppRouterStore.ts\";\n\nexport interface FireflyRuntimeOptions extends RuntimeOptions {\n useMsw?: boolean;\n honeycombInstrumentationClient?: HoneycombInstrumentationPartialClient;\n}\n\nexport interface RegisterRequestHandlersOptions extends RuntimeMethodOptions {}\n\nexport interface IFireflyRuntime extends IReactRouterRuntime {\n registerRequestHandlers: (handlers: RequestHandler[]) => void;\n get requestHandlers(): RequestHandler[];\n get appRouterStore(): AppRouterStore;\n get isMswEnabled(): boolean;\n get honeycombInstrumentationClient(): HoneycombInstrumentationPartialClient | undefined;\n}\n\nexport class FireflyRuntime extends ReactRouterRuntime implements IFireflyRuntime {\n protected _appRouterStore: AppRouterStore;\n protected _useMsw: boolean;\n protected _honeycombInstrumentationClient: HoneycombInstrumentationPartialClient | undefined;\n\n constructor({ plugins, useMsw, honeycombInstrumentationClient, ...options }: FireflyRuntimeOptions = {}) {\n if (useMsw) {\n super({\n plugins: [\n ...(plugins ?? []),\n runtime => new MswPlugin(runtime)\n ],\n ...options\n });\n\n this._useMsw = true;\n } else {\n super({\n plugins,\n ...options\n });\n\n this._useMsw = false;\n }\n\n this._appRouterStore = createAppRouterStore(this._logger);\n this._honeycombInstrumentationClient = honeycombInstrumentationClient;\n }\n\n registerRequestHandlers(handlers: RequestHandler[], options: RegisterRequestHandlersOptions = {}) {\n const logger = this._getLogger(options);\n const mswPlugin = this.getPlugin(MswPluginName) as MswPlugin;\n\n if (!mswPlugin) {\n throw new Error(\"[squide] Cannot register the provided MSW request handlers because the runtime hasn't been initialized with MSW. Did you instanciate the FireflyRuntime with the \\\"useMsw\\\" option?\");\n }\n\n if (getAreModulesRegistered()) {\n throw new Error(\"[squide] Cannot register an MSW request handlers once the modules are registered. Are you trying to register an MSW request handler in a deferred registration function? Only navigation items can be registered in a deferred registration function.\");\n }\n\n mswPlugin.registerRequestHandlers(handlers, {\n logger\n });\n }\n\n // Must define a return type otherwise we get an \"error TS2742: The inferred type of 'requestHandlers' cannot be named\" error.\n get requestHandlers(): RequestHandler[] {\n const mswPlugin = this.getPlugin(MswPluginName) as MswPlugin;\n\n if (!mswPlugin) {\n throw new Error(\"[squide] Cannot retrieve MSW request handlers because the runtime hasn't been initialized with MSW. Did you instanciate the FireflyRuntime with the \\\"useMsw\\\" option?\");\n }\n\n return mswPlugin.requestHandlers;\n }\n\n registerRoute(route: Route, options: RegisterRouteOptions = {}) {\n if (getAreModulesRegistered()) {\n throw new Error(\"[squide] Cannot register a route once the modules are registered. Are you trying to register a route in a deferred registration function? Only navigation items can be registered in a deferred registration function.\");\n }\n\n super.registerRoute(route, options);\n }\n\n get appRouterStore() {\n return this._appRouterStore;\n }\n\n get isMswEnabled() {\n return this._useMsw;\n }\n\n get honeycombInstrumentationClient() {\n return this._honeycombInstrumentationClient;\n }\n\n startScope(logger: Logger): FireflyRuntime {\n return (new FireflyRuntimeScope(this, logger) as unknown) as FireflyRuntime;\n }\n}\n\nexport class FireflyRuntimeScope<TRuntime extends FireflyRuntime = FireflyRuntime> extends ReactRouterRuntimeScope<TRuntime> implements IFireflyRuntime {\n registerRequestHandlers(handlers: RequestHandler[], options: RegisterRequestHandlersOptions = {}) {\n this._runtime.registerRequestHandlers(handlers, {\n ...options,\n logger: this._getLogger(options)\n });\n }\n\n get requestHandlers(): RequestHandler[] {\n return this._runtime.requestHandlers;\n }\n\n get appRouterStore() {\n return this._runtime.appRouterStore;\n }\n\n get isMswEnabled() {\n return this._runtime.isMswEnabled;\n }\n\n get honeycombInstrumentationClient() {\n return this._runtime.honeycombInstrumentationClient;\n }\n}\n"],"names":["MswPlugin","MswPluginName","ReactRouterRuntime","ReactRouterRuntimeScope","getAreModulesRegistered","createAppRouterStore","FireflyRuntime","plugins","useMsw","honeycombInstrumentationClient","options","runtime","handlers","logger","mswPlugin","Error","route","FireflyRuntimeScope"],"mappings":";;;;;;;;;;;;;;AACuD;AACkE;AAIzD;AACgB;AAiBzE,MAAMM,uBAAuBJ,kBAAkBA;IACxC,gBA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QACf,OAAO,IAAI,CAAC,OAAO;IACvB;IAEA,IAAI,iCAAiC;QACjC,OAAO,IAAI,CAAC,+BAA+B;IAC/C;IAEA,WAAWG,MAAc,EAAkB;QACvC,OAAQ,IAAII,oBAAoB,IAAI,EAAEJ;IAC1C;AACJ;AAEO,MAAMI,4BAA8Ed,uBAAuBA;IAC9G,wBAAwBS,QAA0B,EAAEF,UAA0C,CAAC,CAAC,EAAE;QAC9F,IAAI,CAAC,QAAQ,CAAC,uBAAuB,CAACE,UAAU;YAC5C,GAAGF,OAAO;YACV,QAAQ,IAAI,CAAC,UAAU,CAACA;QAC5B;IACJ;IAEA,IAAI,kBAAoC;QACpC,OAAO,IAAI,CAAC,QAAQ,CAAC,eAAe;IACxC;IAEA,IAAI,iBAAiB;QACjB,OAAO,IAAI,CAAC,QAAQ,CAAC,cAAc;IACvC;IAEA,IAAI,eAAe;QACf,OAAO,IAAI,CAAC,QAAQ,CAAC,YAAY;IACrC;IAEA,IAAI,iCAAiC;QACjC,OAAO,IAAI,CAAC,QAAQ,CAAC,8BAA8B;IACvD;AACJ"}
|
|
@@ -1,22 +1,18 @@
|
|
|
1
|
-
import { canRegisterHoneycombInstrumentation } from "./canRegisterHoneycombInstrumentation.js";
|
|
2
|
-
|
|
3
|
-
;// CONCATENATED MODULE: external "./canRegisterHoneycombInstrumentation.js"
|
|
4
1
|
|
|
5
2
|
;// CONCATENATED MODULE: ./src/honeycomb/initializeHoneycomb.ts
|
|
6
|
-
|
|
7
3
|
async function initializeHoneycomb(runtime) {
|
|
8
|
-
if (
|
|
4
|
+
if (runtime.honeycombInstrumentationClient) {
|
|
9
5
|
try {
|
|
10
6
|
// Dynamically import the Honeycomb instrumentation to prevent loading all the Honeycomb libraries
|
|
11
7
|
// if Honeycomb instrumentation is not registered by the hosting application.
|
|
12
8
|
const mod = await import("./registerHoneycombInstrumentation.js");
|
|
13
9
|
mod.registerHoneycombInstrumentation(runtime);
|
|
14
10
|
} catch (error) {
|
|
15
|
-
runtime.logger.error("[squide] Failed to register Honeycomb instrumentation. The \"./registerHoneycombInstrumentation.ts\" cannot be imported.");
|
|
11
|
+
runtime.logger.error("[squide] Failed to register Honeycomb instrumentation. The \"./registerHoneycombInstrumentation.ts\" file cannot be imported.");
|
|
16
12
|
throw error;
|
|
17
13
|
}
|
|
18
14
|
} else {
|
|
19
|
-
runtime.logger.information("[squide] Cannot register Honeycomb instrumentation because the host application
|
|
15
|
+
runtime.logger.information("[squide] Cannot register Honeycomb instrumentation because the host application hasn't provided a client.");
|
|
20
16
|
}
|
|
21
17
|
}
|
|
22
18
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"honeycomb/initializeHoneycomb.js","sources":["webpack://@squide/firefly/./src/honeycomb/initializeHoneycomb.ts"],"sourcesContent":["import type { FireflyRuntime } from \"../FireflyRuntime.tsx\";\
|
|
1
|
+
{"version":3,"file":"honeycomb/initializeHoneycomb.js","sources":["webpack://@squide/firefly/./src/honeycomb/initializeHoneycomb.ts"],"sourcesContent":["import type { FireflyRuntime } from \"../FireflyRuntime.tsx\";\n\nexport async function initializeHoneycomb(runtime: FireflyRuntime) {\n if (runtime.honeycombInstrumentationClient) {\n try {\n // Dynamically import the Honeycomb instrumentation to prevent loading all the Honeycomb libraries\n // if Honeycomb instrumentation is not registered by the hosting application.\n const mod = await import(\"./registerHoneycombInstrumentation.ts\");\n\n mod.registerHoneycombInstrumentation(runtime);\n } catch (error: unknown) {\n runtime.logger.error(\"[squide] Failed to register Honeycomb instrumentation. The \\\"./registerHoneycombInstrumentation.ts\\\" file cannot be imported.\");\n\n throw error;\n }\n } else {\n runtime.logger.information(\"[squide] Cannot register Honeycomb instrumentation because the host application hasn't provided a client.\");\n }\n}\n\n\n"],"names":["initializeHoneycomb","runtime","mod","error"],"mappings":";;AAEO,eAAeA,oBAAoBC,OAAuB;IAC7D,IAAIA,QAAQ,8BAA8B,EAAE;QACxC,IAAI;YACA,kGAAkG;YAClG,6EAA6E;YAC7E,MAAMC,MAAM,MAAM,+CAA+C;YAEjEA,IAAI,gCAAgC,CAACD;QACzC,EAAE,OAAOE,OAAgB;YACrBF,QAAQ,MAAM,CAAC,KAAK,CAAC;YAErB,MAAME;QACV;IACJ,OAAO;QACHF,QAAQ,MAAM,CAAC,WAAW,CAAC;IAC/B;AACJ"}
|
|
@@ -507,32 +507,14 @@ function registerTrackingListeners(runtime) {
|
|
|
507
507
|
onError: handleUnmanagedError
|
|
508
508
|
});
|
|
509
509
|
}
|
|
510
|
-
function getRegisterFetchRequestHookFunction() {
|
|
511
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
512
|
-
// @ts-ignore
|
|
513
|
-
if (globalThis.__WLP_HONEYCOMB_REGISTER_DYNAMIC_FETCH_REQUEST_HOOK__) {
|
|
514
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
515
|
-
// @ts-ignore
|
|
516
|
-
return globalThis.__WLP_HONEYCOMB_REGISTER_DYNAMIC_FETCH_REQUEST_HOOK__;
|
|
517
|
-
}
|
|
518
|
-
// Fallback to fix an error. Will remove soon.
|
|
519
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
520
|
-
// @ts-ignore
|
|
521
|
-
return globalThis.__WLP_HONEYCOMB_REGISTER_DYNAMIC_FETCH_REQUEST_HOOK;
|
|
522
|
-
}
|
|
523
510
|
function registerHoneycombInstrumentation(runtime) {
|
|
524
511
|
try {
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
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
|
-
}
|
|
512
|
+
registerActiveSpanStack();
|
|
513
|
+
// Dynamically registering this request hook function to nest the HTTP requests
|
|
514
|
+
// of squide bootstrapping under the appropriate Honeycomb span.
|
|
515
|
+
runtime.honeycombInstrumentationClient?.registerFetchRequestHook(createOverrideFetchRequestSpanWithActiveSpanContext(runtime.logger));
|
|
535
516
|
registerTrackingListeners(runtime);
|
|
517
|
+
runtime.logger.information("[squide] Honeycomb instrumentation is registered.");
|
|
536
518
|
} catch (error) {
|
|
537
519
|
runtime.logger.withText("[squide] An error occurred while registering Honeycomb instrumentation:").withError(error).error();
|
|
538
520
|
}
|
|
@@ -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 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,E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,GAAG4B;YAEH,OAAO;gBACHI;gBACAC;YACJ;QACJ;IACJ,GAAG;QACC,SAASN;IACb;IAEA,4BAA4B;IAC5B/B,qBAAqBC,SAASxB,sDAAsDA,EAAE,CAACyC;QACnF,IAAIU,iCAAiC;YACjCA,gCAAgC,QAAQ,CAAC,yDAAyD;gBAC9F,iCAAkCV,QAA0E,iBAAiB;YACjI;QACJ;QAEA,IAAIY,6CAA6C;YAC7CnC,aAAaA,CAACmC;QAClB;IACJ,GAAG;QACC,SAASC;IACb;IAEA,4BAA4B;IAC5B/B,qBAAqBC,SAAS5B,iDAAiDA,EAAE,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"}
|
|
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\nexport function registerHoneycombInstrumentation(runtime: FireflyRuntime) {\n try {\n registerActiveSpanStack();\n\n // Dynamically registering this request hook function to nest the HTTP requests\n // of squide bootstrapping under the appropriate Honeycomb span.\n runtime.honeycombInstrumentationClient?.registerFetchRequestHook(createOverrideFetchRequestSpanWithActiveSpanContext(runtime.logger));\n\n registerTrackingListeners(runtime);\n\n runtime.logger.information(\"[squide] Honeycomb instrumentation is registered.\");\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","registerHoneycombInstrumentation"],"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,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ASA,GAAG,SAAS,CAAC0C,MAAM;gBACrCH;gBACA,GAAG7B,OAAO;YACd,GAAG4B;YAEH,OAAO;gBACHI;gBACAC;YACJ;QACJ;IACJ,GAAG;QACC,SAASN;IACb;IAEA,4BAA4B;IAC5B/B,qBAAqBC,SAASxB,sDAAsDA,EAAE,CAACyC;QACnF,IAAIU,iCAAiC;YACjCA,gCAAgC,QAAQ,CAAC,yDAAyD;gBAC9F,iCAAkCV,QAA0E,iBAAiB;YACjI;QACJ;QAEA,IAAIY,6CAA6C;YAC7CnC,aAAaA,CAACmC;QAClB;IACJ,GAAG;QACC,SAASC;IACb;IAEA,4BAA4B;IAC5B/B,qBAAqBC,SAAS5B,iDAAiDA,EAAE,CAAC6C;QAC9E,MAAMgB,oBAAoBhB;QAE1B,IAAIY,6CAA6C;YAC7C/B,UAAUA,CAAC+B,4CAA4C,QAAQ,EAAEI;QACrE;IACJ,GAAG;QACC,SAASH;IACb;AACJ;AAEO,SAASc,iCAAiC5C,OAAuB;IACpE,IAAI;QACAR,uBAAuBA;QAEvB,+EAA+E;QAC/E,gEAAgE;QAChEQ,QAAQ,8BAA8B,EAAE,yBAAyBT,mDAAmDA,CAACS,QAAQ,MAAM;QAEnImB,0BAA0BnB;QAE1BA,QAAQ,MAAM,CAAC,WAAW,CAAC;IAC/B,EAAE,OAAOM,OAAgB;QACrBN,QAAQ,MAAM,CACT,QAAQ,CAAC,2EACT,SAAS,CAACM,OACV,KAAK;IACd;AACJ"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type ModuleRegisterFunction, type RegisterModulesOptions } from "@squide/core";
|
|
2
2
|
import { type RemoteDefinition } from "@squide/module-federation";
|
|
3
|
+
import type { HoneycombInstrumentationPartialClient } from "@workleap-telemetry/core";
|
|
3
4
|
import { FireflyRuntime, type FireflyRuntimeOptions } from "./FireflyRuntime.tsx";
|
|
4
5
|
export declare const ApplicationBootstrappingStartedEvent = "squide-app-bootstrapping-started";
|
|
5
6
|
export type OnInitializationErrorFunction = (error: unknown) => void;
|
|
@@ -7,6 +8,7 @@ export type StartMswFunction<TRuntime = FireflyRuntime> = (runtime: TRuntime) =>
|
|
|
7
8
|
export interface InitializeFireflyOptions<TRuntime extends FireflyRuntime, TContext = unknown, TData = unknown> extends RegisterModulesOptions<TContext>, FireflyRuntimeOptions {
|
|
8
9
|
localModules?: ModuleRegisterFunction<TRuntime, TContext, TData>[];
|
|
9
10
|
remotes?: RemoteDefinition[];
|
|
11
|
+
honeycombInstrumentationClient?: HoneycombInstrumentationPartialClient;
|
|
10
12
|
startMsw?: StartMswFunction<FireflyRuntime>;
|
|
11
13
|
onError?: OnInitializationErrorFunction;
|
|
12
14
|
}
|
|
@@ -59,7 +59,7 @@ function bootstrap(runtime, options = {}) {
|
|
|
59
59
|
}
|
|
60
60
|
let hasExecuted = false;
|
|
61
61
|
function initializeFirefly(options = {}) {
|
|
62
|
-
const { mode, useMsw, loggers, plugins, onError } = options;
|
|
62
|
+
const { mode, useMsw, loggers, plugins, honeycombInstrumentationClient, onError } = options;
|
|
63
63
|
if (hasExecuted) {
|
|
64
64
|
throw new Error("[squide] A squide application can only be initialized once. Did you call the \"initializeSquide\" function twice?");
|
|
65
65
|
}
|
|
@@ -67,6 +67,7 @@ function initializeFirefly(options = {}) {
|
|
|
67
67
|
const runtime = new FireflyRuntime({
|
|
68
68
|
mode,
|
|
69
69
|
useMsw,
|
|
70
|
+
honeycombInstrumentationClient,
|
|
70
71
|
loggers,
|
|
71
72
|
plugins
|
|
72
73
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initializeFirefly.js","sources":["webpack://@squide/firefly/./src/initializeFirefly.ts"],"sourcesContent":["import { isFunction, registerLocalModules, type ModuleRegisterFunction, type RegisterModulesOptions } from \"@squide/core\";\nimport { registerRemoteModules, type RemoteDefinition } from \"@squide/module-federation\";\nimport { setMswAsReady } from \"@squide/msw\";\nimport { FireflyRuntime, type FireflyRuntimeOptions } from \"./FireflyRuntime.tsx\";\nimport { initializeHoneycomb } from \"./honeycomb/initializeHoneycomb.ts\";\n\nexport const ApplicationBootstrappingStartedEvent = \"squide-app-bootstrapping-started\";\n\nexport type OnInitializationErrorFunction = (error: unknown) => void;\n\nexport type StartMswFunction<TRuntime = FireflyRuntime> = (runtime: TRuntime) => Promise<void>;\n\nexport interface InitializeFireflyOptions<TRuntime extends FireflyRuntime, TContext = unknown, TData = unknown> extends RegisterModulesOptions<TContext>, FireflyRuntimeOptions {\n localModules?: ModuleRegisterFunction<TRuntime, TContext, TData>[];\n remotes?: RemoteDefinition[];\n startMsw?: StartMswFunction<FireflyRuntime>;\n onError?: OnInitializationErrorFunction;\n}\n\nfunction propagateRegistrationErrors(results: PromiseSettledResult<unknown[]>, onError: OnInitializationErrorFunction) {\n if (results) {\n if (results.status === \"fulfilled\") {\n results.value.forEach(x => {\n onError(x);\n });\n }\n }\n}\n\nexport function bootstrap<TRuntime extends FireflyRuntime = FireflyRuntime, TContext = unknown, TData = unknown>(runtime: TRuntime, options: InitializeFireflyOptions<TRuntime, TContext, TData> = {}) {\n const {\n localModules = [],\n remotes = [],\n startMsw,\n onError,\n context\n } = options;\n\n runtime.eventBus.dispatch(ApplicationBootstrappingStartedEvent);\n\n Promise.allSettled([\n registerLocalModules<TRuntime, TContext, TData>(localModules, runtime, { context }),\n registerRemoteModules(remotes, runtime, { context })\n ]).then(results => {\n if (runtime.isMswEnabled) {\n if (!isFunction(startMsw)) {\n throw new Error(\"[squide] When MSW is enabled, the \\\"startMsw\\\" function must be provided.\");\n }\n\n startMsw(runtime)\n .then(() => {\n setMswAsReady();\n })\n .catch((error: unknown) => {\n runtime.logger\n .withText(\"[squide] An error occured while starting MSW.\")\n .withError(error as Error)\n .error();\n });\n }\n\n if (onError) {\n propagateRegistrationErrors(results[0], onError);\n propagateRegistrationErrors(results[1], onError);\n }\n });\n}\n\nlet hasExecuted = false;\n\nexport function initializeFirefly<TContext = unknown, TData = unknown>(options: InitializeFireflyOptions<FireflyRuntime, TContext, TData> = {}) {\n const {\n mode,\n useMsw,\n loggers,\n plugins,\n onError\n } = options;\n\n if (hasExecuted) {\n throw new Error(\"[squide] A squide application can only be initialized once. Did you call the \\\"initializeSquide\\\" function twice?\");\n }\n\n hasExecuted = true;\n\n const runtime = new FireflyRuntime({\n mode,\n useMsw,\n loggers,\n plugins\n });\n\n initializeHoneycomb(runtime)\n .catch((error: unknown) => {\n if (onError) {\n onError(error);\n }\n })\n .finally(() => {\n bootstrap(runtime, options);\n });\n\n return runtime;\n}\n\nexport function __resetHasExecuteGuard() {\n hasExecuted = false;\n}\n"],"names":["isFunction","registerLocalModules","registerRemoteModules","setMswAsReady","FireflyRuntime","initializeHoneycomb","ApplicationBootstrappingStartedEvent","propagateRegistrationErrors","results","onError","x","bootstrap","runtime","options","localModules","remotes","startMsw","context","Promise","Error","error","hasExecuted","initializeFirefly","mode","useMsw","loggers","plugins","__resetHasExecuteGuard"],"mappings":";;;;;;;;;;;;;;;;;AAA0H;AACjC;AAC7C;
|
|
1
|
+
{"version":3,"file":"initializeFirefly.js","sources":["webpack://@squide/firefly/./src/initializeFirefly.ts"],"sourcesContent":["import { isFunction, registerLocalModules, type ModuleRegisterFunction, type RegisterModulesOptions } from \"@squide/core\";\nimport { registerRemoteModules, type RemoteDefinition } from \"@squide/module-federation\";\nimport { setMswAsReady } from \"@squide/msw\";\nimport type { HoneycombInstrumentationPartialClient } from \"@workleap-telemetry/core\";\nimport { FireflyRuntime, type FireflyRuntimeOptions } from \"./FireflyRuntime.tsx\";\nimport { initializeHoneycomb } from \"./honeycomb/initializeHoneycomb.ts\";\n\nexport const ApplicationBootstrappingStartedEvent = \"squide-app-bootstrapping-started\";\n\nexport type OnInitializationErrorFunction = (error: unknown) => void;\n\nexport type StartMswFunction<TRuntime = FireflyRuntime> = (runtime: TRuntime) => Promise<void>;\n\nexport interface InitializeFireflyOptions<TRuntime extends FireflyRuntime, TContext = unknown, TData = unknown> extends RegisterModulesOptions<TContext>, FireflyRuntimeOptions {\n localModules?: ModuleRegisterFunction<TRuntime, TContext, TData>[];\n remotes?: RemoteDefinition[];\n honeycombInstrumentationClient?: HoneycombInstrumentationPartialClient;\n startMsw?: StartMswFunction<FireflyRuntime>;\n onError?: OnInitializationErrorFunction;\n}\n\nfunction propagateRegistrationErrors(results: PromiseSettledResult<unknown[]>, onError: OnInitializationErrorFunction) {\n if (results) {\n if (results.status === \"fulfilled\") {\n results.value.forEach(x => {\n onError(x);\n });\n }\n }\n}\n\nexport function bootstrap<TRuntime extends FireflyRuntime = FireflyRuntime, TContext = unknown, TData = unknown>(runtime: TRuntime, options: InitializeFireflyOptions<TRuntime, TContext, TData> = {}) {\n const {\n localModules = [],\n remotes = [],\n startMsw,\n onError,\n context\n } = options;\n\n runtime.eventBus.dispatch(ApplicationBootstrappingStartedEvent);\n\n Promise.allSettled([\n registerLocalModules<TRuntime, TContext, TData>(localModules, runtime, { context }),\n registerRemoteModules(remotes, runtime, { context })\n ]).then(results => {\n if (runtime.isMswEnabled) {\n if (!isFunction(startMsw)) {\n throw new Error(\"[squide] When MSW is enabled, the \\\"startMsw\\\" function must be provided.\");\n }\n\n startMsw(runtime)\n .then(() => {\n setMswAsReady();\n })\n .catch((error: unknown) => {\n runtime.logger\n .withText(\"[squide] An error occured while starting MSW.\")\n .withError(error as Error)\n .error();\n });\n }\n\n if (onError) {\n propagateRegistrationErrors(results[0], onError);\n propagateRegistrationErrors(results[1], onError);\n }\n });\n}\n\nlet hasExecuted = false;\n\nexport function initializeFirefly<TContext = unknown, TData = unknown>(options: InitializeFireflyOptions<FireflyRuntime, TContext, TData> = {}) {\n const {\n mode,\n useMsw,\n loggers,\n plugins,\n honeycombInstrumentationClient,\n onError\n } = options;\n\n if (hasExecuted) {\n throw new Error(\"[squide] A squide application can only be initialized once. Did you call the \\\"initializeSquide\\\" function twice?\");\n }\n\n hasExecuted = true;\n\n const runtime = new FireflyRuntime({\n mode,\n useMsw,\n honeycombInstrumentationClient,\n loggers,\n plugins\n });\n\n initializeHoneycomb(runtime)\n .catch((error: unknown) => {\n if (onError) {\n onError(error);\n }\n })\n .finally(() => {\n bootstrap(runtime, options);\n });\n\n return runtime;\n}\n\nexport function __resetHasExecuteGuard() {\n hasExecuted = false;\n}\n"],"names":["isFunction","registerLocalModules","registerRemoteModules","setMswAsReady","FireflyRuntime","initializeHoneycomb","ApplicationBootstrappingStartedEvent","propagateRegistrationErrors","results","onError","x","bootstrap","runtime","options","localModules","remotes","startMsw","context","Promise","Error","error","hasExecuted","initializeFirefly","mode","useMsw","loggers","plugins","honeycombInstrumentationClient","__resetHasExecuteGuard"],"mappings":";;;;;;;;;;;;;;;;;AAA0H;AACjC;AAC7C;AAEsC;AACT;AAElE,MAAMM,uCAAuC,mCAAmC;AAcvF,SAASC,4BAA4BC,OAAwC,EAAEC,OAAsC;IACjH,IAAID,SAAS;QACT,IAAIA,QAAQ,MAAM,KAAK,aAAa;YAChCA,QAAQ,KAAK,CAAC,OAAO,CAACE,CAAAA;gBAClBD,QAAQC;YACZ;QACJ;IACJ;AACJ;AAEO,SAASC,UAAiGC,OAAiB,EAAEC,UAA+D,CAAC,CAAC;IACjM,MAAM,EACFC,eAAe,EAAE,EACjBC,UAAU,EAAE,EACZC,QAAQ,EACRP,OAAO,EACPQ,OAAO,EACV,GAAGJ;IAEJD,QAAQ,QAAQ,CAAC,QAAQ,CAACN;IAE1BY,QAAQ,UAAU,CAAC;QACfjB,oBAAoBA,CAA4Ba,cAAcF,SAAS;YAAEK;QAAQ;QACjFf,qBAAqBA,CAACa,SAASH,SAAS;YAAEK;QAAQ;KACrD,EAAE,IAAI,CAACT,CAAAA;QACJ,IAAII,QAAQ,YAAY,EAAE;YACtB,IAAI,CAACZ,UAAUA,CAACgB,WAAW;gBACvB,MAAM,IAAIG,MAAM;YACpB;YAEAH,SAASJ,SACJ,IAAI,CAAC;gBACFT,aAAaA;YACjB,GACC,KAAK,CAAC,CAACiB;gBACJR,QAAQ,MAAM,CACT,QAAQ,CAAC,iDACT,SAAS,CAACQ,OACV,KAAK;YACd;QACR;QAEA,IAAIX,SAAS;YACTF,4BAA4BC,OAAO,CAAC,EAAE,EAAEC;YACxCF,4BAA4BC,OAAO,CAAC,EAAE,EAAEC;QAC5C;IACJ;AACJ;AAEA,IAAIY,cAAc;AAEX,SAASC,kBAAuDT,UAAqE,CAAC,CAAC;IAC1I,MAAM,EACFU,IAAI,EACJC,MAAM,EACNC,OAAO,EACPC,OAAO,EACPC,8BAA8B,EAC9BlB,OAAO,EACV,GAAGI;IAEJ,IAAIQ,aAAa;QACb,MAAM,IAAIF,MAAM;IACpB;IAEAE,cAAc;IAEd,MAAMT,UAAU,IAAIR,cAAcA,CAAC;QAC/BmB;QACAC;QACAG;QACAF;QACAC;IACJ;IAEArB,mBAAmBA,CAACO,SACf,KAAK,CAAC,CAACQ;QACJ,IAAIX,SAAS;YACTA,QAAQW;QACZ;IACJ,GACC,OAAO,CAAC;QACLT,UAAUC,SAASC;IACvB;IAEJ,OAAOD;AACX;AAEO,SAASgB;IACZP,cAAc;AAClB"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@squide/firefly",
|
|
3
3
|
"author": "Workleap",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "15.0.1",
|
|
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": {
|
|
@@ -29,34 +29,35 @@
|
|
|
29
29
|
],
|
|
30
30
|
"peerDependencies": {
|
|
31
31
|
"@opentelemetry/api": "^1.9.0",
|
|
32
|
-
"@tanstack/react-query": "^5.
|
|
33
|
-
"msw": "^2.11.
|
|
32
|
+
"@tanstack/react-query": "^5.90.2",
|
|
33
|
+
"msw": "^2.11.3",
|
|
34
34
|
"react": "^18.0.0 || ^19.0.0",
|
|
35
35
|
"react-dom": "^18.0.0 || ^19.0.0",
|
|
36
|
-
"react-router": "^7.
|
|
36
|
+
"react-router": "^7.9.3"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
+
"@workleap-telemetry/core": "^1.0.1",
|
|
39
40
|
"@workleap/logging": "^1.3.0",
|
|
40
|
-
"uuid": "^
|
|
41
|
-
"@squide/core": "6.1.
|
|
42
|
-
"@squide/module-federation": "7.0.
|
|
43
|
-
"@squide/msw": "4.0.
|
|
44
|
-
"@squide/react-router": "8.1.
|
|
41
|
+
"uuid": "^13.0.0",
|
|
42
|
+
"@squide/core": "6.1.1",
|
|
43
|
+
"@squide/module-federation": "7.0.2",
|
|
44
|
+
"@squide/msw": "4.0.2",
|
|
45
|
+
"@squide/react-router": "8.1.1"
|
|
45
46
|
},
|
|
46
47
|
"devDependencies": {
|
|
47
|
-
"@rsbuild/core": "1.5.
|
|
48
|
-
"@rslib/core": "0.
|
|
48
|
+
"@rsbuild/core": "1.5.13",
|
|
49
|
+
"@rslib/core": "0.15.0",
|
|
49
50
|
"@testing-library/react": "16.3.0",
|
|
50
|
-
"@types/react": "19.
|
|
51
|
-
"@types/react-dom": "19.1
|
|
52
|
-
"@typescript-eslint/parser": "8.
|
|
53
|
-
"@vitejs/plugin-react": "5.0.
|
|
51
|
+
"@types/react": "19.2.2",
|
|
52
|
+
"@types/react-dom": "19.2.1",
|
|
53
|
+
"@typescript-eslint/parser": "8.46.0",
|
|
54
|
+
"@vitejs/plugin-react": "5.0.4",
|
|
54
55
|
"@workleap/eslint-plugin": "3.5.0",
|
|
55
56
|
"@workleap/rslib-configs": "1.1.0",
|
|
56
57
|
"@workleap/typescript-configs": "3.0.4",
|
|
57
58
|
"eslint": "8.57.0",
|
|
58
|
-
"happy-dom": "
|
|
59
|
-
"typescript": "5.9.
|
|
59
|
+
"happy-dom": "19.0.2",
|
|
60
|
+
"typescript": "5.9.3",
|
|
60
61
|
"vitest": "3.2.4"
|
|
61
62
|
},
|
|
62
63
|
"sideEffects": false,
|
package/src/FireflyRuntime.tsx
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { RegisterRouteOptions, RuntimeMethodOptions, RuntimeOptions } from "@squide/core";
|
|
2
2
|
import { MswPlugin, MswPluginName } from "@squide/msw";
|
|
3
3
|
import { type IReactRouterRuntime, ReactRouterRuntime, ReactRouterRuntimeScope, type Route } from "@squide/react-router";
|
|
4
|
+
import type { HoneycombInstrumentationPartialClient } from "@workleap-telemetry/core";
|
|
4
5
|
import type { Logger } from "@workleap/logging";
|
|
5
6
|
import type { RequestHandler } from "msw";
|
|
6
7
|
import { getAreModulesRegistered } from "./AppRouterReducer.ts";
|
|
@@ -8,6 +9,7 @@ import { type AppRouterStore, createAppRouterStore } from "./AppRouterStore.ts";
|
|
|
8
9
|
|
|
9
10
|
export interface FireflyRuntimeOptions extends RuntimeOptions {
|
|
10
11
|
useMsw?: boolean;
|
|
12
|
+
honeycombInstrumentationClient?: HoneycombInstrumentationPartialClient;
|
|
11
13
|
}
|
|
12
14
|
|
|
13
15
|
export interface RegisterRequestHandlersOptions extends RuntimeMethodOptions {}
|
|
@@ -17,13 +19,15 @@ export interface IFireflyRuntime extends IReactRouterRuntime {
|
|
|
17
19
|
get requestHandlers(): RequestHandler[];
|
|
18
20
|
get appRouterStore(): AppRouterStore;
|
|
19
21
|
get isMswEnabled(): boolean;
|
|
22
|
+
get honeycombInstrumentationClient(): HoneycombInstrumentationPartialClient | undefined;
|
|
20
23
|
}
|
|
21
24
|
|
|
22
25
|
export class FireflyRuntime extends ReactRouterRuntime implements IFireflyRuntime {
|
|
23
26
|
protected _appRouterStore: AppRouterStore;
|
|
24
27
|
protected _useMsw: boolean;
|
|
28
|
+
protected _honeycombInstrumentationClient: HoneycombInstrumentationPartialClient | undefined;
|
|
25
29
|
|
|
26
|
-
constructor({ plugins, useMsw, ...options }: FireflyRuntimeOptions = {}) {
|
|
30
|
+
constructor({ plugins, useMsw, honeycombInstrumentationClient, ...options }: FireflyRuntimeOptions = {}) {
|
|
27
31
|
if (useMsw) {
|
|
28
32
|
super({
|
|
29
33
|
plugins: [
|
|
@@ -44,6 +48,7 @@ export class FireflyRuntime extends ReactRouterRuntime implements IFireflyRuntim
|
|
|
44
48
|
}
|
|
45
49
|
|
|
46
50
|
this._appRouterStore = createAppRouterStore(this._logger);
|
|
51
|
+
this._honeycombInstrumentationClient = honeycombInstrumentationClient;
|
|
47
52
|
}
|
|
48
53
|
|
|
49
54
|
registerRequestHandlers(handlers: RequestHandler[], options: RegisterRequestHandlersOptions = {}) {
|
|
@@ -90,6 +95,10 @@ export class FireflyRuntime extends ReactRouterRuntime implements IFireflyRuntim
|
|
|
90
95
|
return this._useMsw;
|
|
91
96
|
}
|
|
92
97
|
|
|
98
|
+
get honeycombInstrumentationClient() {
|
|
99
|
+
return this._honeycombInstrumentationClient;
|
|
100
|
+
}
|
|
101
|
+
|
|
93
102
|
startScope(logger: Logger): FireflyRuntime {
|
|
94
103
|
return (new FireflyRuntimeScope(this, logger) as unknown) as FireflyRuntime;
|
|
95
104
|
}
|
|
@@ -114,4 +123,8 @@ export class FireflyRuntimeScope<TRuntime extends FireflyRuntime = FireflyRuntim
|
|
|
114
123
|
get isMswEnabled() {
|
|
115
124
|
return this._runtime.isMswEnabled;
|
|
116
125
|
}
|
|
126
|
+
|
|
127
|
+
get honeycombInstrumentationClient() {
|
|
128
|
+
return this._runtime.honeycombInstrumentationClient;
|
|
129
|
+
}
|
|
117
130
|
}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import type { FireflyRuntime } from "../FireflyRuntime.tsx";
|
|
2
|
-
import { canRegisterHoneycombInstrumentation } from "./canRegisterHoneycombInstrumentation.ts";
|
|
3
2
|
|
|
4
3
|
export async function initializeHoneycomb(runtime: FireflyRuntime) {
|
|
5
|
-
if (
|
|
4
|
+
if (runtime.honeycombInstrumentationClient) {
|
|
6
5
|
try {
|
|
7
6
|
// Dynamically import the Honeycomb instrumentation to prevent loading all the Honeycomb libraries
|
|
8
7
|
// if Honeycomb instrumentation is not registered by the hosting application.
|
|
@@ -10,12 +9,12 @@ export async function initializeHoneycomb(runtime: FireflyRuntime) {
|
|
|
10
9
|
|
|
11
10
|
mod.registerHoneycombInstrumentation(runtime);
|
|
12
11
|
} catch (error: unknown) {
|
|
13
|
-
runtime.logger.error("[squide] Failed to register Honeycomb instrumentation. The \"./registerHoneycombInstrumentation.ts\" cannot be imported.");
|
|
12
|
+
runtime.logger.error("[squide] Failed to register Honeycomb instrumentation. The \"./registerHoneycombInstrumentation.ts\" file cannot be imported.");
|
|
14
13
|
|
|
15
14
|
throw error;
|
|
16
15
|
}
|
|
17
16
|
} else {
|
|
18
|
-
runtime.logger.information("[squide] Cannot register Honeycomb instrumentation because the host application
|
|
17
|
+
runtime.logger.information("[squide] Cannot register Honeycomb instrumentation because the host application hasn't provided a client.");
|
|
19
18
|
}
|
|
20
19
|
}
|
|
21
20
|
|
|
@@ -630,38 +630,17 @@ function registerTrackingListeners(runtime: FireflyRuntime) {
|
|
|
630
630
|
});
|
|
631
631
|
}
|
|
632
632
|
|
|
633
|
-
function getRegisterFetchRequestHookFunction() {
|
|
634
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
635
|
-
// @ts-ignore
|
|
636
|
-
if (globalThis.__WLP_HONEYCOMB_REGISTER_DYNAMIC_FETCH_REQUEST_HOOK__) {
|
|
637
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
638
|
-
// @ts-ignore
|
|
639
|
-
return globalThis.__WLP_HONEYCOMB_REGISTER_DYNAMIC_FETCH_REQUEST_HOOK__;
|
|
640
|
-
}
|
|
641
|
-
|
|
642
|
-
// Fallback to fix an error. Will remove soon.
|
|
643
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
644
|
-
// @ts-ignore
|
|
645
|
-
return globalThis.__WLP_HONEYCOMB_REGISTER_DYNAMIC_FETCH_REQUEST_HOOK;
|
|
646
|
-
}
|
|
647
|
-
|
|
648
633
|
export function registerHoneycombInstrumentation(runtime: FireflyRuntime) {
|
|
649
634
|
try {
|
|
650
|
-
|
|
635
|
+
registerActiveSpanStack();
|
|
651
636
|
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
const activeSpanOverrideFunction = createOverrideFetchRequestSpanWithActiveSpanContext(runtime.logger);
|
|
656
|
-
|
|
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
|
-
}
|
|
637
|
+
// Dynamically registering this request hook function to nest the HTTP requests
|
|
638
|
+
// of squide bootstrapping under the appropriate Honeycomb span.
|
|
639
|
+
runtime.honeycombInstrumentationClient?.registerFetchRequestHook(createOverrideFetchRequestSpanWithActiveSpanContext(runtime.logger));
|
|
663
640
|
|
|
664
641
|
registerTrackingListeners(runtime);
|
|
642
|
+
|
|
643
|
+
runtime.logger.information("[squide] Honeycomb instrumentation is registered.");
|
|
665
644
|
} catch (error: unknown) {
|
|
666
645
|
runtime.logger
|
|
667
646
|
.withText("[squide] An error occurred while registering Honeycomb instrumentation:")
|
package/src/initializeFirefly.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { isFunction, registerLocalModules, type ModuleRegisterFunction, type RegisterModulesOptions } from "@squide/core";
|
|
2
2
|
import { registerRemoteModules, type RemoteDefinition } from "@squide/module-federation";
|
|
3
3
|
import { setMswAsReady } from "@squide/msw";
|
|
4
|
+
import type { HoneycombInstrumentationPartialClient } from "@workleap-telemetry/core";
|
|
4
5
|
import { FireflyRuntime, type FireflyRuntimeOptions } from "./FireflyRuntime.tsx";
|
|
5
6
|
import { initializeHoneycomb } from "./honeycomb/initializeHoneycomb.ts";
|
|
6
7
|
|
|
@@ -13,6 +14,7 @@ export type StartMswFunction<TRuntime = FireflyRuntime> = (runtime: TRuntime) =>
|
|
|
13
14
|
export interface InitializeFireflyOptions<TRuntime extends FireflyRuntime, TContext = unknown, TData = unknown> extends RegisterModulesOptions<TContext>, FireflyRuntimeOptions {
|
|
14
15
|
localModules?: ModuleRegisterFunction<TRuntime, TContext, TData>[];
|
|
15
16
|
remotes?: RemoteDefinition[];
|
|
17
|
+
honeycombInstrumentationClient?: HoneycombInstrumentationPartialClient;
|
|
16
18
|
startMsw?: StartMswFunction<FireflyRuntime>;
|
|
17
19
|
onError?: OnInitializationErrorFunction;
|
|
18
20
|
}
|
|
@@ -74,6 +76,7 @@ export function initializeFirefly<TContext = unknown, TData = unknown>(options:
|
|
|
74
76
|
useMsw,
|
|
75
77
|
loggers,
|
|
76
78
|
plugins,
|
|
79
|
+
honeycombInstrumentationClient,
|
|
77
80
|
onError
|
|
78
81
|
} = options;
|
|
79
82
|
|
|
@@ -86,6 +89,7 @@ export function initializeFirefly<TContext = unknown, TData = unknown>(options:
|
|
|
86
89
|
const runtime = new FireflyRuntime({
|
|
87
90
|
mode,
|
|
88
91
|
useMsw,
|
|
92
|
+
honeycombInstrumentationClient,
|
|
89
93
|
loggers,
|
|
90
94
|
plugins
|
|
91
95
|
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function canRegisterHoneycombInstrumentation(): boolean;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
;// CONCATENATED MODULE: ./src/honeycomb/canRegisterHoneycombInstrumentation.ts
|
|
3
|
-
function canRegisterHoneycombInstrumentation() {
|
|
4
|
-
// The second one is due to an error. Will be able to remove soon.
|
|
5
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
6
|
-
// @ts-ignore
|
|
7
|
-
return globalThis.__WLP_HONEYCOMB_INSTRUMENTATION_IS_REGISTERED__ === true || globalThis.__WLP_HONEYCOMB_INSTRUMENTATION_IS_REGISTERED === true;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export { canRegisterHoneycombInstrumentation };
|
|
11
|
-
|
|
12
|
-
//# sourceMappingURL=canRegisterHoneycombInstrumentation.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"honeycomb/canRegisterHoneycombInstrumentation.js","sources":["webpack://@squide/firefly/./src/honeycomb/canRegisterHoneycombInstrumentation.ts"],"sourcesContent":["export function canRegisterHoneycombInstrumentation() {\n // The second one is due to an error. Will be able to remove soon.\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n return globalThis.__WLP_HONEYCOMB_INSTRUMENTATION_IS_REGISTERED__ === true || globalThis.__WLP_HONEYCOMB_INSTRUMENTATION_IS_REGISTERED === true;\n}\n"],"names":["canRegisterHoneycombInstrumentation","globalThis"],"mappings":";;AAAO,SAASA;IACZ,kEAAkE;IAClE,6DAA6D;IAC7D,aAAa;IACb,OAAOC,WAAW,+CAA+C,KAAK,QAAQA,WAAW,6CAA6C,KAAK;AAC/I"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export function canRegisterHoneycombInstrumentation() {
|
|
2
|
-
// The second one is due to an error. Will be able to remove soon.
|
|
3
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
4
|
-
// @ts-ignore
|
|
5
|
-
return globalThis.__WLP_HONEYCOMB_INSTRUMENTATION_IS_REGISTERED__ === true || globalThis.__WLP_HONEYCOMB_INSTRUMENTATION_IS_REGISTERED === true;
|
|
6
|
-
}
|