@squide/firefly 13.0.1 → 13.0.3
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 +18 -0
- package/dist/AppRouter.js +17 -17
- package/dist/AppRouter.js.map +1 -1
- package/dist/AppRouterContext.js +8 -8
- package/dist/AppRouterContext.js.map +1 -1
- package/dist/AppRouterReducer.js +47 -47
- package/dist/AppRouterReducer.js.map +1 -1
- package/dist/FireflyProvider.js +3 -3
- package/dist/FireflyProvider.js.map +1 -1
- package/dist/FireflyRuntime.js +11 -11
- package/dist/FireflyRuntime.js.map +1 -1
- package/dist/RootRoute.js +10 -10
- package/dist/RootRoute.js.map +1 -1
- package/dist/honeycomb/activeSpan.js +6 -6
- package/dist/honeycomb/activeSpan.js.map +1 -1
- package/dist/honeycomb/initializeHoneycomb.js +2 -2
- package/dist/honeycomb/initializeHoneycomb.js.map +1 -1
- package/dist/honeycomb/registerHoneycombInstrumentation.d.ts +1 -1
- package/dist/honeycomb/registerHoneycombInstrumentation.js +97 -73
- package/dist/honeycomb/registerHoneycombInstrumentation.js.map +1 -1
- package/dist/honeycomb/tracer.js +2 -2
- package/dist/honeycomb/tracer.js.map +1 -1
- package/dist/honeycomb/utils.js +12 -12
- package/dist/honeycomb/utils.js.map +1 -1
- package/dist/initializeFirefly.js +11 -11
- package/dist/initializeFirefly.js.map +1 -1
- package/dist/useAppRouterStore.js +2 -2
- package/dist/useAppRouterStore.js.map +1 -1
- package/dist/useCanFetchProtectedData.js +2 -2
- package/dist/useCanFetchProtectedData.js.map +1 -1
- package/dist/useCanFetchPublicData.js +2 -2
- package/dist/useCanFetchPublicData.js.map +1 -1
- package/dist/useCanRegisterDeferredRegistrations.js +2 -2
- package/dist/useCanRegisterDeferredRegistrations.js.map +1 -1
- package/dist/useCanUpdateDeferredRegistrations.js +2 -2
- package/dist/useCanUpdateDeferredRegistrations.js.map +1 -1
- package/dist/useDeferredRegistrations.js +13 -13
- package/dist/useDeferredRegistrations.js.map +1 -1
- package/dist/useExecuteOnce.js +3 -3
- package/dist/useExecuteOnce.js.map +1 -1
- package/dist/useIsActiveRouteProtected.js +5 -5
- package/dist/useIsActiveRouteProtected.js.map +1 -1
- package/dist/useIsBootstrapping.js +2 -2
- package/dist/useIsBootstrapping.js.map +1 -1
- package/dist/useNavigationItems.js +4 -4
- package/dist/useNavigationItems.js.map +1 -1
- package/dist/useProtectedDataHandler.js +4 -4
- package/dist/useProtectedDataHandler.js.map +1 -1
- package/dist/useProtectedDataQueries.js +20 -20
- package/dist/useProtectedDataQueries.js.map +1 -1
- package/dist/usePublicDataHandler.js +4 -4
- package/dist/usePublicDataHandler.js.map +1 -1
- package/dist/usePublicDataQueries.js +19 -19
- package/dist/usePublicDataQueries.js.map +1 -1
- package/dist/useRegisterDeferredRegistrations.js +4 -4
- package/dist/useRegisterDeferredRegistrations.js.map +1 -1
- package/dist/useStrictRegistrationMode.js +12 -12
- package/dist/useStrictRegistrationMode.js.map +1 -1
- package/dist/useUpdateDeferredRegistrations.js +6 -6
- package/dist/useUpdateDeferredRegistrations.js.map +1 -1
- package/package.json +16 -16
- package/src/honeycomb/registerHoneycombInstrumentation.ts +35 -16
package/dist/RootRoute.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect } from "react";
|
|
3
|
+
import { Outlet } from "react-router";
|
|
4
|
+
import { useAppRouterDispatcher, useAppRouterState } from "./AppRouterContext.js";
|
|
5
|
+
import { useIsActiveRouteProtected } from "./useIsActiveRouteProtected.js";
|
|
6
6
|
|
|
7
7
|
;// CONCATENATED MODULE: external "react/jsx-runtime"
|
|
8
8
|
|
|
@@ -21,10 +21,10 @@ import * as __WEBPACK_EXTERNAL_MODULE__useIsActiveRouteProtected_js_d94f4832__ f
|
|
|
21
21
|
|
|
22
22
|
|
|
23
23
|
function RootRoute() {
|
|
24
|
-
const state =
|
|
25
|
-
const isActiveRouteProtected =
|
|
26
|
-
const dispatch =
|
|
27
|
-
|
|
24
|
+
const state = useAppRouterState();
|
|
25
|
+
const isActiveRouteProtected = useIsActiveRouteProtected(state.areModulesReady);
|
|
26
|
+
const dispatch = useAppRouterDispatcher();
|
|
27
|
+
useEffect(()=>{
|
|
28
28
|
// Dispatching the active route visibility must be done in a route because React Router's useLocation
|
|
29
29
|
// hook throws if it's not called from a child of the router component.
|
|
30
30
|
if (isActiveRouteProtected) {
|
|
@@ -40,7 +40,7 @@ function RootRoute() {
|
|
|
40
40
|
isActiveRouteProtected,
|
|
41
41
|
dispatch
|
|
42
42
|
]);
|
|
43
|
-
return /*#__PURE__*/
|
|
43
|
+
return /*#__PURE__*/ jsx(Outlet, {});
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
export { RootRoute };
|
package/dist/RootRoute.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RootRoute.js","sources":["webpack://@squide/firefly/./src/RootRoute.tsx"],"sourcesContent":["import { useEffect } from \"react\";\nimport { Outlet } from \"react-router\";\nimport { useAppRouterDispatcher, useAppRouterState } from \"./AppRouterContext.ts\";\nimport { useIsActiveRouteProtected } from \"./useIsActiveRouteProtected.ts\";\n\nexport function RootRoute() {\n const state = useAppRouterState();\n const isActiveRouteProtected = useIsActiveRouteProtected(state.areModulesReady);\n\n const dispatch = useAppRouterDispatcher();\n\n useEffect(() => {\n // Dispatching the active route visibility must be done in a route because React Router's useLocation\n // hook throws if it's not called from a child of the router component.\n if (isActiveRouteProtected) {\n dispatch({ type: \"active-route-is-protected\" });\n } else {\n dispatch({ type: \"active-route-is-public\" });\n }\n }, [isActiveRouteProtected, dispatch]);\n\n return (\n <Outlet />\n );\n}\n"],"names":["useEffect","Outlet","useAppRouterDispatcher","useAppRouterState","useIsActiveRouteProtected","RootRoute","state","isActiveRouteProtected","dispatch"],"mappings":";;;;;;;;;;;;;;;;;;AAAkC;AACI;AAC4C;AACP;AAEpE,SAASK;IACZ,MAAMC,QAAQH
|
|
1
|
+
{"version":3,"file":"RootRoute.js","sources":["webpack://@squide/firefly/./src/RootRoute.tsx"],"sourcesContent":["import { useEffect } from \"react\";\nimport { Outlet } from \"react-router\";\nimport { useAppRouterDispatcher, useAppRouterState } from \"./AppRouterContext.ts\";\nimport { useIsActiveRouteProtected } from \"./useIsActiveRouteProtected.ts\";\n\nexport function RootRoute() {\n const state = useAppRouterState();\n const isActiveRouteProtected = useIsActiveRouteProtected(state.areModulesReady);\n\n const dispatch = useAppRouterDispatcher();\n\n useEffect(() => {\n // Dispatching the active route visibility must be done in a route because React Router's useLocation\n // hook throws if it's not called from a child of the router component.\n if (isActiveRouteProtected) {\n dispatch({ type: \"active-route-is-protected\" });\n } else {\n dispatch({ type: \"active-route-is-public\" });\n }\n }, [isActiveRouteProtected, dispatch]);\n\n return (\n <Outlet />\n );\n}\n"],"names":["useEffect","Outlet","useAppRouterDispatcher","useAppRouterState","useIsActiveRouteProtected","RootRoute","state","isActiveRouteProtected","dispatch"],"mappings":";;;;;;;;;;;;;;;;;;AAAkC;AACI;AAC4C;AACP;AAEpE,SAASK;IACZ,MAAMC,QAAQH,iBAAiBA;IAC/B,MAAMI,yBAAyBH,yBAAyBA,CAACE,MAAM,eAAe;IAE9E,MAAME,WAAWN,sBAAsBA;IAEvCF,SAASA,CAAC;QACN,qGAAqG;QACrG,uEAAuE;QACvE,IAAIO,wBAAwB;YACxBC,SAAS;gBAAE,MAAM;YAA4B;QACjD,OAAO;YACHA,SAAS;gBAAE,MAAM;YAAyB;QAC9C;IACJ,GAAG;QAACD;QAAwBC;KAAS;IAErC,qBACI,IAACP,MAAMA;AAEf"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import { isPlainObject } from "@squide/core";
|
|
2
|
+
import { v4 } from "uuid";
|
|
3
|
+
import { createTraceContextId } from "./createTraceContextId.js";
|
|
4
4
|
|
|
5
5
|
;// CONCATENATED MODULE: external "@squide/core"
|
|
6
6
|
|
|
@@ -61,7 +61,7 @@ function getActiveSpan() {
|
|
|
61
61
|
}
|
|
62
62
|
function setActiveSpan(name, span) {
|
|
63
63
|
const activeSpan = {
|
|
64
|
-
id:
|
|
64
|
+
id: v4(),
|
|
65
65
|
name: name,
|
|
66
66
|
instance: span
|
|
67
67
|
};
|
|
@@ -87,10 +87,10 @@ function createOverrideFetchRequestSpanWithActiveSpanContext(logger) {
|
|
|
87
87
|
logger.debug("[squide] Found a Honeycomb active context to apply to the following fetch request: \r\n", "Request span context: ", requestSpanContext, "\r\n", "Active span context: ", activeSpanContext, "\r\n", "Request: ", request, "\r\n");
|
|
88
88
|
span.setAttribute("trace.trace_id", activeSpanContext.traceId);
|
|
89
89
|
span.setAttribute("trace.parent_id", activeSpanContext.spanId);
|
|
90
|
-
const traceParent =
|
|
90
|
+
const traceParent = createTraceContextId(activeSpanContext.traceId, requestSpanContext.spanId, requestSpanContext.traceFlags);
|
|
91
91
|
if (request instanceof Request) {
|
|
92
92
|
request.headers.set("traceparent", traceParent);
|
|
93
|
-
} else if (
|
|
93
|
+
} else if (isPlainObject(request.headers)) {
|
|
94
94
|
request.headers["traceparent"] = traceParent;
|
|
95
95
|
}
|
|
96
96
|
// Indicates to not propagate the requests to the subsequent hooks.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"honeycomb/activeSpan.js","sources":["webpack://@squide/firefly/./src/honeycomb/activeSpan.ts"],"sourcesContent":["import type { Span } from \"@opentelemetry/api\";\nimport { isPlainObject, type RuntimeLogger } from \"@squide/core\";\nimport { v4 as uuidv4 } from \"uuid\";\nimport { createTraceContextId } from \"./createTraceContextId.ts\";\n\nexport type ActiveSpanId = string;\n\nexport interface ActiveSpan {\n id: ActiveSpanId;\n name: string;\n instance: Span;\n}\n\n// Using a stack because we want a Last In First Out implementation for this.\n// https://github.com/open-telemetry/opentelemetry-js/issues/5084\n// https://github.com/open-telemetry/opentelemetry-js/issues/3558#issuecomment-1760680244\nclass ActiveSpanStack {\n readonly #stack: ActiveSpan[] = [];\n\n push(span: ActiveSpan) {\n this.#stack.push(span);\n }\n\n pop(span: ActiveSpan) {\n const head = this.#stack.pop();\n\n if (!head) {\n throw new Error(\"[squide] Unexpected pop, the active Honeycomb span stack is empty.\");\n }\n\n if (head.id !== span.id) {\n throw new Error(`[squide] The active Honeycomb span is not the expected span. Expected to pop span with name and id \"${span.name} / ${span.id}\" but found \"${head.name} / ${head.id}\". Did you forget to end an active span?`);\n }\n\n return head;\n }\n\n peek() {\n if (this.#stack.length === 0) {\n return undefined;\n }\n\n return this.#stack[this.#stack.length - 1];\n }\n}\n\nconst GlobalActiveSpanStackVariableName = \"__SQUIDE_HONEYCOMB_ACTIVE_SPAN_STACK__\";\n\nexport function registerActiveSpanStack() {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n if (globalThis[GlobalActiveSpanStackVariableName]) {\n throw new Error(`[squide] An ActiveSpanStack instance has already been registered to globalThis.${GlobalActiveSpanStackVariableName}. Did you register the Honeycomb instrumentation twice?`);\n }\n\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n globalThis[GlobalActiveSpanStackVariableName] = new ActiveSpanStack();\n}\n\nfunction getActiveSpanStack() {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n return globalThis[GlobalActiveSpanStackVariableName] as ActiveSpanStack;\n}\n\nfunction getActiveSpan() {\n const stack = getActiveSpanStack();\n\n if (stack) {\n return stack.peek();\n }\n}\n\nexport function setActiveSpan(name: string, span: Span) {\n const activeSpan: ActiveSpan = {\n id: uuidv4(),\n name: name,\n instance: span\n };\n\n const stack = getActiveSpanStack();\n\n if (stack) {\n stack.push(activeSpan);\n }\n\n return activeSpan;\n}\n\nexport function popActiveSpan(span: ActiveSpan) {\n const stack = getActiveSpanStack();\n\n if (stack) {\n stack.pop(span);\n }\n}\n\nexport function createOverrideFetchRequestSpanWithActiveSpanContext(logger: RuntimeLogger) {\n return (span: Span, request: Request | RequestInit) => {\n const activeSpan = getActiveSpan();\n\n if (activeSpan) {\n const activeSpanContext = activeSpan.instance.spanContext();\n const requestSpanContext = span.spanContext();\n\n if (activeSpanContext) {\n logger.debug(\n \"[squide] Found a Honeycomb active context to apply to the following fetch request: \\r\\n\",\n \"Request span context: \", requestSpanContext, \"\\r\\n\",\n \"Active span context: \", activeSpanContext, \"\\r\\n\",\n \"Request: \", request, \"\\r\\n\"\n );\n\n span.setAttribute(\"trace.trace_id\", activeSpanContext.traceId);\n span.setAttribute(\"trace.parent_id\", activeSpanContext.spanId);\n\n const traceParent = createTraceContextId(activeSpanContext.traceId, requestSpanContext.spanId, requestSpanContext.traceFlags);\n\n if (request instanceof Request) {\n request.headers.set(\"traceparent\", traceParent);\n } else if (isPlainObject(request.headers)) {\n request.headers[\"traceparent\"] = traceParent;\n }\n\n // Indicates to not propagate the requests to the subsequent hooks.\n return true;\n }\n }\n };\n}\n"],"names":["isPlainObject","v4","uuidv4","createTraceContextId","ActiveSpanStack","span","head","Error","undefined","GlobalActiveSpanStackVariableName","registerActiveSpanStack","globalThis","getActiveSpanStack","getActiveSpan","stack","setActiveSpan","name","activeSpan","popActiveSpan","createOverrideFetchRequestSpanWithActiveSpanContext","logger","request","activeSpanContext","requestSpanContext","traceParent","Request"],"mappings":";;;;;;;;;;;AACiE;AAC7B;AAC6B;AAUjE,6EAA6E;AAC7E,iEAAiE;AACjE,yFAAyF;AACzF,MAAMI;IACO,MAAM,GAAiB,EAAE,CAAC;IAEnC,KAAKC,IAAgB,EAAE;QACnB,IAAI,CAAC,MAAM,CAAC,IAAI,CAACA;IACrB;IAEA,IAAIA,IAAgB,EAAE;QAClB,MAAMC,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG;QAE5B,IAAI,CAACA,MAAM;YACP,MAAM,IAAIC,MAAM;QACpB;QAEA,IAAID,KAAK,EAAE,KAAKD,KAAK,EAAE,EAAE;YACrB,MAAM,IAAIE,MAAM,CAAC,oGAAoG,EAAEF,KAAK,IAAI,CAAC,GAAG,EAAEA,KAAK,EAAE,CAAC,aAAa,EAAEC,KAAK,IAAI,CAAC,GAAG,EAAEA,KAAK,EAAE,CAAC,wCAAwC,CAAC;QACjO;QAEA,OAAOA;IACX;IAEA,OAAO;QACH,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,KAAK,GAAG;YAC1B,OAAOE;QACX;QAEA,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,EAAE;IAC9C;AACJ;AAEA,MAAMC,oCAAoC;AAEnC,SAASC;IACZ,6DAA6D;IAC7D,aAAa;IACb,IAAIC,UAAU,CAACF,kCAAkC,EAAE;QAC/C,MAAM,IAAIF,MAAM,CAAC,+EAA+E,EAAEE,kCAAkC,uDAAuD,CAAC;IAChM;IAEA,6DAA6D;IAC7D,aAAa;IACbE,UAAU,CAACF,kCAAkC,GAAG,IAAIL;AACxD;AAEA,SAASQ;IACL,6DAA6D;IAC7D,aAAa;IACb,OAAOD,UAAU,CAACF,kCAAkC;AACxD;AAEA,SAASI;IACL,MAAMC,QAAQF;IAEd,IAAIE,OAAO;QACP,OAAOA,MAAM,IAAI;IACrB;AACJ;AAEO,SAASC,cAAcC,IAAY,EAAEX,IAAU;IAClD,MAAMY,aAAyB;QAC3B,IAAIf,
|
|
1
|
+
{"version":3,"file":"honeycomb/activeSpan.js","sources":["webpack://@squide/firefly/./src/honeycomb/activeSpan.ts"],"sourcesContent":["import type { Span } from \"@opentelemetry/api\";\nimport { isPlainObject, type RuntimeLogger } from \"@squide/core\";\nimport { v4 as uuidv4 } from \"uuid\";\nimport { createTraceContextId } from \"./createTraceContextId.ts\";\n\nexport type ActiveSpanId = string;\n\nexport interface ActiveSpan {\n id: ActiveSpanId;\n name: string;\n instance: Span;\n}\n\n// Using a stack because we want a Last In First Out implementation for this.\n// https://github.com/open-telemetry/opentelemetry-js/issues/5084\n// https://github.com/open-telemetry/opentelemetry-js/issues/3558#issuecomment-1760680244\nclass ActiveSpanStack {\n readonly #stack: ActiveSpan[] = [];\n\n push(span: ActiveSpan) {\n this.#stack.push(span);\n }\n\n pop(span: ActiveSpan) {\n const head = this.#stack.pop();\n\n if (!head) {\n throw new Error(\"[squide] Unexpected pop, the active Honeycomb span stack is empty.\");\n }\n\n if (head.id !== span.id) {\n throw new Error(`[squide] The active Honeycomb span is not the expected span. Expected to pop span with name and id \"${span.name} / ${span.id}\" but found \"${head.name} / ${head.id}\". Did you forget to end an active span?`);\n }\n\n return head;\n }\n\n peek() {\n if (this.#stack.length === 0) {\n return undefined;\n }\n\n return this.#stack[this.#stack.length - 1];\n }\n}\n\nconst GlobalActiveSpanStackVariableName = \"__SQUIDE_HONEYCOMB_ACTIVE_SPAN_STACK__\";\n\nexport function registerActiveSpanStack() {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n if (globalThis[GlobalActiveSpanStackVariableName]) {\n throw new Error(`[squide] An ActiveSpanStack instance has already been registered to globalThis.${GlobalActiveSpanStackVariableName}. Did you register the Honeycomb instrumentation twice?`);\n }\n\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n globalThis[GlobalActiveSpanStackVariableName] = new ActiveSpanStack();\n}\n\nfunction getActiveSpanStack() {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n return globalThis[GlobalActiveSpanStackVariableName] as ActiveSpanStack;\n}\n\nfunction getActiveSpan() {\n const stack = getActiveSpanStack();\n\n if (stack) {\n return stack.peek();\n }\n}\n\nexport function setActiveSpan(name: string, span: Span) {\n const activeSpan: ActiveSpan = {\n id: uuidv4(),\n name: name,\n instance: span\n };\n\n const stack = getActiveSpanStack();\n\n if (stack) {\n stack.push(activeSpan);\n }\n\n return activeSpan;\n}\n\nexport function popActiveSpan(span: ActiveSpan) {\n const stack = getActiveSpanStack();\n\n if (stack) {\n stack.pop(span);\n }\n}\n\nexport function createOverrideFetchRequestSpanWithActiveSpanContext(logger: RuntimeLogger) {\n return (span: Span, request: Request | RequestInit) => {\n const activeSpan = getActiveSpan();\n\n if (activeSpan) {\n const activeSpanContext = activeSpan.instance.spanContext();\n const requestSpanContext = span.spanContext();\n\n if (activeSpanContext) {\n logger.debug(\n \"[squide] Found a Honeycomb active context to apply to the following fetch request: \\r\\n\",\n \"Request span context: \", requestSpanContext, \"\\r\\n\",\n \"Active span context: \", activeSpanContext, \"\\r\\n\",\n \"Request: \", request, \"\\r\\n\"\n );\n\n span.setAttribute(\"trace.trace_id\", activeSpanContext.traceId);\n span.setAttribute(\"trace.parent_id\", activeSpanContext.spanId);\n\n const traceParent = createTraceContextId(activeSpanContext.traceId, requestSpanContext.spanId, requestSpanContext.traceFlags);\n\n if (request instanceof Request) {\n request.headers.set(\"traceparent\", traceParent);\n } else if (isPlainObject(request.headers)) {\n request.headers[\"traceparent\"] = traceParent;\n }\n\n // Indicates to not propagate the requests to the subsequent hooks.\n return true;\n }\n }\n };\n}\n"],"names":["isPlainObject","v4","uuidv4","createTraceContextId","ActiveSpanStack","span","head","Error","undefined","GlobalActiveSpanStackVariableName","registerActiveSpanStack","globalThis","getActiveSpanStack","getActiveSpan","stack","setActiveSpan","name","activeSpan","popActiveSpan","createOverrideFetchRequestSpanWithActiveSpanContext","logger","request","activeSpanContext","requestSpanContext","traceParent","Request"],"mappings":";;;;;;;;;;;AACiE;AAC7B;AAC6B;AAUjE,6EAA6E;AAC7E,iEAAiE;AACjE,yFAAyF;AACzF,MAAMI;IACO,MAAM,GAAiB,EAAE,CAAC;IAEnC,KAAKC,IAAgB,EAAE;QACnB,IAAI,CAAC,MAAM,CAAC,IAAI,CAACA;IACrB;IAEA,IAAIA,IAAgB,EAAE;QAClB,MAAMC,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG;QAE5B,IAAI,CAACA,MAAM;YACP,MAAM,IAAIC,MAAM;QACpB;QAEA,IAAID,KAAK,EAAE,KAAKD,KAAK,EAAE,EAAE;YACrB,MAAM,IAAIE,MAAM,CAAC,oGAAoG,EAAEF,KAAK,IAAI,CAAC,GAAG,EAAEA,KAAK,EAAE,CAAC,aAAa,EAAEC,KAAK,IAAI,CAAC,GAAG,EAAEA,KAAK,EAAE,CAAC,wCAAwC,CAAC;QACjO;QAEA,OAAOA;IACX;IAEA,OAAO;QACH,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,KAAK,GAAG;YAC1B,OAAOE;QACX;QAEA,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,EAAE;IAC9C;AACJ;AAEA,MAAMC,oCAAoC;AAEnC,SAASC;IACZ,6DAA6D;IAC7D,aAAa;IACb,IAAIC,UAAU,CAACF,kCAAkC,EAAE;QAC/C,MAAM,IAAIF,MAAM,CAAC,+EAA+E,EAAEE,kCAAkC,uDAAuD,CAAC;IAChM;IAEA,6DAA6D;IAC7D,aAAa;IACbE,UAAU,CAACF,kCAAkC,GAAG,IAAIL;AACxD;AAEA,SAASQ;IACL,6DAA6D;IAC7D,aAAa;IACb,OAAOD,UAAU,CAACF,kCAAkC;AACxD;AAEA,SAASI;IACL,MAAMC,QAAQF;IAEd,IAAIE,OAAO;QACP,OAAOA,MAAM,IAAI;IACrB;AACJ;AAEO,SAASC,cAAcC,IAAY,EAAEX,IAAU;IAClD,MAAMY,aAAyB;QAC3B,IAAIf,EAAMA;QACV,MAAMc;QACN,UAAUX;IACd;IAEA,MAAMS,QAAQF;IAEd,IAAIE,OAAO;QACPA,MAAM,IAAI,CAACG;IACf;IAEA,OAAOA;AACX;AAEO,SAASC,cAAcb,IAAgB;IAC1C,MAAMS,QAAQF;IAEd,IAAIE,OAAO;QACPA,MAAM,GAAG,CAACT;IACd;AACJ;AAEO,SAASc,oDAAoDC,MAAqB;IACrF,OAAO,CAACf,MAAYgB;QAChB,MAAMJ,aAAaJ;QAEnB,IAAII,YAAY;YACZ,MAAMK,oBAAoBL,WAAW,QAAQ,CAAC,WAAW;YACzD,MAAMM,qBAAqBlB,KAAK,WAAW;YAE3C,IAAIiB,mBAAmB;gBACnBF,OAAO,KAAK,CACR,2FACA,0BAA0BG,oBAAoB,QAC9C,yBAAyBD,mBAAmB,QAC5C,aAAaD,SAAS;gBAG1BhB,KAAK,YAAY,CAAC,kBAAkBiB,kBAAkB,OAAO;gBAC7DjB,KAAK,YAAY,CAAC,mBAAmBiB,kBAAkB,MAAM;gBAE7D,MAAME,cAAcrB,oBAAoBA,CAACmB,kBAAkB,OAAO,EAAEC,mBAAmB,MAAM,EAAEA,mBAAmB,UAAU;gBAE5H,IAAIF,mBAAmBI,SAAS;oBAC5BJ,QAAQ,OAAO,CAAC,GAAG,CAAC,eAAeG;gBACvC,OAAO,IAAIxB,aAAaA,CAACqB,QAAQ,OAAO,GAAG;oBACvCA,QAAQ,OAAO,CAAC,cAAc,GAAGG;gBACrC;gBAEA,mEAAmE;gBACnE,OAAO;YACX;QACJ;IACJ;AACJ"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { canRegisterHoneycombInstrumentation } from "./canRegisterHoneycombInstrumentation.js";
|
|
2
2
|
|
|
3
3
|
;// CONCATENATED MODULE: external "./canRegisterHoneycombInstrumentation.js"
|
|
4
4
|
|
|
5
5
|
;// CONCATENATED MODULE: ./src/honeycomb/initializeHoneycomb.ts
|
|
6
6
|
|
|
7
7
|
async function initializeHoneycomb(runtime) {
|
|
8
|
-
if (
|
|
8
|
+
if (canRegisterHoneycombInstrumentation()) {
|
|
9
9
|
try {
|
|
10
10
|
// Dynamically import the Honeycomb instrumentation to prevent loading all the Honeycomb libraries
|
|
11
11
|
// if Honeycomb instrumentation is not registered by the hosting application.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"honeycomb/initializeHoneycomb.js","sources":["webpack://@squide/firefly/./src/honeycomb/initializeHoneycomb.ts"],"sourcesContent":["import type { FireflyRuntime } from \"../FireflyRuntime.tsx\";\nimport { canRegisterHoneycombInstrumentation } from \"./canRegisterHoneycombInstrumentation.ts\";\n\nexport async function initializeHoneycomb(runtime: FireflyRuntime) {\n if (canRegisterHoneycombInstrumentation()) {\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\\\" cannot be imported.\");\n\n throw error;\n }\n } else {\n runtime.logger.debug(\"[squide] Cannot register Honeycomb instrumentation because the host application is not using the \\\"@workleap/honeycomb\\\" package.\");\n }\n}\n\n\n"],"names":["canRegisterHoneycombInstrumentation","initializeHoneycomb","runtime","mod","error"],"mappings":";;;;;AAC+F;AAExF,eAAeC,oBAAoBC,OAAuB;IAC7D,IAAIF,
|
|
1
|
+
{"version":3,"file":"honeycomb/initializeHoneycomb.js","sources":["webpack://@squide/firefly/./src/honeycomb/initializeHoneycomb.ts"],"sourcesContent":["import type { FireflyRuntime } from \"../FireflyRuntime.tsx\";\nimport { canRegisterHoneycombInstrumentation } from \"./canRegisterHoneycombInstrumentation.ts\";\n\nexport async function initializeHoneycomb(runtime: FireflyRuntime) {\n if (canRegisterHoneycombInstrumentation()) {\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\\\" cannot be imported.\");\n\n throw error;\n }\n } else {\n runtime.logger.debug(\"[squide] Cannot register Honeycomb instrumentation because the host application is not using the \\\"@workleap/honeycomb\\\" package.\");\n }\n}\n\n\n"],"names":["canRegisterHoneycombInstrumentation","initializeHoneycomb","runtime","mod","error"],"mappings":";;;;;AAC+F;AAExF,eAAeC,oBAAoBC,OAAuB;IAC7D,IAAIF,mCAAmCA,IAAI;QACvC,IAAI;YACA,kGAAkG;YAClG,6EAA6E;YAC7E,MAAMG,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,KAAK,CAAC;IACzB;AACJ"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { FireflyRuntime } from "../FireflyRuntime.tsx";
|
|
2
|
-
export declare function reduceDataFetchEvents(runtime: FireflyRuntime,
|
|
2
|
+
export declare function reduceDataFetchEvents(runtime: FireflyRuntime, onDataFetchStarted: () => void, onDataReady: () => void, onPublicDataFetchStarted: () => void, onPublicDataReady: () => void, onProtectedDataFetchStarted: () => void, onProtectedDataReady: () => void, onDataFetchFailed: (queriesErrors: Error[]) => void): void;
|
|
3
3
|
export declare function registerHoneycombInstrumentation(runtime: FireflyRuntime): void;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
1
|
+
import { LocalModuleDeferredRegistrationFailedEvent, LocalModuleDeferredRegistrationUpdateFailedEvent, LocalModuleRegistrationFailedEvent, LocalModulesDeferredRegistrationCompletedEvent, LocalModulesDeferredRegistrationStartedEvent, LocalModulesDeferredRegistrationsUpdateCompletedEvent, LocalModulesDeferredRegistrationsUpdateStartedEvent, LocalModulesRegistrationCompletedEvent, LocalModulesRegistrationStartedEvent } from "@squide/core";
|
|
2
|
+
import { DeferredRegistrationsUpdateCompletedEvent, DeferredRegistrationsUpdateStartedEvent, RemoteModuleDeferredRegistrationFailedEvent, RemoteModuleDeferredRegistrationUpdateFailedEvent, RemoteModuleRegistrationFailedEvent, RemoteModulesDeferredRegistrationCompletedEvent, RemoteModulesDeferredRegistrationStartedEvent, RemoteModulesDeferredRegistrationsUpdateCompletedEvent, RemoteModulesDeferredRegistrationsUpdateStartedEvent, RemoteModulesRegistrationCompletedEvent, RemoteModulesRegistrationStartedEvent } from "@squide/module-federation";
|
|
3
|
+
import { ApplicationBoostrappedEvent, ModulesReadyEvent, ModulesRegisteredEvent, MswReadyEvent, ProtectedDataReadyEvent, PublicDataReadyEvent } from "../AppRouterReducer.js";
|
|
4
|
+
import { ApplicationBootstrappingStartedEvent } from "../initializeFirefly.js";
|
|
5
|
+
import { ProtectedDataFetchFailedEvent, ProtectedDataFetchStartedEvent } from "../useProtectedDataQueries.js";
|
|
6
|
+
import { PublicDataFetchFailedEvent, PublicDataFetchStartedEvent } from "../usePublicDataQueries.js";
|
|
7
|
+
import { createOverrideFetchRequestSpanWithActiveSpanContext, registerActiveSpanStack } from "./activeSpan.js";
|
|
8
|
+
import { getTracer } from "./tracer.js";
|
|
9
|
+
import { endActiveSpan, startActiveChildSpan, startChildSpan, startSpan, traceError } from "./utils.js";
|
|
10
10
|
|
|
11
11
|
;// CONCATENATED MODULE: external "@squide/core"
|
|
12
12
|
|
|
@@ -36,18 +36,18 @@ import * as __WEBPACK_EXTERNAL_MODULE__utils_js_d88b7fe1__ from "./utils.js";
|
|
|
36
36
|
|
|
37
37
|
|
|
38
38
|
|
|
39
|
-
function reduceDataFetchEvents(runtime,
|
|
39
|
+
function reduceDataFetchEvents(runtime, onDataFetchStarted, onDataReady, onPublicDataFetchStarted, onPublicDataReady, onProtectedDataFetchStarted, onProtectedDataReady, onDataFetchFailed) {
|
|
40
40
|
let dataFetchState = "none";
|
|
41
|
-
|
|
42
|
-
runtime.eventBus.addListener(__WEBPACK_EXTERNAL_MODULE__usePublicDataQueries_js_1f22e760__.PublicDataFetchStartedEvent, ()=>{
|
|
41
|
+
runtime.eventBus.addListener(PublicDataFetchStartedEvent, ()=>{
|
|
43
42
|
if (dataFetchState === "none") {
|
|
44
43
|
dataFetchState = "fetching-data";
|
|
45
|
-
|
|
44
|
+
onDataFetchStarted();
|
|
46
45
|
}
|
|
47
46
|
onPublicDataFetchStarted();
|
|
47
|
+
}, {
|
|
48
|
+
once: true
|
|
48
49
|
});
|
|
49
|
-
|
|
50
|
-
runtime.eventBus.addListener(__WEBPACK_EXTERNAL_MODULE__AppRouterReducer_js_9236b353__.PublicDataReadyEvent, ()=>{
|
|
50
|
+
runtime.eventBus.addListener(PublicDataReadyEvent, ()=>{
|
|
51
51
|
onPublicDataReady();
|
|
52
52
|
if (dataFetchState === "fetching-data") {
|
|
53
53
|
dataFetchState = "public-data-ready";
|
|
@@ -55,17 +55,19 @@ function reduceDataFetchEvents(runtime, onDataFetchingStarted, onDataReady, onPu
|
|
|
55
55
|
dataFetchState = "data-ready";
|
|
56
56
|
onDataReady();
|
|
57
57
|
}
|
|
58
|
+
}, {
|
|
59
|
+
once: true
|
|
58
60
|
});
|
|
59
|
-
|
|
60
|
-
runtime.eventBus.addListener(__WEBPACK_EXTERNAL_MODULE__useProtectedDataQueries_js_5ede0a53__.ProtectedDataFetchStartedEvent, ()=>{
|
|
61
|
+
runtime.eventBus.addListener(ProtectedDataFetchStartedEvent, ()=>{
|
|
61
62
|
if (dataFetchState === "none") {
|
|
62
63
|
dataFetchState = "fetching-data";
|
|
63
|
-
|
|
64
|
+
onDataFetchStarted();
|
|
64
65
|
}
|
|
65
66
|
onProtectedDataFetchStarted();
|
|
67
|
+
}, {
|
|
68
|
+
once: true
|
|
66
69
|
});
|
|
67
|
-
|
|
68
|
-
runtime.eventBus.addListener(__WEBPACK_EXTERNAL_MODULE__AppRouterReducer_js_9236b353__.ProtectedDataReadyEvent, ()=>{
|
|
70
|
+
runtime.eventBus.addListener(ProtectedDataReadyEvent, ()=>{
|
|
69
71
|
onProtectedDataReady();
|
|
70
72
|
if (dataFetchState === "fetching-data") {
|
|
71
73
|
dataFetchState = "protected-data-ready";
|
|
@@ -73,6 +75,20 @@ function reduceDataFetchEvents(runtime, onDataFetchingStarted, onDataReady, onPu
|
|
|
73
75
|
dataFetchState = "data-ready";
|
|
74
76
|
onDataReady();
|
|
75
77
|
}
|
|
78
|
+
}, {
|
|
79
|
+
once: true
|
|
80
|
+
});
|
|
81
|
+
const handleDataFetchFailed = (payload)=>{
|
|
82
|
+
if (dataFetchState !== "data-fetch-failed") {
|
|
83
|
+
dataFetchState = "data-fetch-failed";
|
|
84
|
+
onDataFetchFailed(payload);
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
runtime.eventBus.addListener(PublicDataFetchFailedEvent, handleDataFetchFailed, {
|
|
88
|
+
once: true
|
|
89
|
+
});
|
|
90
|
+
runtime.eventBus.addListener(ProtectedDataFetchFailedEvent, handleDataFetchFailed, {
|
|
91
|
+
once: true
|
|
76
92
|
});
|
|
77
93
|
}
|
|
78
94
|
function registerTrackingListeners(runtime) {
|
|
@@ -85,34 +101,34 @@ function registerTrackingListeners(runtime) {
|
|
|
85
101
|
let deferredRegistrationsUpdateSpan;
|
|
86
102
|
let localModuleDeferredRegistrationsUpdateSpan;
|
|
87
103
|
let remoteModuleDeferredRegistrationsUpdateSpan;
|
|
88
|
-
runtime.eventBus.addListener(
|
|
89
|
-
bootstrappingSpan =
|
|
104
|
+
runtime.eventBus.addListener(ApplicationBootstrappingStartedEvent, ()=>{
|
|
105
|
+
bootstrappingSpan = startSpan((options, context)=>getTracer().startSpan("squide-bootstrapping", options, context));
|
|
90
106
|
}, {
|
|
91
107
|
once: true
|
|
92
108
|
});
|
|
93
|
-
runtime.eventBus.addListener(
|
|
109
|
+
runtime.eventBus.addListener(ApplicationBoostrappedEvent, ()=>{
|
|
94
110
|
if (bootstrappingSpan) {
|
|
95
111
|
bootstrappingSpan.end();
|
|
96
112
|
}
|
|
97
113
|
}, {
|
|
98
114
|
once: true
|
|
99
115
|
});
|
|
100
|
-
runtime.eventBus.addListener(
|
|
116
|
+
runtime.eventBus.addListener(MswReadyEvent, ()=>{
|
|
101
117
|
if (bootstrappingSpan) {
|
|
102
118
|
bootstrappingSpan.addEvent("msw-ready");
|
|
103
119
|
}
|
|
104
120
|
}, {
|
|
105
121
|
once: true
|
|
106
122
|
});
|
|
107
|
-
runtime.eventBus.addListener(
|
|
123
|
+
runtime.eventBus.addListener(LocalModulesRegistrationStartedEvent, (payload)=>{
|
|
108
124
|
const attributes = {
|
|
109
125
|
"app.squide.module_count": payload.moduleCount
|
|
110
126
|
};
|
|
111
127
|
if (bootstrappingSpan) {
|
|
112
128
|
bootstrappingSpan.addEvent("local-module-registration-started", attributes);
|
|
113
129
|
}
|
|
114
|
-
localModuleRegistrationSpan =
|
|
115
|
-
return
|
|
130
|
+
localModuleRegistrationSpan = startChildSpan(bootstrappingSpan, (options, context)=>{
|
|
131
|
+
return getTracer().startSpan("local-module-registration", {
|
|
116
132
|
...options,
|
|
117
133
|
attributes
|
|
118
134
|
}, context);
|
|
@@ -120,7 +136,7 @@ function registerTrackingListeners(runtime) {
|
|
|
120
136
|
}, {
|
|
121
137
|
once: true
|
|
122
138
|
});
|
|
123
|
-
runtime.eventBus.addListener(
|
|
139
|
+
runtime.eventBus.addListener(LocalModulesRegistrationCompletedEvent, (payload)=>{
|
|
124
140
|
if (bootstrappingSpan) {
|
|
125
141
|
bootstrappingSpan.addEvent("local-module-registration-completed", {
|
|
126
142
|
"app.squide.module_count": payload.moduleCount
|
|
@@ -133,21 +149,21 @@ function registerTrackingListeners(runtime) {
|
|
|
133
149
|
once: true
|
|
134
150
|
});
|
|
135
151
|
// Can occur multiple times.
|
|
136
|
-
runtime.eventBus.addListener(
|
|
152
|
+
runtime.eventBus.addListener(LocalModuleRegistrationFailedEvent, (payload)=>{
|
|
137
153
|
const registrationError = payload;
|
|
138
154
|
if (localModuleRegistrationSpan) {
|
|
139
|
-
|
|
155
|
+
traceError(localModuleRegistrationSpan, registrationError);
|
|
140
156
|
}
|
|
141
157
|
});
|
|
142
|
-
runtime.eventBus.addListener(
|
|
158
|
+
runtime.eventBus.addListener(LocalModulesDeferredRegistrationStartedEvent, (payload)=>{
|
|
143
159
|
const attributes = {
|
|
144
160
|
"app.squide.registration_count": payload.registrationCount
|
|
145
161
|
};
|
|
146
162
|
if (bootstrappingSpan) {
|
|
147
163
|
bootstrappingSpan.addEvent("local-module-deferred-registration-started", attributes);
|
|
148
164
|
}
|
|
149
|
-
localModuleDeferredRegistrationSpan =
|
|
150
|
-
return
|
|
165
|
+
localModuleDeferredRegistrationSpan = startChildSpan(bootstrappingSpan, (options, context)=>{
|
|
166
|
+
return getTracer().startSpan("local-module-deferred-registration", {
|
|
151
167
|
...options,
|
|
152
168
|
attributes
|
|
153
169
|
}, context);
|
|
@@ -155,7 +171,7 @@ function registerTrackingListeners(runtime) {
|
|
|
155
171
|
}, {
|
|
156
172
|
once: true
|
|
157
173
|
});
|
|
158
|
-
runtime.eventBus.addListener(
|
|
174
|
+
runtime.eventBus.addListener(LocalModulesDeferredRegistrationCompletedEvent, (payload)=>{
|
|
159
175
|
if (bootstrappingSpan) {
|
|
160
176
|
bootstrappingSpan.addEvent("local-module-deferred-registration-completed", {
|
|
161
177
|
"app.squide.registration_count": payload.registrationCount
|
|
@@ -168,21 +184,21 @@ function registerTrackingListeners(runtime) {
|
|
|
168
184
|
once: true
|
|
169
185
|
});
|
|
170
186
|
// Can occur multiple times.
|
|
171
|
-
runtime.eventBus.addListener(
|
|
187
|
+
runtime.eventBus.addListener(LocalModuleDeferredRegistrationFailedEvent, (payload)=>{
|
|
172
188
|
const registrationError = payload;
|
|
173
189
|
if (localModuleDeferredRegistrationSpan) {
|
|
174
|
-
|
|
190
|
+
traceError(localModuleRegistrationSpan, registrationError);
|
|
175
191
|
}
|
|
176
192
|
});
|
|
177
|
-
runtime.eventBus.addListener(
|
|
193
|
+
runtime.eventBus.addListener(RemoteModulesRegistrationStartedEvent, (payload)=>{
|
|
178
194
|
const attributes = {
|
|
179
195
|
"app.squide.remote_count": payload.remoteCount
|
|
180
196
|
};
|
|
181
197
|
if (bootstrappingSpan) {
|
|
182
198
|
bootstrappingSpan.addEvent("remote-module-registration-started", attributes);
|
|
183
199
|
}
|
|
184
|
-
remoteModuleRegistrationSpan =
|
|
185
|
-
return
|
|
200
|
+
remoteModuleRegistrationSpan = startChildSpan(bootstrappingSpan, (options, context)=>{
|
|
201
|
+
return getTracer().startSpan("remote-module-registration", {
|
|
186
202
|
...options,
|
|
187
203
|
attributes
|
|
188
204
|
}, context);
|
|
@@ -190,7 +206,7 @@ function registerTrackingListeners(runtime) {
|
|
|
190
206
|
}, {
|
|
191
207
|
once: true
|
|
192
208
|
});
|
|
193
|
-
runtime.eventBus.addListener(
|
|
209
|
+
runtime.eventBus.addListener(RemoteModulesRegistrationCompletedEvent, (payload)=>{
|
|
194
210
|
if (bootstrappingSpan) {
|
|
195
211
|
bootstrappingSpan.addEvent("remote-module-registration-completed", {
|
|
196
212
|
"app.squide.remote_count": payload.remoteCount
|
|
@@ -203,21 +219,21 @@ function registerTrackingListeners(runtime) {
|
|
|
203
219
|
once: true
|
|
204
220
|
});
|
|
205
221
|
// Can occur multiple times.
|
|
206
|
-
runtime.eventBus.addListener(
|
|
222
|
+
runtime.eventBus.addListener(RemoteModuleRegistrationFailedEvent, (payload)=>{
|
|
207
223
|
const registrationError = payload;
|
|
208
224
|
if (remoteModuleRegistrationSpan) {
|
|
209
|
-
|
|
225
|
+
traceError(remoteModuleRegistrationSpan, registrationError);
|
|
210
226
|
}
|
|
211
227
|
});
|
|
212
|
-
runtime.eventBus.addListener(
|
|
228
|
+
runtime.eventBus.addListener(RemoteModulesDeferredRegistrationStartedEvent, (payload)=>{
|
|
213
229
|
const attributes = {
|
|
214
230
|
"app.squide.registration_count": payload.registrationCount
|
|
215
231
|
};
|
|
216
232
|
if (bootstrappingSpan) {
|
|
217
233
|
bootstrappingSpan.addEvent("remote-module-deferred-registration-started", attributes);
|
|
218
234
|
}
|
|
219
|
-
remoteModuleDeferredRegistrationSpan =
|
|
220
|
-
return
|
|
235
|
+
remoteModuleDeferredRegistrationSpan = startChildSpan(bootstrappingSpan, (options, context)=>{
|
|
236
|
+
return getTracer().startSpan("remote-module-deferred-registration", {
|
|
221
237
|
...options,
|
|
222
238
|
attributes
|
|
223
239
|
}, context);
|
|
@@ -225,7 +241,7 @@ function registerTrackingListeners(runtime) {
|
|
|
225
241
|
}, {
|
|
226
242
|
once: true
|
|
227
243
|
});
|
|
228
|
-
runtime.eventBus.addListener(
|
|
244
|
+
runtime.eventBus.addListener(RemoteModulesDeferredRegistrationCompletedEvent, (payload)=>{
|
|
229
245
|
if (bootstrappingSpan) {
|
|
230
246
|
bootstrappingSpan.addEvent("remote-module-deferred-registration-completed", {
|
|
231
247
|
"app.squide.registration_count": payload.registrationCount
|
|
@@ -238,16 +254,16 @@ function registerTrackingListeners(runtime) {
|
|
|
238
254
|
once: true
|
|
239
255
|
});
|
|
240
256
|
// Can occur multiple times.
|
|
241
|
-
runtime.eventBus.addListener(
|
|
257
|
+
runtime.eventBus.addListener(RemoteModuleDeferredRegistrationFailedEvent, (payload)=>{
|
|
242
258
|
const registrationError = payload;
|
|
243
259
|
if (remoteModuleDeferredRegistrationSpan) {
|
|
244
|
-
|
|
260
|
+
traceError(remoteModuleDeferredRegistrationSpan, registrationError);
|
|
245
261
|
}
|
|
246
262
|
});
|
|
247
263
|
const handleFetchDataStarted = ()=>{
|
|
248
|
-
dataFetchSpan =
|
|
264
|
+
dataFetchSpan = startActiveChildSpan(bootstrappingSpan, (options, context)=>{
|
|
249
265
|
const name = "data-fetch";
|
|
250
|
-
const span =
|
|
266
|
+
const span = getTracer().startSpan(name, options, context);
|
|
251
267
|
return {
|
|
252
268
|
name,
|
|
253
269
|
span
|
|
@@ -256,7 +272,7 @@ function registerTrackingListeners(runtime) {
|
|
|
256
272
|
};
|
|
257
273
|
const handleDataReady = ()=>{
|
|
258
274
|
if (dataFetchSpan) {
|
|
259
|
-
|
|
275
|
+
endActiveSpan(dataFetchSpan);
|
|
260
276
|
}
|
|
261
277
|
};
|
|
262
278
|
const handlePublicDataFetchStarted = ()=>{
|
|
@@ -279,15 +295,23 @@ function registerTrackingListeners(runtime) {
|
|
|
279
295
|
dataFetchSpan.instance.addEvent("protected-data-ready");
|
|
280
296
|
}
|
|
281
297
|
};
|
|
282
|
-
|
|
283
|
-
|
|
298
|
+
const handleDataFetchFailed = (queriesErrors)=>{
|
|
299
|
+
if (dataFetchSpan) {
|
|
300
|
+
queriesErrors.forEach((x)=>{
|
|
301
|
+
traceError(dataFetchSpan.instance, x);
|
|
302
|
+
});
|
|
303
|
+
dataFetchSpan.instance.end();
|
|
304
|
+
}
|
|
305
|
+
};
|
|
306
|
+
reduceDataFetchEvents(runtime, handleFetchDataStarted, handleDataReady, handlePublicDataFetchStarted, handlePublicDataReady, handleProtectedDataFetchStarted, handleProtectedDataReady, handleDataFetchFailed);
|
|
307
|
+
runtime.eventBus.addListener(ModulesRegisteredEvent, ()=>{
|
|
284
308
|
if (bootstrappingSpan) {
|
|
285
309
|
bootstrappingSpan.addEvent("modules-registered");
|
|
286
310
|
}
|
|
287
311
|
}, {
|
|
288
312
|
once: true
|
|
289
313
|
});
|
|
290
|
-
runtime.eventBus.addListener(
|
|
314
|
+
runtime.eventBus.addListener(ModulesReadyEvent, ()=>{
|
|
291
315
|
if (bootstrappingSpan) {
|
|
292
316
|
bootstrappingSpan.addEvent("modules-ready");
|
|
293
317
|
}
|
|
@@ -295,26 +319,26 @@ function registerTrackingListeners(runtime) {
|
|
|
295
319
|
once: true
|
|
296
320
|
});
|
|
297
321
|
// Can occur multiple times.
|
|
298
|
-
runtime.eventBus.addListener(
|
|
299
|
-
deferredRegistrationsUpdateSpan =
|
|
322
|
+
runtime.eventBus.addListener(DeferredRegistrationsUpdateStartedEvent, ()=>{
|
|
323
|
+
deferredRegistrationsUpdateSpan = startSpan((options, context)=>getTracer().startSpan("squide-deferred-registrations-update", options, context));
|
|
300
324
|
});
|
|
301
325
|
// Can occur multiple times.
|
|
302
|
-
runtime.eventBus.addListener(
|
|
326
|
+
runtime.eventBus.addListener(DeferredRegistrationsUpdateCompletedEvent, ()=>{
|
|
303
327
|
if (deferredRegistrationsUpdateSpan) {
|
|
304
328
|
deferredRegistrationsUpdateSpan.end();
|
|
305
329
|
}
|
|
306
330
|
});
|
|
307
331
|
// Can occur multiple times.
|
|
308
|
-
runtime.eventBus.addListener(
|
|
332
|
+
runtime.eventBus.addListener(LocalModulesDeferredRegistrationsUpdateStartedEvent, (payload)=>{
|
|
309
333
|
const attributes = {
|
|
310
334
|
"app.squide.registration_count": payload.registrationCount
|
|
311
335
|
};
|
|
312
336
|
if (deferredRegistrationsUpdateSpan) {
|
|
313
337
|
deferredRegistrationsUpdateSpan.addEvent("local-module-deferred-registrations-update-started", attributes);
|
|
314
338
|
}
|
|
315
|
-
localModuleDeferredRegistrationsUpdateSpan =
|
|
339
|
+
localModuleDeferredRegistrationsUpdateSpan = startActiveChildSpan(deferredRegistrationsUpdateSpan, (options, context)=>{
|
|
316
340
|
const name = "local-module-deferred-registrations-update";
|
|
317
|
-
const span =
|
|
341
|
+
const span = getTracer().startSpan(name, {
|
|
318
342
|
attributes,
|
|
319
343
|
...options
|
|
320
344
|
}, context);
|
|
@@ -325,34 +349,34 @@ function registerTrackingListeners(runtime) {
|
|
|
325
349
|
});
|
|
326
350
|
});
|
|
327
351
|
// Can occur multiple times.
|
|
328
|
-
runtime.eventBus.addListener(
|
|
352
|
+
runtime.eventBus.addListener(LocalModulesDeferredRegistrationsUpdateCompletedEvent, (payload)=>{
|
|
329
353
|
if (deferredRegistrationsUpdateSpan) {
|
|
330
354
|
deferredRegistrationsUpdateSpan.addEvent("local-module-deferred-registrations-update-completed", {
|
|
331
355
|
"app.squide.registration_count": payload.registrationCount
|
|
332
356
|
});
|
|
333
357
|
}
|
|
334
358
|
if (localModuleDeferredRegistrationsUpdateSpan) {
|
|
335
|
-
|
|
359
|
+
endActiveSpan(localModuleDeferredRegistrationsUpdateSpan);
|
|
336
360
|
}
|
|
337
361
|
});
|
|
338
362
|
// Can occur multiple times.
|
|
339
|
-
runtime.eventBus.addListener(
|
|
363
|
+
runtime.eventBus.addListener(LocalModuleDeferredRegistrationUpdateFailedEvent, (payload)=>{
|
|
340
364
|
const registrationError = payload;
|
|
341
365
|
if (localModuleDeferredRegistrationsUpdateSpan) {
|
|
342
|
-
|
|
366
|
+
traceError(localModuleDeferredRegistrationsUpdateSpan.instance, registrationError);
|
|
343
367
|
}
|
|
344
368
|
});
|
|
345
369
|
// Can occur multiple times.
|
|
346
|
-
runtime.eventBus.addListener(
|
|
370
|
+
runtime.eventBus.addListener(RemoteModulesDeferredRegistrationsUpdateStartedEvent, (payload)=>{
|
|
347
371
|
const attributes = {
|
|
348
372
|
"app.squide.registration_count": payload.registrationCount
|
|
349
373
|
};
|
|
350
374
|
if (deferredRegistrationsUpdateSpan) {
|
|
351
375
|
deferredRegistrationsUpdateSpan.addEvent("remote-module-deferred-registrations-update-started", attributes);
|
|
352
376
|
}
|
|
353
|
-
remoteModuleDeferredRegistrationsUpdateSpan =
|
|
377
|
+
remoteModuleDeferredRegistrationsUpdateSpan = startActiveChildSpan(deferredRegistrationsUpdateSpan, (options, context)=>{
|
|
354
378
|
const name = "remote-module-deferred-registrations-update";
|
|
355
|
-
const span =
|
|
379
|
+
const span = getTracer().startSpan(name, {
|
|
356
380
|
attributes,
|
|
357
381
|
...options
|
|
358
382
|
}, context);
|
|
@@ -363,21 +387,21 @@ function registerTrackingListeners(runtime) {
|
|
|
363
387
|
});
|
|
364
388
|
});
|
|
365
389
|
// Can occur multiple times.
|
|
366
|
-
runtime.eventBus.addListener(
|
|
390
|
+
runtime.eventBus.addListener(RemoteModulesDeferredRegistrationsUpdateCompletedEvent, (payload)=>{
|
|
367
391
|
if (deferredRegistrationsUpdateSpan) {
|
|
368
392
|
deferredRegistrationsUpdateSpan.addEvent("remote-module-deferred-registrations-update-completed", {
|
|
369
393
|
"app.squide.registration_count": payload.registrationCount
|
|
370
394
|
});
|
|
371
395
|
}
|
|
372
396
|
if (remoteModuleDeferredRegistrationsUpdateSpan) {
|
|
373
|
-
|
|
397
|
+
endActiveSpan(remoteModuleDeferredRegistrationsUpdateSpan);
|
|
374
398
|
}
|
|
375
399
|
});
|
|
376
400
|
// Can occur multiple times.
|
|
377
|
-
runtime.eventBus.addListener(
|
|
401
|
+
runtime.eventBus.addListener(RemoteModuleDeferredRegistrationUpdateFailedEvent, (payload)=>{
|
|
378
402
|
const registrationError = payload;
|
|
379
403
|
if (remoteModuleDeferredRegistrationsUpdateSpan) {
|
|
380
|
-
|
|
404
|
+
traceError(remoteModuleDeferredRegistrationsUpdateSpan.instance, registrationError);
|
|
381
405
|
}
|
|
382
406
|
});
|
|
383
407
|
}
|
|
@@ -389,8 +413,8 @@ function getRegisterFetchRequestHookFunction() {
|
|
|
389
413
|
function registerHoneycombInstrumentation(runtime) {
|
|
390
414
|
const registerFetchRequestHookFunction = getRegisterFetchRequestHookFunction();
|
|
391
415
|
if (registerFetchRequestHookFunction) {
|
|
392
|
-
|
|
393
|
-
const activeSpanOverrideFunction =
|
|
416
|
+
registerActiveSpanStack();
|
|
417
|
+
const activeSpanOverrideFunction = createOverrideFetchRequestSpanWithActiveSpanContext(runtime.logger);
|
|
394
418
|
// Dynamically registering this request hook function to nest the HTTP requests
|
|
395
419
|
// of squide bootstrapping under the appropriate Honeycomb span.
|
|
396
420
|
registerFetchRequestHookFunction(activeSpanOverrideFunction);
|