@squide/firefly 12.0.4 → 13.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +51 -0
- package/dist/honeycomb/activeSpan.d.ts +12 -0
- package/dist/honeycomb/activeSpan.js +105 -0
- package/dist/honeycomb/activeSpan.js.map +1 -0
- package/dist/honeycomb/createTraceContextId.d.ts +1 -0
- package/dist/honeycomb/createTraceContextId.js +16 -0
- package/dist/honeycomb/createTraceContextId.js.map +1 -0
- package/dist/honeycomb/registerHoneycombInstrumentation.d.ts +4 -0
- package/dist/honeycomb/registerHoneycombInstrumentation.js +430 -0
- package/dist/honeycomb/registerHoneycombInstrumentation.js.map +1 -0
- package/dist/honeycomb/tracer.d.ts +1 -0
- package/dist/honeycomb/tracer.js +14 -0
- package/dist/honeycomb/tracer.js.map +1 -0
- package/dist/honeycomb/utils.d.ts +23 -0
- package/dist/honeycomb/utils.js +49 -0
- package/dist/honeycomb/utils.js.map +1 -0
- package/dist/initializeFirefly.js +9 -0
- package/dist/initializeFirefly.js.map +1 -1
- package/package.json +10 -3
- package/src/honeycomb/activeSpan.ts +131 -0
- package/src/honeycomb/createTraceContextId.ts +12 -0
- package/src/honeycomb/registerHoneycombInstrumentation.ts +504 -0
- package/src/honeycomb/tracer.ts +6 -0
- package/src/honeycomb/utils.ts +64 -0
- package/src/initializeFirefly.ts +7 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,56 @@
|
|
|
1
1
|
# @squide/firefly
|
|
2
2
|
|
|
3
|
+
## 13.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- [#276](https://github.com/workleap/wl-squide/pull/276) [`e46df52`](https://github.com/workleap/wl-squide/commit/e46df52956a32e2487cf113bdc383033aac7a023) Thanks [@patricklafrance](https://github.com/patricklafrance)! - Deprecated `@squide/firefly-honeycomb` and moved honeycomb features directly into `@squide/firefly`. Honeycomb instrumentation is now automatically registered when Squide detected that the host application has register Honeycomb instrumentation using the `@workleap/honeycomb` package.
|
|
8
|
+
|
|
9
|
+
Before:
|
|
10
|
+
|
|
11
|
+
```ts
|
|
12
|
+
import { ConsoleLogger, initializeFirefly } from "@squide/firefly";
|
|
13
|
+
import { registerHoneycombInstrumentation } from "@squide/firefly-honeycomb";
|
|
14
|
+
import { register as registerMyLocalModule } from "@sample/local-module";
|
|
15
|
+
import { registerHost } from "./register.tsx";
|
|
16
|
+
|
|
17
|
+
const runtime = initializeFirefly({
|
|
18
|
+
localModules: [registerHost, registerMyLocalModule],
|
|
19
|
+
remotes: Remotes,
|
|
20
|
+
loggers: [(x) => new ConsoleLogger(x)],
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
registerHoneycombInstrumentation(
|
|
24
|
+
runtime,
|
|
25
|
+
"sample",
|
|
26
|
+
"squide-sample",
|
|
27
|
+
[/.+/g],
|
|
28
|
+
{
|
|
29
|
+
proxy: "https://my-proxy.com",
|
|
30
|
+
}
|
|
31
|
+
);
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
After:
|
|
35
|
+
|
|
36
|
+
```ts
|
|
37
|
+
import { ConsoleLogger, initializeFirefly } from "@squide/firefly";
|
|
38
|
+
import { registerHoneycombInstrumentation } from "@workleap/honeycomb";
|
|
39
|
+
import { register as registerMyLocalModule } from "@sample/local-module";
|
|
40
|
+
import { registerHost } from "./register.tsx";
|
|
41
|
+
|
|
42
|
+
// Register Honeycomb instrumentation BEFORE initializing Squide.
|
|
43
|
+
registerHoneycombInstrumentation("sample", "squide-sample", [/.+/g], {
|
|
44
|
+
proxy: "https://my-proxy.com",
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
const runtime = initializeFirefly({
|
|
48
|
+
localModules: [registerHost, registerMyLocalModule],
|
|
49
|
+
remotes: Remotes,
|
|
50
|
+
loggers: [(x) => new ConsoleLogger(x)],
|
|
51
|
+
});
|
|
52
|
+
```
|
|
53
|
+
|
|
3
54
|
## 12.0.4
|
|
4
55
|
|
|
5
56
|
### Patch Changes
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Span } from "@opentelemetry/api";
|
|
2
|
+
import { type RuntimeLogger } from "@squide/core";
|
|
3
|
+
export type ActiveSpanId = string;
|
|
4
|
+
export interface ActiveSpan {
|
|
5
|
+
id: ActiveSpanId;
|
|
6
|
+
name: string;
|
|
7
|
+
instance: Span;
|
|
8
|
+
}
|
|
9
|
+
export declare function registerActiveSpanStack(): void;
|
|
10
|
+
export declare function setActiveSpan(name: string, span: Span): ActiveSpan;
|
|
11
|
+
export declare function popActiveSpan(span: ActiveSpan): void;
|
|
12
|
+
export declare function createOverrideFetchRequestSpanWithActiveSpanContext(logger: RuntimeLogger): (span: Span, request: Request | RequestInit) => true | undefined;
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import * as __WEBPACK_EXTERNAL_MODULE__squide_core_7a405b8f__ from "@squide/core";
|
|
2
|
+
import * as __WEBPACK_EXTERNAL_MODULE_uuid__ from "uuid";
|
|
3
|
+
import * as __WEBPACK_EXTERNAL_MODULE__createTraceContextId_js_cda49537__ from "./createTraceContextId.js";
|
|
4
|
+
|
|
5
|
+
;// CONCATENATED MODULE: external "@squide/core"
|
|
6
|
+
|
|
7
|
+
;// CONCATENATED MODULE: external "uuid"
|
|
8
|
+
|
|
9
|
+
;// CONCATENATED MODULE: external "./createTraceContextId.js"
|
|
10
|
+
|
|
11
|
+
;// CONCATENATED MODULE: ./src/honeycomb/activeSpan.ts
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
// Using a stack because we want a Last In First Out implementation for this.
|
|
16
|
+
// https://github.com/open-telemetry/opentelemetry-js/issues/5084
|
|
17
|
+
// https://github.com/open-telemetry/opentelemetry-js/issues/3558#issuecomment-1760680244
|
|
18
|
+
class ActiveSpanStack {
|
|
19
|
+
#stack = [];
|
|
20
|
+
push(span) {
|
|
21
|
+
this.#stack.push(span);
|
|
22
|
+
}
|
|
23
|
+
pop(span) {
|
|
24
|
+
const head = this.#stack.pop();
|
|
25
|
+
if (!head) {
|
|
26
|
+
throw new Error("[squide] Unexpected pop, the active Honeycomb span stack is empty.");
|
|
27
|
+
}
|
|
28
|
+
if (head.id !== span.id) {
|
|
29
|
+
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?`);
|
|
30
|
+
}
|
|
31
|
+
return head;
|
|
32
|
+
}
|
|
33
|
+
peek() {
|
|
34
|
+
if (this.#stack.length === 0) {
|
|
35
|
+
return undefined;
|
|
36
|
+
}
|
|
37
|
+
return this.#stack[this.#stack.length - 1];
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
const GlobalActiveSpanStackVariableName = "__SQUIDE_HONEYCOMB_ACTIVE_SPAN_STACK__";
|
|
41
|
+
function registerActiveSpanStack() {
|
|
42
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
43
|
+
// @ts-ignore
|
|
44
|
+
if (globalThis[GlobalActiveSpanStackVariableName]) {
|
|
45
|
+
throw new Error(`[squide] An ActiveSpanStack instance has already been registered to globalThis.${GlobalActiveSpanStackVariableName}. Did you register the Honeycomb instrumentation twice?`);
|
|
46
|
+
}
|
|
47
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
48
|
+
// @ts-ignore
|
|
49
|
+
globalThis[GlobalActiveSpanStackVariableName] = new ActiveSpanStack();
|
|
50
|
+
}
|
|
51
|
+
function getActiveSpanStack() {
|
|
52
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
53
|
+
// @ts-ignore
|
|
54
|
+
return globalThis[GlobalActiveSpanStackVariableName];
|
|
55
|
+
}
|
|
56
|
+
function getActiveSpan() {
|
|
57
|
+
const stack = getActiveSpanStack();
|
|
58
|
+
if (stack) {
|
|
59
|
+
return stack.peek();
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
function setActiveSpan(name, span) {
|
|
63
|
+
const activeSpan = {
|
|
64
|
+
id: (0,__WEBPACK_EXTERNAL_MODULE_uuid__.v4)(),
|
|
65
|
+
name: name,
|
|
66
|
+
instance: span
|
|
67
|
+
};
|
|
68
|
+
const stack = getActiveSpanStack();
|
|
69
|
+
if (stack) {
|
|
70
|
+
stack.push(activeSpan);
|
|
71
|
+
}
|
|
72
|
+
return activeSpan;
|
|
73
|
+
}
|
|
74
|
+
function popActiveSpan(span) {
|
|
75
|
+
const stack = getActiveSpanStack();
|
|
76
|
+
if (stack) {
|
|
77
|
+
stack.pop(span);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
function createOverrideFetchRequestSpanWithActiveSpanContext(logger) {
|
|
81
|
+
return (span, request)=>{
|
|
82
|
+
const activeSpan = getActiveSpan();
|
|
83
|
+
if (activeSpan) {
|
|
84
|
+
const activeSpanContext = activeSpan.instance.spanContext();
|
|
85
|
+
const requestSpanContext = span.spanContext();
|
|
86
|
+
if (activeSpanContext) {
|
|
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
|
+
span.setAttribute("trace.trace_id", activeSpanContext.traceId);
|
|
89
|
+
span.setAttribute("trace.parent_id", activeSpanContext.spanId);
|
|
90
|
+
const traceParent = (0,__WEBPACK_EXTERNAL_MODULE__createTraceContextId_js_cda49537__.createTraceContextId)(activeSpanContext.traceId, requestSpanContext.spanId, requestSpanContext.traceFlags);
|
|
91
|
+
if (request instanceof Request) {
|
|
92
|
+
request.headers.set("traceparent", traceParent);
|
|
93
|
+
} else if ((0,__WEBPACK_EXTERNAL_MODULE__squide_core_7a405b8f__.isPlainObject)(request.headers)) {
|
|
94
|
+
request.headers["traceparent"] = traceParent;
|
|
95
|
+
}
|
|
96
|
+
// Indicates to not propagate the requests to the subsequent hooks.
|
|
97
|
+
return true;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export { createOverrideFetchRequestSpanWithActiveSpanContext, popActiveSpan, registerActiveSpanStack, setActiveSpan };
|
|
104
|
+
|
|
105
|
+
//# sourceMappingURL=activeSpan.js.map
|
|
@@ -0,0 +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,uCAAMA;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,sFAAoBA,CAACmB,kBAAkB,OAAO,EAAEC,mBAAmB,MAAM,EAAEA,mBAAmB,UAAU;gBAE5H,IAAIF,mBAAmBI,SAAS;oBAC5BJ,QAAQ,OAAO,CAAC,GAAG,CAAC,eAAeG;gBACvC,OAAO,IAAIxB,mEAAaA,CAACqB,QAAQ,OAAO,GAAG;oBACvCA,QAAQ,OAAO,CAAC,cAAc,GAAGG;gBACrC;gBAEA,mEAAmE;gBACnE,OAAO;YACX;QACJ;IACJ;AACJ"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function createTraceContextId(traceId: string, spanId: string, traceFlags: number): string;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
|
|
2
|
+
;// CONCATENATED MODULE: ./src/honeycomb/createTraceContextId.ts
|
|
3
|
+
// Creates the trace context id based on the following opentelemetry-js implementation: https://github.com/open-telemetry/opentelemetry-js/blob/main/packages/opentelemetry-core/src/trace/W3CTraceContextPropagator.ts
|
|
4
|
+
const VERSION = "00";
|
|
5
|
+
var createTraceContextId_TraceFlags = /*#__PURE__*/ (/* unused pure expression or super */ null && (function(TraceFlags) {
|
|
6
|
+
TraceFlags[TraceFlags["NONE"] = 0] = "NONE";
|
|
7
|
+
TraceFlags[TraceFlags["SAMPLED"] = 1] = "SAMPLED";
|
|
8
|
+
return TraceFlags;
|
|
9
|
+
}(createTraceContextId_TraceFlags || {})));
|
|
10
|
+
function createTraceContextId(traceId, spanId, traceFlags) {
|
|
11
|
+
return `${VERSION}-${traceId}-${spanId}-0${Number(traceFlags || 0).toString(16)}`;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export { createTraceContextId };
|
|
15
|
+
|
|
16
|
+
//# sourceMappingURL=createTraceContextId.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"honeycomb/createTraceContextId.js","sources":["webpack://@squide/firefly/./src/honeycomb/createTraceContextId.ts"],"sourcesContent":["// Creates the trace context id based on the following opentelemetry-js implementation: https://github.com/open-telemetry/opentelemetry-js/blob/main/packages/opentelemetry-core/src/trace/W3CTraceContextPropagator.ts\n\nconst VERSION = \"00\";\n\nenum TraceFlags {\n NONE = 0x0,\n SAMPLED = 0x1 << 0\n}\n\nexport function createTraceContextId(traceId: string, spanId: string, traceFlags: number) {\n return `${VERSION}-${traceId}-${spanId}-0${Number(traceFlags || TraceFlags.NONE).toString(16)}`;\n}\n"],"names":["VERSION","TraceFlags","createTraceContextId","traceId","spanId","traceFlags","Number"],"mappings":";;AAAA,uNAAuN;AAEvN,MAAMA,UAAU;AAEhB,IAAKC,+BAAUA,iBAAVA,gDAAAA,SAAAA;;;WAAAA;EAAAA,+BAAUA,OAAVA,EAAAA;AAKE,SAASC,qBAAqBC,OAAe,EAAEC,MAAc,EAAEC,UAAkB;IACpF,OAAO,GAAGL,QAAQ,CAAC,EAAEG,QAAQ,CAAC,EAAEC,OAAO,EAAE,EAAEE,OAAOD,iBAA+B,QAAQ,CAAC,KAAK;AACnG"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { FireflyRuntime } from "../FireflyRuntime.tsx";
|
|
2
|
+
export declare function reduceDataFetchEvents(runtime: FireflyRuntime, onDataFetchingStarted: () => void, onDataReady: () => void, onPublicDataFetchStarted: () => void, onPublicDataReady: () => void, onProtectedDataFetchStarted: () => void, onProtectedDataReady: () => void): void;
|
|
3
|
+
export declare function registerHoneycombInstrumentation(runtime: FireflyRuntime): void;
|
|
4
|
+
export declare function canRegisterHoneycombInstrumentation(): boolean;
|
|
@@ -0,0 +1,430 @@
|
|
|
1
|
+
import * as __WEBPACK_EXTERNAL_MODULE__squide_core_7a405b8f__ from "@squide/core";
|
|
2
|
+
import * as __WEBPACK_EXTERNAL_MODULE__squide_module_federation_054d2ec6__ from "@squide/module-federation";
|
|
3
|
+
import * as __WEBPACK_EXTERNAL_MODULE__AppRouterReducer_js_9236b353__ from "../AppRouterReducer.js";
|
|
4
|
+
import * as __WEBPACK_EXTERNAL_MODULE__initializeFirefly_js_30865401__ from "../initializeFirefly.js";
|
|
5
|
+
import * as __WEBPACK_EXTERNAL_MODULE__useProtectedDataQueries_js_5ede0a53__ from "../useProtectedDataQueries.js";
|
|
6
|
+
import * as __WEBPACK_EXTERNAL_MODULE__usePublicDataQueries_js_1f22e760__ from "../usePublicDataQueries.js";
|
|
7
|
+
import * as __WEBPACK_EXTERNAL_MODULE__activeSpan_js_fe031e6b__ from "./activeSpan.js";
|
|
8
|
+
import * as __WEBPACK_EXTERNAL_MODULE__tracer_js_f37593cd__ from "./tracer.js";
|
|
9
|
+
import * as __WEBPACK_EXTERNAL_MODULE__utils_js_d88b7fe1__ from "./utils.js";
|
|
10
|
+
|
|
11
|
+
;// CONCATENATED MODULE: external "@squide/core"
|
|
12
|
+
|
|
13
|
+
;// CONCATENATED MODULE: external "@squide/module-federation"
|
|
14
|
+
|
|
15
|
+
;// CONCATENATED MODULE: external "../AppRouterReducer.js"
|
|
16
|
+
|
|
17
|
+
;// CONCATENATED MODULE: external "../initializeFirefly.js"
|
|
18
|
+
|
|
19
|
+
;// CONCATENATED MODULE: external "../useProtectedDataQueries.js"
|
|
20
|
+
|
|
21
|
+
;// CONCATENATED MODULE: external "../usePublicDataQueries.js"
|
|
22
|
+
|
|
23
|
+
;// CONCATENATED MODULE: external "./activeSpan.js"
|
|
24
|
+
|
|
25
|
+
;// CONCATENATED MODULE: external "./tracer.js"
|
|
26
|
+
|
|
27
|
+
;// CONCATENATED MODULE: external "./utils.js"
|
|
28
|
+
|
|
29
|
+
;// CONCATENATED MODULE: ./src/honeycomb/registerHoneycombInstrumentation.ts
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
function reduceDataFetchEvents(runtime, onDataFetchingStarted, onDataReady, onPublicDataFetchStarted, onPublicDataReady, onProtectedDataFetchStarted, onProtectedDataReady) {
|
|
40
|
+
let dataFetchState = "none";
|
|
41
|
+
// TODO: Validate if this handler should use { once: true }.
|
|
42
|
+
runtime.eventBus.addListener(__WEBPACK_EXTERNAL_MODULE__usePublicDataQueries_js_1f22e760__.PublicDataFetchStartedEvent, ()=>{
|
|
43
|
+
if (dataFetchState === "none") {
|
|
44
|
+
dataFetchState = "fetching-data";
|
|
45
|
+
onDataFetchingStarted();
|
|
46
|
+
}
|
|
47
|
+
onPublicDataFetchStarted();
|
|
48
|
+
});
|
|
49
|
+
// TODO: Validate if this handler should use { once: true }.
|
|
50
|
+
runtime.eventBus.addListener(__WEBPACK_EXTERNAL_MODULE__AppRouterReducer_js_9236b353__.PublicDataReadyEvent, ()=>{
|
|
51
|
+
onPublicDataReady();
|
|
52
|
+
if (dataFetchState === "fetching-data") {
|
|
53
|
+
dataFetchState = "public-data-ready";
|
|
54
|
+
} else if (dataFetchState === "protected-data-ready") {
|
|
55
|
+
dataFetchState = "data-ready";
|
|
56
|
+
onDataReady();
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
// TODO: Validate if this handler should use { once: true }.
|
|
60
|
+
runtime.eventBus.addListener(__WEBPACK_EXTERNAL_MODULE__useProtectedDataQueries_js_5ede0a53__.ProtectedDataFetchStartedEvent, ()=>{
|
|
61
|
+
if (dataFetchState === "none") {
|
|
62
|
+
dataFetchState = "fetching-data";
|
|
63
|
+
onDataFetchingStarted();
|
|
64
|
+
}
|
|
65
|
+
onProtectedDataFetchStarted();
|
|
66
|
+
});
|
|
67
|
+
// TODO: Validate if this handler should use { once: true }.
|
|
68
|
+
runtime.eventBus.addListener(__WEBPACK_EXTERNAL_MODULE__AppRouterReducer_js_9236b353__.ProtectedDataReadyEvent, ()=>{
|
|
69
|
+
onProtectedDataReady();
|
|
70
|
+
if (dataFetchState === "fetching-data") {
|
|
71
|
+
dataFetchState = "protected-data-ready";
|
|
72
|
+
} else if (dataFetchState === "public-data-ready") {
|
|
73
|
+
dataFetchState = "data-ready";
|
|
74
|
+
onDataReady();
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
function registerTrackingListeners(runtime) {
|
|
79
|
+
let bootstrappingSpan;
|
|
80
|
+
let localModuleRegistrationSpan;
|
|
81
|
+
let localModuleDeferredRegistrationSpan;
|
|
82
|
+
let remoteModuleRegistrationSpan;
|
|
83
|
+
let remoteModuleDeferredRegistrationSpan;
|
|
84
|
+
let dataFetchSpan;
|
|
85
|
+
let deferredRegistrationsUpdateSpan;
|
|
86
|
+
let localModuleDeferredRegistrationsUpdateSpan;
|
|
87
|
+
let remoteModuleDeferredRegistrationsUpdateSpan;
|
|
88
|
+
runtime.eventBus.addListener(__WEBPACK_EXTERNAL_MODULE__initializeFirefly_js_30865401__.ApplicationBootstrappingStartedEvent, ()=>{
|
|
89
|
+
bootstrappingSpan = (0,__WEBPACK_EXTERNAL_MODULE__utils_js_d88b7fe1__.startSpan)((options, context)=>(0,__WEBPACK_EXTERNAL_MODULE__tracer_js_f37593cd__.getTracer)().startSpan("squide-bootstrapping", options, context));
|
|
90
|
+
}, {
|
|
91
|
+
once: true
|
|
92
|
+
});
|
|
93
|
+
runtime.eventBus.addListener(__WEBPACK_EXTERNAL_MODULE__AppRouterReducer_js_9236b353__.ApplicationBoostrappedEvent, ()=>{
|
|
94
|
+
if (bootstrappingSpan) {
|
|
95
|
+
bootstrappingSpan.end();
|
|
96
|
+
}
|
|
97
|
+
}, {
|
|
98
|
+
once: true
|
|
99
|
+
});
|
|
100
|
+
runtime.eventBus.addListener(__WEBPACK_EXTERNAL_MODULE__AppRouterReducer_js_9236b353__.MswReadyEvent, ()=>{
|
|
101
|
+
if (bootstrappingSpan) {
|
|
102
|
+
bootstrappingSpan.addEvent("msw-ready");
|
|
103
|
+
}
|
|
104
|
+
}, {
|
|
105
|
+
once: true
|
|
106
|
+
});
|
|
107
|
+
runtime.eventBus.addListener(__WEBPACK_EXTERNAL_MODULE__squide_core_7a405b8f__.LocalModulesRegistrationStartedEvent, (payload)=>{
|
|
108
|
+
const attributes = {
|
|
109
|
+
"app.squide.module_count": payload.moduleCount
|
|
110
|
+
};
|
|
111
|
+
if (bootstrappingSpan) {
|
|
112
|
+
bootstrappingSpan.addEvent("local-module-registration-started", attributes);
|
|
113
|
+
}
|
|
114
|
+
localModuleRegistrationSpan = (0,__WEBPACK_EXTERNAL_MODULE__utils_js_d88b7fe1__.startChildSpan)(bootstrappingSpan, (options, context)=>{
|
|
115
|
+
return (0,__WEBPACK_EXTERNAL_MODULE__tracer_js_f37593cd__.getTracer)().startSpan("local-module-registration", {
|
|
116
|
+
...options,
|
|
117
|
+
attributes
|
|
118
|
+
}, context);
|
|
119
|
+
});
|
|
120
|
+
}, {
|
|
121
|
+
once: true
|
|
122
|
+
});
|
|
123
|
+
runtime.eventBus.addListener(__WEBPACK_EXTERNAL_MODULE__squide_core_7a405b8f__.LocalModulesRegistrationCompletedEvent, (payload)=>{
|
|
124
|
+
if (bootstrappingSpan) {
|
|
125
|
+
bootstrappingSpan.addEvent("local-module-registration-completed", {
|
|
126
|
+
"app.squide.module_count": payload.moduleCount
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
if (localModuleRegistrationSpan) {
|
|
130
|
+
localModuleRegistrationSpan.end();
|
|
131
|
+
}
|
|
132
|
+
}, {
|
|
133
|
+
once: true
|
|
134
|
+
});
|
|
135
|
+
// Can occur multiple times.
|
|
136
|
+
runtime.eventBus.addListener(__WEBPACK_EXTERNAL_MODULE__squide_core_7a405b8f__.LocalModuleRegistrationFailedEvent, (payload)=>{
|
|
137
|
+
const registrationError = payload;
|
|
138
|
+
if (localModuleRegistrationSpan) {
|
|
139
|
+
(0,__WEBPACK_EXTERNAL_MODULE__utils_js_d88b7fe1__.traceError)(localModuleRegistrationSpan, registrationError);
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
runtime.eventBus.addListener(__WEBPACK_EXTERNAL_MODULE__squide_core_7a405b8f__.LocalModulesDeferredRegistrationStartedEvent, (payload)=>{
|
|
143
|
+
const attributes = {
|
|
144
|
+
"app.squide.registration_count": payload.registrationCount
|
|
145
|
+
};
|
|
146
|
+
if (bootstrappingSpan) {
|
|
147
|
+
bootstrappingSpan.addEvent("local-module-deferred-registration-started", attributes);
|
|
148
|
+
}
|
|
149
|
+
localModuleDeferredRegistrationSpan = (0,__WEBPACK_EXTERNAL_MODULE__utils_js_d88b7fe1__.startChildSpan)(bootstrappingSpan, (options, context)=>{
|
|
150
|
+
return (0,__WEBPACK_EXTERNAL_MODULE__tracer_js_f37593cd__.getTracer)().startSpan("local-module-deferred-registration", {
|
|
151
|
+
...options,
|
|
152
|
+
attributes
|
|
153
|
+
}, context);
|
|
154
|
+
});
|
|
155
|
+
}, {
|
|
156
|
+
once: true
|
|
157
|
+
});
|
|
158
|
+
runtime.eventBus.addListener(__WEBPACK_EXTERNAL_MODULE__squide_core_7a405b8f__.LocalModulesDeferredRegistrationCompletedEvent, (payload)=>{
|
|
159
|
+
if (bootstrappingSpan) {
|
|
160
|
+
bootstrappingSpan.addEvent("local-module-deferred-registration-completed", {
|
|
161
|
+
"app.squide.registration_count": payload.registrationCount
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
if (localModuleDeferredRegistrationSpan) {
|
|
165
|
+
localModuleDeferredRegistrationSpan.end();
|
|
166
|
+
}
|
|
167
|
+
}, {
|
|
168
|
+
once: true
|
|
169
|
+
});
|
|
170
|
+
// Can occur multiple times.
|
|
171
|
+
runtime.eventBus.addListener(__WEBPACK_EXTERNAL_MODULE__squide_core_7a405b8f__.LocalModuleDeferredRegistrationFailedEvent, (payload)=>{
|
|
172
|
+
const registrationError = payload;
|
|
173
|
+
if (localModuleDeferredRegistrationSpan) {
|
|
174
|
+
(0,__WEBPACK_EXTERNAL_MODULE__utils_js_d88b7fe1__.traceError)(localModuleRegistrationSpan, registrationError);
|
|
175
|
+
}
|
|
176
|
+
});
|
|
177
|
+
runtime.eventBus.addListener(__WEBPACK_EXTERNAL_MODULE__squide_module_federation_054d2ec6__.RemoteModulesRegistrationStartedEvent, (payload)=>{
|
|
178
|
+
const attributes = {
|
|
179
|
+
"app.squide.remote_count": payload.remoteCount
|
|
180
|
+
};
|
|
181
|
+
if (bootstrappingSpan) {
|
|
182
|
+
bootstrappingSpan.addEvent("remote-module-registration-started", attributes);
|
|
183
|
+
}
|
|
184
|
+
remoteModuleRegistrationSpan = (0,__WEBPACK_EXTERNAL_MODULE__utils_js_d88b7fe1__.startChildSpan)(bootstrappingSpan, (options, context)=>{
|
|
185
|
+
return (0,__WEBPACK_EXTERNAL_MODULE__tracer_js_f37593cd__.getTracer)().startSpan("remote-module-registration", {
|
|
186
|
+
...options,
|
|
187
|
+
attributes
|
|
188
|
+
}, context);
|
|
189
|
+
});
|
|
190
|
+
}, {
|
|
191
|
+
once: true
|
|
192
|
+
});
|
|
193
|
+
runtime.eventBus.addListener(__WEBPACK_EXTERNAL_MODULE__squide_module_federation_054d2ec6__.RemoteModulesRegistrationCompletedEvent, (payload)=>{
|
|
194
|
+
if (bootstrappingSpan) {
|
|
195
|
+
bootstrappingSpan.addEvent("remote-module-registration-completed", {
|
|
196
|
+
"app.squide.remote_count": payload.remoteCount
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
if (remoteModuleRegistrationSpan) {
|
|
200
|
+
remoteModuleRegistrationSpan.end();
|
|
201
|
+
}
|
|
202
|
+
}, {
|
|
203
|
+
once: true
|
|
204
|
+
});
|
|
205
|
+
// Can occur multiple times.
|
|
206
|
+
runtime.eventBus.addListener(__WEBPACK_EXTERNAL_MODULE__squide_module_federation_054d2ec6__.RemoteModuleRegistrationFailedEvent, (payload)=>{
|
|
207
|
+
const registrationError = payload;
|
|
208
|
+
if (remoteModuleRegistrationSpan) {
|
|
209
|
+
(0,__WEBPACK_EXTERNAL_MODULE__utils_js_d88b7fe1__.traceError)(remoteModuleRegistrationSpan, registrationError);
|
|
210
|
+
}
|
|
211
|
+
});
|
|
212
|
+
runtime.eventBus.addListener(__WEBPACK_EXTERNAL_MODULE__squide_module_federation_054d2ec6__.RemoteModulesDeferredRegistrationStartedEvent, (payload)=>{
|
|
213
|
+
const attributes = {
|
|
214
|
+
"app.squide.registration_count": payload.registrationCount
|
|
215
|
+
};
|
|
216
|
+
if (bootstrappingSpan) {
|
|
217
|
+
bootstrappingSpan.addEvent("remote-module-deferred-registration-started", attributes);
|
|
218
|
+
}
|
|
219
|
+
remoteModuleDeferredRegistrationSpan = (0,__WEBPACK_EXTERNAL_MODULE__utils_js_d88b7fe1__.startChildSpan)(bootstrappingSpan, (options, context)=>{
|
|
220
|
+
return (0,__WEBPACK_EXTERNAL_MODULE__tracer_js_f37593cd__.getTracer)().startSpan("remote-module-deferred-registration", {
|
|
221
|
+
...options,
|
|
222
|
+
attributes
|
|
223
|
+
}, context);
|
|
224
|
+
});
|
|
225
|
+
}, {
|
|
226
|
+
once: true
|
|
227
|
+
});
|
|
228
|
+
runtime.eventBus.addListener(__WEBPACK_EXTERNAL_MODULE__squide_module_federation_054d2ec6__.RemoteModulesDeferredRegistrationCompletedEvent, (payload)=>{
|
|
229
|
+
if (bootstrappingSpan) {
|
|
230
|
+
bootstrappingSpan.addEvent("remote-module-deferred-registration-completed", {
|
|
231
|
+
"app.squide.registration_count": payload.registrationCount
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
if (remoteModuleDeferredRegistrationSpan) {
|
|
235
|
+
remoteModuleDeferredRegistrationSpan.end();
|
|
236
|
+
}
|
|
237
|
+
}, {
|
|
238
|
+
once: true
|
|
239
|
+
});
|
|
240
|
+
// Can occur multiple times.
|
|
241
|
+
runtime.eventBus.addListener(__WEBPACK_EXTERNAL_MODULE__squide_module_federation_054d2ec6__.RemoteModuleDeferredRegistrationFailedEvent, (payload)=>{
|
|
242
|
+
const registrationError = payload;
|
|
243
|
+
if (remoteModuleDeferredRegistrationSpan) {
|
|
244
|
+
(0,__WEBPACK_EXTERNAL_MODULE__utils_js_d88b7fe1__.traceError)(remoteModuleDeferredRegistrationSpan, registrationError);
|
|
245
|
+
}
|
|
246
|
+
});
|
|
247
|
+
const handleFetchDataStarted = ()=>{
|
|
248
|
+
dataFetchSpan = (0,__WEBPACK_EXTERNAL_MODULE__utils_js_d88b7fe1__.startActiveChildSpan)(bootstrappingSpan, (options, context)=>{
|
|
249
|
+
const name = "data-fetch";
|
|
250
|
+
const span = (0,__WEBPACK_EXTERNAL_MODULE__tracer_js_f37593cd__.getTracer)().startSpan(name, options, context);
|
|
251
|
+
return {
|
|
252
|
+
name,
|
|
253
|
+
span
|
|
254
|
+
};
|
|
255
|
+
});
|
|
256
|
+
};
|
|
257
|
+
const handleDataReady = ()=>{
|
|
258
|
+
if (dataFetchSpan) {
|
|
259
|
+
(0,__WEBPACK_EXTERNAL_MODULE__utils_js_d88b7fe1__.endActiveSpan)(dataFetchSpan);
|
|
260
|
+
}
|
|
261
|
+
};
|
|
262
|
+
const handlePublicDataFetchStarted = ()=>{
|
|
263
|
+
if (dataFetchSpan) {
|
|
264
|
+
dataFetchSpan.instance.addEvent("public-data-fetch-started");
|
|
265
|
+
}
|
|
266
|
+
};
|
|
267
|
+
const handlePublicDataReady = ()=>{
|
|
268
|
+
if (dataFetchSpan) {
|
|
269
|
+
dataFetchSpan.instance.addEvent("public-data-ready");
|
|
270
|
+
}
|
|
271
|
+
};
|
|
272
|
+
const handleProtectedDataFetchStarted = ()=>{
|
|
273
|
+
if (dataFetchSpan) {
|
|
274
|
+
dataFetchSpan.instance.addEvent("protected-data-fetch-started");
|
|
275
|
+
}
|
|
276
|
+
};
|
|
277
|
+
const handleProtectedDataReady = ()=>{
|
|
278
|
+
if (dataFetchSpan) {
|
|
279
|
+
dataFetchSpan.instance.addEvent("protected-data-ready");
|
|
280
|
+
}
|
|
281
|
+
};
|
|
282
|
+
reduceDataFetchEvents(runtime, handleFetchDataStarted, handleDataReady, handlePublicDataFetchStarted, handlePublicDataReady, handleProtectedDataFetchStarted, handleProtectedDataReady);
|
|
283
|
+
runtime.eventBus.addListener(__WEBPACK_EXTERNAL_MODULE__AppRouterReducer_js_9236b353__.ModulesRegisteredEvent, ()=>{
|
|
284
|
+
if (bootstrappingSpan) {
|
|
285
|
+
bootstrappingSpan.addEvent("modules-registered");
|
|
286
|
+
}
|
|
287
|
+
}, {
|
|
288
|
+
once: true
|
|
289
|
+
});
|
|
290
|
+
runtime.eventBus.addListener(__WEBPACK_EXTERNAL_MODULE__AppRouterReducer_js_9236b353__.ModulesReadyEvent, ()=>{
|
|
291
|
+
if (bootstrappingSpan) {
|
|
292
|
+
bootstrappingSpan.addEvent("modules-ready");
|
|
293
|
+
}
|
|
294
|
+
}, {
|
|
295
|
+
once: true
|
|
296
|
+
});
|
|
297
|
+
// Can occur multiple times.
|
|
298
|
+
runtime.eventBus.addListener(__WEBPACK_EXTERNAL_MODULE__squide_module_federation_054d2ec6__.DeferredRegistrationsUpdateStartedEvent, ()=>{
|
|
299
|
+
deferredRegistrationsUpdateSpan = (0,__WEBPACK_EXTERNAL_MODULE__utils_js_d88b7fe1__.startSpan)((options, context)=>(0,__WEBPACK_EXTERNAL_MODULE__tracer_js_f37593cd__.getTracer)().startSpan("squide-deferred-registrations-update", options, context));
|
|
300
|
+
});
|
|
301
|
+
// Can occur multiple times.
|
|
302
|
+
runtime.eventBus.addListener(__WEBPACK_EXTERNAL_MODULE__squide_module_federation_054d2ec6__.DeferredRegistrationsUpdateCompletedEvent, ()=>{
|
|
303
|
+
if (deferredRegistrationsUpdateSpan) {
|
|
304
|
+
deferredRegistrationsUpdateSpan.end();
|
|
305
|
+
}
|
|
306
|
+
});
|
|
307
|
+
// Can occur multiple times.
|
|
308
|
+
runtime.eventBus.addListener(__WEBPACK_EXTERNAL_MODULE__squide_core_7a405b8f__.LocalModulesDeferredRegistrationsUpdateStartedEvent, (payload)=>{
|
|
309
|
+
const attributes = {
|
|
310
|
+
"app.squide.registration_count": payload.registrationCount
|
|
311
|
+
};
|
|
312
|
+
if (deferredRegistrationsUpdateSpan) {
|
|
313
|
+
deferredRegistrationsUpdateSpan.addEvent("local-module-deferred-registrations-update-started", attributes);
|
|
314
|
+
}
|
|
315
|
+
localModuleDeferredRegistrationsUpdateSpan = (0,__WEBPACK_EXTERNAL_MODULE__utils_js_d88b7fe1__.startActiveChildSpan)(deferredRegistrationsUpdateSpan, (options, context)=>{
|
|
316
|
+
const name = "local-module-deferred-registrations-update";
|
|
317
|
+
const span = (0,__WEBPACK_EXTERNAL_MODULE__tracer_js_f37593cd__.getTracer)().startSpan(name, {
|
|
318
|
+
attributes,
|
|
319
|
+
...options
|
|
320
|
+
}, context);
|
|
321
|
+
return {
|
|
322
|
+
name,
|
|
323
|
+
span
|
|
324
|
+
};
|
|
325
|
+
});
|
|
326
|
+
});
|
|
327
|
+
// Can occur multiple times.
|
|
328
|
+
runtime.eventBus.addListener(__WEBPACK_EXTERNAL_MODULE__squide_core_7a405b8f__.LocalModulesDeferredRegistrationsUpdateCompletedEvent, (payload)=>{
|
|
329
|
+
if (deferredRegistrationsUpdateSpan) {
|
|
330
|
+
deferredRegistrationsUpdateSpan.addEvent("local-module-deferred-registrations-update-completed", {
|
|
331
|
+
"app.squide.registration_count": payload.registrationCount
|
|
332
|
+
});
|
|
333
|
+
}
|
|
334
|
+
if (localModuleDeferredRegistrationsUpdateSpan) {
|
|
335
|
+
(0,__WEBPACK_EXTERNAL_MODULE__utils_js_d88b7fe1__.endActiveSpan)(localModuleDeferredRegistrationsUpdateSpan);
|
|
336
|
+
}
|
|
337
|
+
});
|
|
338
|
+
// Can occur multiple times.
|
|
339
|
+
runtime.eventBus.addListener(__WEBPACK_EXTERNAL_MODULE__squide_core_7a405b8f__.LocalModuleDeferredRegistrationUpdateFailedEvent, (payload)=>{
|
|
340
|
+
const registrationError = payload;
|
|
341
|
+
if (localModuleDeferredRegistrationsUpdateSpan) {
|
|
342
|
+
(0,__WEBPACK_EXTERNAL_MODULE__utils_js_d88b7fe1__.traceError)(localModuleDeferredRegistrationsUpdateSpan.instance, registrationError);
|
|
343
|
+
}
|
|
344
|
+
});
|
|
345
|
+
// Can occur multiple times.
|
|
346
|
+
runtime.eventBus.addListener(__WEBPACK_EXTERNAL_MODULE__squide_module_federation_054d2ec6__.RemoteModulesDeferredRegistrationsUpdateStartedEvent, (payload)=>{
|
|
347
|
+
const attributes = {
|
|
348
|
+
"app.squide.registration_count": payload.registrationCount
|
|
349
|
+
};
|
|
350
|
+
if (deferredRegistrationsUpdateSpan) {
|
|
351
|
+
deferredRegistrationsUpdateSpan.addEvent("remote-module-deferred-registrations-update-started", attributes);
|
|
352
|
+
}
|
|
353
|
+
remoteModuleDeferredRegistrationsUpdateSpan = (0,__WEBPACK_EXTERNAL_MODULE__utils_js_d88b7fe1__.startActiveChildSpan)(deferredRegistrationsUpdateSpan, (options, context)=>{
|
|
354
|
+
const name = "remote-module-deferred-registrations-update";
|
|
355
|
+
const span = (0,__WEBPACK_EXTERNAL_MODULE__tracer_js_f37593cd__.getTracer)().startSpan(name, {
|
|
356
|
+
attributes,
|
|
357
|
+
...options
|
|
358
|
+
}, context);
|
|
359
|
+
return {
|
|
360
|
+
name,
|
|
361
|
+
span
|
|
362
|
+
};
|
|
363
|
+
});
|
|
364
|
+
});
|
|
365
|
+
// Can occur multiple times.
|
|
366
|
+
runtime.eventBus.addListener(__WEBPACK_EXTERNAL_MODULE__squide_module_federation_054d2ec6__.RemoteModulesDeferredRegistrationsUpdateCompletedEvent, (payload)=>{
|
|
367
|
+
if (deferredRegistrationsUpdateSpan) {
|
|
368
|
+
deferredRegistrationsUpdateSpan.addEvent("remote-module-deferred-registrations-update-completed", {
|
|
369
|
+
"app.squide.registration_count": payload.registrationCount
|
|
370
|
+
});
|
|
371
|
+
}
|
|
372
|
+
if (remoteModuleDeferredRegistrationsUpdateSpan) {
|
|
373
|
+
(0,__WEBPACK_EXTERNAL_MODULE__utils_js_d88b7fe1__.endActiveSpan)(remoteModuleDeferredRegistrationsUpdateSpan);
|
|
374
|
+
}
|
|
375
|
+
});
|
|
376
|
+
// Can occur multiple times.
|
|
377
|
+
runtime.eventBus.addListener(__WEBPACK_EXTERNAL_MODULE__squide_module_federation_054d2ec6__.RemoteModuleDeferredRegistrationUpdateFailedEvent, (payload)=>{
|
|
378
|
+
const registrationError = payload;
|
|
379
|
+
if (remoteModuleDeferredRegistrationsUpdateSpan) {
|
|
380
|
+
(0,__WEBPACK_EXTERNAL_MODULE__utils_js_d88b7fe1__.traceError)(remoteModuleDeferredRegistrationsUpdateSpan.instance, registrationError);
|
|
381
|
+
}
|
|
382
|
+
});
|
|
383
|
+
}
|
|
384
|
+
function getRegisterFetchRequestHookFunction() {
|
|
385
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
386
|
+
// @ts-ignore
|
|
387
|
+
return globalThis.__WLP_HONEYCOMB_REGISTER_DYNAMIC_FETCH_REQUEST_HOOK;
|
|
388
|
+
}
|
|
389
|
+
function registerHoneycombInstrumentation(runtime) {
|
|
390
|
+
const registerFetchRequestHookFunction = getRegisterFetchRequestHookFunction();
|
|
391
|
+
if (registerFetchRequestHookFunction) {
|
|
392
|
+
(0,__WEBPACK_EXTERNAL_MODULE__activeSpan_js_fe031e6b__.registerActiveSpanStack)();
|
|
393
|
+
const activeSpanOverrideFunction = (0,__WEBPACK_EXTERNAL_MODULE__activeSpan_js_fe031e6b__.createOverrideFetchRequestSpanWithActiveSpanContext)(runtime.logger);
|
|
394
|
+
// Dynamically registering this request hook function to nest the HTTP requests
|
|
395
|
+
// of squide bootstrapping under the appropriate Honeycomb span.
|
|
396
|
+
registerFetchRequestHookFunction(activeSpanOverrideFunction);
|
|
397
|
+
} else {
|
|
398
|
+
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.");
|
|
399
|
+
}
|
|
400
|
+
registerTrackingListeners(runtime);
|
|
401
|
+
// try {
|
|
402
|
+
// const registerFetchRequestHookFunction = getRegisterFetchRequestHookFunction();
|
|
403
|
+
// if (registerFetchRequestHookFunction) {
|
|
404
|
+
// const overrideFetchRequestHook = createOverrideFetchRequestWithManifestSectionSpanContext(runtime.logger);
|
|
405
|
+
// // Dynamically registering this request hook function to nest the HTTP requests
|
|
406
|
+
// // of the widgets initialization under the appropriate Honeycomb span.
|
|
407
|
+
// registerFetchRequestHookFunction(overrideFetchRequestHook);
|
|
408
|
+
// } else {
|
|
409
|
+
// runtime.logger.warning("[wlp-widgets] 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.");
|
|
410
|
+
// }
|
|
411
|
+
// registerTrackingListeners(runtime);
|
|
412
|
+
// } catch (error: unknown) {
|
|
413
|
+
// runtime.logger.error("[wlp-widgets] An error occured while registering Honeycomb instrumentation.", error);
|
|
414
|
+
// runtime.errorPropagator.propagate(error as Error);
|
|
415
|
+
// }
|
|
416
|
+
}
|
|
417
|
+
function canRegisterHoneycombInstrumentation() {
|
|
418
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
419
|
+
// @ts-ignore
|
|
420
|
+
return globalThis.__WLP_HONEYCOMB_INSTRUMENTATION_IS_REGISTERED__ === true;
|
|
421
|
+
} // export function registerHoneycombInstrumentation(runtime: FireflyRuntime, namespace: string, serviceName: NonNullable<HoneycombSdkOptions["serviceName"]>, apiServiceUrls: PropagateTraceHeaderCorsUrls, options?: RegisterHoneycombInstrumentationOptions) {
|
|
422
|
+
// const augmentedOptions = getInstrumentationOptions(runtime, options);
|
|
423
|
+
// registerWorkleapHoneycombInstrumentation(namespace, serviceName, apiServiceUrls, augmentedOptions);
|
|
424
|
+
// registerTrackingListeners(runtime);
|
|
425
|
+
// registerActiveSpanStack();
|
|
426
|
+
// }
|
|
427
|
+
|
|
428
|
+
export { canRegisterHoneycombInstrumentation, reduceDataFetchEvents, registerHoneycombInstrumentation };
|
|
429
|
+
|
|
430
|
+
//# sourceMappingURL=registerHoneycombInstrumentation.js.map
|