@equinor/fusion-framework-vite-plugin-spa 5.1.0 → 5.2.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/README.md +9 -0
- package/dist/TelemetryAdapter-B6JH_RXA.js +91 -0
- package/dist/TelemetryAdapter-B6JH_RXA.js.map +1 -0
- package/dist/create-legacy-browser-delegate-B4z_676L.js +2862 -0
- package/dist/create-legacy-browser-delegate-B4z_676L.js.map +1 -0
- package/dist/enable-dev-server-tracing-DaQc5M9V.js +8137 -0
- package/dist/enable-dev-server-tracing-DaQc5M9V.js.map +1 -0
- package/dist/esm/html/bootstrap.js +17 -0
- package/dist/esm/html/bootstrap.js.map +1 -1
- package/dist/esm/html/enable-dev-server-tracing.js +94 -0
- package/dist/esm/html/enable-dev-server-tracing.js.map +1 -0
- package/dist/esm/version.js +1 -1
- package/dist/html/bootstrap.js +115 -98
- package/dist/html/bootstrap.js.map +1 -1
- package/dist/index-BO_d5C6N.js +1570 -0
- package/dist/index-BO_d5C6N.js.map +1 -0
- package/dist/{index-Df9EZ6lh.js → index-CDpTfyge.js} +2 -2
- package/dist/index-CDpTfyge.js.map +1 -0
- package/dist/{module-DzjJ4gjy.js → module-Xg35JJRU.js} +16 -23
- package/dist/module-Xg35JJRU.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/html/enable-dev-server-tracing.d.ts +17 -0
- package/dist/types/html/html.d.ts +1 -1
- package/dist/types/version.d.ts +1 -1
- package/package.json +17 -6
- package/dist/index-Df9EZ6lh.js.map +0 -1
- package/dist/module-DzjJ4gjy.js.map +0 -1
|
@@ -48,6 +48,19 @@ else {
|
|
|
48
48
|
builder.setRequiresAuth(isEnabledEnvValue(import.meta.env.FUSION_SPA_MSAL_REQUIRES_AUTH));
|
|
49
49
|
});
|
|
50
50
|
}
|
|
51
|
+
// Initialize tracing before app startup so network requests and logs share active trace context.
|
|
52
|
+
if (import.meta.env.FUSION_SPA_TELEMETRY_OTLP_TRACES_ENDPOINT) {
|
|
53
|
+
const { enableDevServerTracing } = await import('./enable-dev-server-tracing.js');
|
|
54
|
+
enableDevServerTracing(new URL(import.meta.env.FUSION_SPA_TELEMETRY_OTLP_TRACES_ENDPOINT, window.location.origin).href);
|
|
55
|
+
}
|
|
56
|
+
// The dev-server environment bridge owns activation; the SPA only consumes its endpoint.
|
|
57
|
+
const devServerOtlpAdapter = import.meta.env.FUSION_SPA_TELEMETRY_OTLP_ENDPOINT
|
|
58
|
+
? new (await import('@equinor/fusion-framework-module-telemetry/otlp-adapter')).OtlpAdapter({
|
|
59
|
+
url: new URL(import.meta.env.FUSION_SPA_TELEMETRY_OTLP_ENDPOINT, window.location.origin).href,
|
|
60
|
+
fallback: true,
|
|
61
|
+
serviceName: 'fusion.dev-server',
|
|
62
|
+
})
|
|
63
|
+
: undefined;
|
|
51
64
|
enableTelemetry(configurator, {
|
|
52
65
|
attachConfiguratorEvents: true,
|
|
53
66
|
configure: (builder) => {
|
|
@@ -56,6 +69,10 @@ enableTelemetry(configurator, {
|
|
|
56
69
|
filter: Number.isNaN(consoleLevel) ? undefined : (item) => item.level >= consoleLevel,
|
|
57
70
|
});
|
|
58
71
|
builder.setAdapter('console', consoleAdapter);
|
|
72
|
+
// Only the dev-server environment bridge opts the shell into OTLP export.
|
|
73
|
+
if (devServerOtlpAdapter) {
|
|
74
|
+
builder.setAdapter('dev-server-otlp', devServerOtlpAdapter);
|
|
75
|
+
}
|
|
59
76
|
builder.setMetadata(({ modules }) => {
|
|
60
77
|
const metadata = {
|
|
61
78
|
fusion: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bootstrap.js","sourceRoot":"","sources":["../../../src/html/bootstrap.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAEvE,OAAO,EAAE,mBAAmB,EAAmB,MAAM,uCAAuC,CAAC;AAC7F,OAAO,EAAE,UAAU,EAAmB,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,EAAE,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;IACzC,QAAQ,CAAC,IAAI,CAAC,SAAS,GAAG,EAAE,CAAC;IAC7B,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;IAE9B,MAAM,gBAAgB,GAAG,sBAAsB,CAC7C,WAAW,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,SAAS,EACzC,eAAe,CAAC,KAAK,CAAC,SAAS,EAC/B,eAAe,CAAC,KAAK,CAAC,aAAa,CACpC,CAAC;IAEF,qEAAqE;IACrE,sCAAsC;IACtC,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,WAAW;SACjC,KAAK,EAAE;SACP,OAAO,CACN,iBAAiB,CAAoD,gBAAgB,CAAC,EACtF;QACE,IAAI,EAAE;YACJ,IAAI,EAAE,iCAAiC;YACvC,KAAK,EAAE,cAAc,CAAC,KAAK;YAC3B,UAAU,EAAE;gBACV,QAAQ;gBACR,SAAS;gBACT,UAAU,EAAE,gBAAgB;aAC7B;SACF;KACF,CACF,CAAC;IAEJ,uEAAuE;IACvE,MAAM,CAAC,EAAE,EAAE,EAAE,GAAG,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,EAAE,aAAa,EAAE,CAAC,CAAC;AACxE,CAAC,CAAC,EAAE,CAAC"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { ProxyTracerProvider, trace } from '@opentelemetry/api';
|
|
2
|
+
import { ZoneContextManager } from '@opentelemetry/context-zone';
|
|
3
|
+
import { W3CTraceContextPropagator } from '@opentelemetry/core';
|
|
4
|
+
import { OTLPTraceExporter } from '@opentelemetry/exporter-trace-otlp-http';
|
|
5
|
+
import { DocumentLoadInstrumentation } from '@opentelemetry/instrumentation-document-load';
|
|
6
|
+
import { FetchInstrumentation } from '@opentelemetry/instrumentation-fetch';
|
|
7
|
+
import { XMLHttpRequestInstrumentation } from '@opentelemetry/instrumentation-xml-http-request';
|
|
8
|
+
import { resourceFromAttributes } from '@opentelemetry/resources';
|
|
9
|
+
import { BatchSpanProcessor, WebTracerProvider } from '@opentelemetry/sdk-trace-web';
|
|
10
|
+
/**
|
|
11
|
+
* Tags browser spans with the current app route without coupling tracing to app initialization.
|
|
12
|
+
* @param span - Document or HTTP span being created by browser instrumentation.
|
|
13
|
+
*/
|
|
14
|
+
function annotateSpan(span) {
|
|
15
|
+
const appKey = window.location.pathname.match(/^\/apps\/([^/]+)/)?.[1];
|
|
16
|
+
span.setAttribute('source', appKey ? 'app' : 'framework');
|
|
17
|
+
// Framework requests outside an app route must not acquire a misleading app identity.
|
|
18
|
+
if (appKey) {
|
|
19
|
+
span.setAttribute('fusion.app.key', decodeURIComponent(appKey));
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Connects browser requests and logs to backend traces during development.
|
|
24
|
+
*
|
|
25
|
+
* Uses standard fetch/XHR instrumentation, W3C traceparent/tracestate propagation and
|
|
26
|
+
* a zone context manager to preserve active spans across callbacks and promise chains.
|
|
27
|
+
* Document-load instrumentation continues a server trace supplied in a traceparent meta tag.
|
|
28
|
+
* Existing global tracing providers are never overwritten.
|
|
29
|
+
*
|
|
30
|
+
* @param endpoint - Absolute same-origin dev-server OTLP traces route.
|
|
31
|
+
* @returns The installed provider, or undefined when tracing was already configured.
|
|
32
|
+
* @example
|
|
33
|
+
* ```ts
|
|
34
|
+
* enableDevServerTracing('http://localhost:3000/@fusion-telemetry/v1/traces');
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
export function enableDevServerTracing(endpoint) {
|
|
38
|
+
const existing = trace.getTracerProvider();
|
|
39
|
+
// Application-owned global tracing must remain authoritative.
|
|
40
|
+
if (!(existing instanceof ProxyTracerProvider) ||
|
|
41
|
+
existing.getDelegateTracer('fusion.dev-server')) {
|
|
42
|
+
return undefined;
|
|
43
|
+
}
|
|
44
|
+
const provider = new WebTracerProvider({
|
|
45
|
+
resource: resourceFromAttributes({ 'service.name': 'fusion.dev-server' }),
|
|
46
|
+
spanProcessors: [
|
|
47
|
+
// Page-load bursts should share requests rather than exhaust exporter concurrency.
|
|
48
|
+
new BatchSpanProcessor(new OTLPTraceExporter({ url: endpoint, timeoutMillis: 5_000 }), {
|
|
49
|
+
scheduledDelayMillis: 1_000,
|
|
50
|
+
maxExportBatchSize: 128,
|
|
51
|
+
maxQueueSize: 2_048,
|
|
52
|
+
}),
|
|
53
|
+
],
|
|
54
|
+
});
|
|
55
|
+
provider.register({
|
|
56
|
+
contextManager: new ZoneContextManager(),
|
|
57
|
+
propagator: new W3CTraceContextPropagator(),
|
|
58
|
+
});
|
|
59
|
+
const ignoreUrls = [
|
|
60
|
+
/\/@fusion-telemetry\//,
|
|
61
|
+
/\/@vite\//,
|
|
62
|
+
/\/@id\//,
|
|
63
|
+
/\/@fs\//,
|
|
64
|
+
/\/node_modules\//,
|
|
65
|
+
];
|
|
66
|
+
const fetchInstrumentation = new FetchInstrumentation({
|
|
67
|
+
enabled: false,
|
|
68
|
+
ignoreUrls,
|
|
69
|
+
requestHook: annotateSpan,
|
|
70
|
+
});
|
|
71
|
+
const xhrInstrumentation = new XMLHttpRequestInstrumentation({
|
|
72
|
+
enabled: false,
|
|
73
|
+
ignoreUrls,
|
|
74
|
+
applyCustomAttributesOnSpan: annotateSpan,
|
|
75
|
+
});
|
|
76
|
+
const documentInstrumentation = new DocumentLoadInstrumentation({
|
|
77
|
+
enabled: false,
|
|
78
|
+
applyCustomAttributesOnSpan: {
|
|
79
|
+
documentLoad: annotateSpan,
|
|
80
|
+
documentFetch: annotateSpan,
|
|
81
|
+
},
|
|
82
|
+
});
|
|
83
|
+
// Bind instruments before enabling so startup requests use this provider immediately.
|
|
84
|
+
for (const instrumentation of [
|
|
85
|
+
fetchInstrumentation,
|
|
86
|
+
xhrInstrumentation,
|
|
87
|
+
documentInstrumentation,
|
|
88
|
+
]) {
|
|
89
|
+
instrumentation.setTracerProvider(provider);
|
|
90
|
+
instrumentation.enable();
|
|
91
|
+
}
|
|
92
|
+
return provider;
|
|
93
|
+
}
|
|
94
|
+
//# sourceMappingURL=enable-dev-server-tracing.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enable-dev-server-tracing.js","sourceRoot":"","sources":["../../../src/html/enable-dev-server-tracing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,KAAK,EAAa,MAAM,oBAAoB,CAAC;AAC3E,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,EAAE,iBAAiB,EAAE,MAAM,yCAAyC,CAAC;AAC5E,OAAO,EAAE,2BAA2B,EAAE,MAAM,8CAA8C,CAAC;AAC3F,OAAO,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAC5E,OAAO,EAAE,6BAA6B,EAAE,MAAM,iDAAiD,CAAC;AAChG,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAErF;;;GAGG;AACH,SAAS,YAAY,CAAC,IAAU;IAC9B,MAAM,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC,kBAAkB,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IACvE,IAAI,CAAC,YAAY,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC;IAC1D,sFAAsF;IACtF,IAAI,MAAM,EAAE,CAAC;QACX,IAAI,CAAC,YAAY,CAAC,gBAAgB,EAAE,kBAAkB,CAAC,MAAM,CAAC,CAAC,CAAC;IAClE,CAAC;AACH,CAAC;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,sBAAsB,CAAC,QAAgB;IACrD,MAA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,sFAAsF;IACtF,KAAK,MAAM,eAAe,IAAI;QAC5B,oBAAoB;QACpB,kBAAkB;QAClB,uBAAuB;KACxB,EAAE,CAAC;QACF,eAAe,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC;QAC5C,eAAe,CAAC,MAAM,EAAE,CAAC;IAC3B,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
package/dist/esm/version.js
CHANGED
package/dist/html/bootstrap.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { c as createErrorClass, _ as __extends, e as errorContext, E as EMPTY_SUBSCRIPTION, S as Subscription, a as arrRemove, O as Observable, b as __values, d as __spreadArray, f as __read, i as isFunction$1, g as SafeSubscriber, h as EmptyError, o as operate, j as executeSchedule, k as innerFrom, l as createOperatorSubscriber, m as map, n as mergeMap, p as identity, q as isArrayLike, r as isScheduler, s as popScheduler, t as popNumber, u as EMPTY, v as from, w as mergeInternals, x as scanInternals, y as noop, z as popResultSelector, A as reduce, B as lastValueFrom, M as ModuleEventLevel, C as filter, D as BaseModuleProvider, F as catchError, G as of, H as object, I as _instanceof, J as _enum, K as string, L as boolean, N as record, P as union, Q as __rest, R as __assign, T as switchMap, U as observeOn, V as deepmerge, W as BaseConfigBuilder, X as TelemetryExceptionSchema, Y as TelemetryItemNames, Z as TelemetryType, $ as TelemetryEventSchema, a0 as TelemetryMetricSchema, a1 as TelemetryCustomEventSchema, a2 as array, a3 as TelemetryLevel, a4 as enableMSAL } from '../module-
|
|
1
|
+
import { c as createErrorClass, _ as __extends, e as errorContext, E as EMPTY_SUBSCRIPTION, S as Subscription, a as arrRemove, O as Observable, b as __values, d as __spreadArray, f as __read, i as isFunction$1, g as SafeSubscriber, h as EmptyError, o as operate, j as executeSchedule, k as innerFrom, l as createOperatorSubscriber, m as map, n as mergeMap, p as identity, q as isArrayLike, r as isScheduler, s as popScheduler, t as popNumber, u as EMPTY, v as from, w as mergeInternals, x as scanInternals, y as noop, z as popResultSelector, A as reduce, B as lastValueFrom, M as ModuleEventLevel, C as filter, D as BaseModuleProvider, F as catchError, G as of, H as object, I as _instanceof, J as _enum, K as string, L as boolean, N as record, P as union, Q as __rest, R as __assign, T as switchMap, U as observeOn, V as deepmerge, W as BaseConfigBuilder, X as TelemetryExceptionSchema, Y as TelemetryItemNames, Z as TelemetryType, $ as TelemetryEventSchema, a0 as TelemetryMetricSchema, a1 as TelemetryCustomEventSchema, a2 as array, a3 as TelemetryLevel, a4 as enableMSAL } from '../module-Xg35JJRU.js';
|
|
2
|
+
import { B as BaseTelemetryAdapter } from '../TelemetryAdapter-B6JH_RXA.js';
|
|
2
3
|
|
|
3
4
|
var ObjectUnsubscribedError = createErrorClass(function (_super) {
|
|
4
5
|
return function ObjectUnsubscribedErrorImpl() {
|
|
@@ -1830,7 +1831,7 @@ async function runDisposePhase(ctx, instance, ref) {
|
|
|
1830
1831
|
}
|
|
1831
1832
|
|
|
1832
1833
|
// Generated by genversion.
|
|
1833
|
-
const version$4 = '6.1.
|
|
1834
|
+
const version$4 = '6.1.5';
|
|
1834
1835
|
|
|
1835
1836
|
// biome-ignore-all lint/suspicious/noExplicitAny: internal type-erased dispatch arrays — callbacks are registered with concrete module types but stored erased; the orchestrator never inspects these shapes itself
|
|
1836
1837
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
@@ -2993,7 +2994,7 @@ class HttpClientConfigurator {
|
|
|
2993
2994
|
}
|
|
2994
2995
|
|
|
2995
2996
|
// Generated by genversion.
|
|
2996
|
-
const version$3 = '8.1.
|
|
2997
|
+
const version$3 = '8.1.3';
|
|
2997
2998
|
|
|
2998
2999
|
/** URL protocols accepted as valid ad-hoc base URIs. */
|
|
2999
3000
|
const SUPPORTED_PROTOCOLS = ['http:', 'https:', 'ws:', 'wss:'];
|
|
@@ -5354,7 +5355,7 @@ class TelemetryConfigurator extends BaseConfigBuilder {
|
|
|
5354
5355
|
}
|
|
5355
5356
|
|
|
5356
5357
|
// Generated by genversion.
|
|
5357
|
-
const version$2 = '7.
|
|
5358
|
+
const version$2 = '7.2.0';
|
|
5358
5359
|
|
|
5359
5360
|
/**
|
|
5360
5361
|
* Represents a framework event with customizable details and behavior.
|
|
@@ -5745,7 +5746,9 @@ const applyMetadata = (metadata, args) => {
|
|
|
5745
5746
|
class TelemetryProvider extends BaseModuleProvider {
|
|
5746
5747
|
#items = new Subject();
|
|
5747
5748
|
#initialized = false;
|
|
5749
|
+
#disposal;
|
|
5748
5750
|
#adapters = {};
|
|
5751
|
+
#handledByChild = new WeakSet();
|
|
5749
5752
|
#filters;
|
|
5750
5753
|
#defaultScope;
|
|
5751
5754
|
#eventProvider;
|
|
@@ -5830,6 +5833,51 @@ class TelemetryProvider extends BaseModuleProvider {
|
|
|
5830
5833
|
this.#items.complete();
|
|
5831
5834
|
});
|
|
5832
5835
|
}
|
|
5836
|
+
/**
|
|
5837
|
+
* Stops telemetry subscriptions and waits for every adapter to flush and shut down.
|
|
5838
|
+
*
|
|
5839
|
+
* Repeated calls share the same completion promise so exporters are shut down only once.
|
|
5840
|
+
* The telemetry module awaits this promise during framework module disposal.
|
|
5841
|
+
*
|
|
5842
|
+
* @returns Resolves after all adapter shutdowns settle.
|
|
5843
|
+
* @throws {AggregateError} When any adapter fails to shut down; all adapters are still attempted.
|
|
5844
|
+
* @example
|
|
5845
|
+
* ```ts
|
|
5846
|
+
* await provider.dispose();
|
|
5847
|
+
* ```
|
|
5848
|
+
*/
|
|
5849
|
+
dispose() {
|
|
5850
|
+
// Direct disposal and module disposal must join the same pending shutdown.
|
|
5851
|
+
if (this.#disposal) {
|
|
5852
|
+
return this.#disposal;
|
|
5853
|
+
}
|
|
5854
|
+
super.dispose();
|
|
5855
|
+
// Defer adapter callbacks until the shared promise is assigned, including reentrant disposal.
|
|
5856
|
+
this.#disposal = Promise.resolve().then(async () => {
|
|
5857
|
+
// Shut down all exporters even when one rejects or throws synchronously.
|
|
5858
|
+
const results = await Promise.allSettled(Object.entries(this.#adapters).map(async ([identifier, adapter]) => {
|
|
5859
|
+
try {
|
|
5860
|
+
await adapter.shutdown?.();
|
|
5861
|
+
}
|
|
5862
|
+
catch (cause) {
|
|
5863
|
+
throw new Error(`Failed to shut down telemetry adapter "${identifier}"`, { cause });
|
|
5864
|
+
}
|
|
5865
|
+
}));
|
|
5866
|
+
const errors = [];
|
|
5867
|
+
// Retain each failure for the module lifecycle's structured disposal error event.
|
|
5868
|
+
for (const result of results) {
|
|
5869
|
+
// Successful shutdowns must not obscure another exporter's failure.
|
|
5870
|
+
if (result.status === 'rejected') {
|
|
5871
|
+
errors.push(result.reason);
|
|
5872
|
+
}
|
|
5873
|
+
}
|
|
5874
|
+
// Reject only after all exporters have had a chance to release their resources.
|
|
5875
|
+
if (errors.length) {
|
|
5876
|
+
throw new AggregateError(errors, 'Failed to shut down telemetry adapters');
|
|
5877
|
+
}
|
|
5878
|
+
});
|
|
5879
|
+
return this.#disposal;
|
|
5880
|
+
}
|
|
5833
5881
|
/**
|
|
5834
5882
|
* Initializes all telemetry adapters that support async initialization.
|
|
5835
5883
|
* Uses Promise.allSettled to ensure all adapters attempt initialization,
|
|
@@ -5879,6 +5927,11 @@ class TelemetryProvider extends BaseModuleProvider {
|
|
|
5879
5927
|
}
|
|
5880
5928
|
// Iterate through all registered adapters
|
|
5881
5929
|
for (const [identifier, adapter] of Object.entries(this.#adapters)) {
|
|
5930
|
+
// Explicit child exporters take precedence over inherited development exporters.
|
|
5931
|
+
if (adapter.fallback && this.#handledByChild.has(item)) {
|
|
5932
|
+
// Keep application-owned records out of parent fallback exporters.
|
|
5933
|
+
continue;
|
|
5934
|
+
}
|
|
5882
5935
|
try {
|
|
5883
5936
|
// Let the adapter process the telemetry item
|
|
5884
5937
|
Promise.resolve(adapter.processItem(item));
|
|
@@ -5910,7 +5963,16 @@ class TelemetryProvider extends BaseModuleProvider {
|
|
|
5910
5963
|
if (relayFilter && !relayFilter(item)) {
|
|
5911
5964
|
return;
|
|
5912
5965
|
}
|
|
5913
|
-
|
|
5966
|
+
// Older/custom providers retain the original track-only relay contract.
|
|
5967
|
+
if (target.trackRelayed) {
|
|
5968
|
+
// Carry exporter ownership across intermediate providers without changing record metadata.
|
|
5969
|
+
const hasAdapters = this.#handledByChild.has(item) ||
|
|
5970
|
+
Object.values(this.#adapters).some((adapter) => !adapter.fallback);
|
|
5971
|
+
target.trackRelayed(item, hasAdapters);
|
|
5972
|
+
}
|
|
5973
|
+
else {
|
|
5974
|
+
target.track(item);
|
|
5975
|
+
}
|
|
5914
5976
|
});
|
|
5915
5977
|
}
|
|
5916
5978
|
/**
|
|
@@ -5967,16 +6029,26 @@ class TelemetryProvider extends BaseModuleProvider {
|
|
|
5967
6029
|
break;
|
|
5968
6030
|
}
|
|
5969
6031
|
}
|
|
6032
|
+
/**
|
|
6033
|
+
* Tracks an already validated child record, suppressing fallback exporters when appropriate.
|
|
6034
|
+
*
|
|
6035
|
+
* @param item - Record emitted by a child telemetry provider.
|
|
6036
|
+
* @param hasAdapters - Whether an explicit child adapter has already handled this record.
|
|
6037
|
+
*/
|
|
6038
|
+
trackRelayed(item, hasAdapters) {
|
|
6039
|
+
this._track(item, hasAdapters);
|
|
6040
|
+
}
|
|
5970
6041
|
/**
|
|
5971
6042
|
* Tracks a telemetry item by merging the default scope with the item's scope (if provided),
|
|
5972
6043
|
* ensuring that all telemetry items have the correct scope context. The merged item is then
|
|
5973
6044
|
* emitted to downstream handlers.
|
|
5974
6045
|
*
|
|
5975
6046
|
* @param item - The telemetry item to be tracked, conforming to the input schema of `TelemetryItemSchema`.
|
|
6047
|
+
* @param handledByChild - Whether fallback adapters should skip this relayed item.
|
|
5976
6048
|
*
|
|
5977
6049
|
* @protected
|
|
5978
6050
|
*/
|
|
5979
|
-
async _track(item) {
|
|
6051
|
+
async _track(item, handledByChild = false) {
|
|
5980
6052
|
const mergedItem = mergeTelemetryItem(item, {
|
|
5981
6053
|
scope: this.#defaultScope,
|
|
5982
6054
|
});
|
|
@@ -5986,11 +6058,19 @@ class TelemetryProvider extends BaseModuleProvider {
|
|
|
5986
6058
|
modules: this.#modules,
|
|
5987
6059
|
item: mergedItem,
|
|
5988
6060
|
}).subscribe((nextItem) => {
|
|
6061
|
+
// Async metadata resolution creates new objects; retain ownership on the emitted record.
|
|
6062
|
+
if (handledByChild) {
|
|
6063
|
+
this.#handledByChild.add(nextItem);
|
|
6064
|
+
}
|
|
5989
6065
|
// Emit the item after applying metadata
|
|
5990
6066
|
this.#items.next(nextItem);
|
|
5991
6067
|
});
|
|
5992
6068
|
}
|
|
5993
6069
|
else {
|
|
6070
|
+
// Providers without metadata still need the same fallback precedence.
|
|
6071
|
+
if (handledByChild) {
|
|
6072
|
+
this.#handledByChild.add(mergedItem);
|
|
6073
|
+
}
|
|
5994
6074
|
// If no metadata extractor is provided or item is TelemetryMetadataError, emit directly
|
|
5995
6075
|
this.#items.next(mergedItem);
|
|
5996
6076
|
}
|
|
@@ -6114,6 +6194,15 @@ const module$2 = {
|
|
|
6114
6194
|
});
|
|
6115
6195
|
return provider;
|
|
6116
6196
|
},
|
|
6197
|
+
/**
|
|
6198
|
+
* Joins exporter shutdown before the framework completes module disposal.
|
|
6199
|
+
* @param args - Module disposal context.
|
|
6200
|
+
* @param args.instance - Telemetry provider whose subscriptions and exporters must be released.
|
|
6201
|
+
* @returns Resolves after the provider finishes disposal.
|
|
6202
|
+
*/
|
|
6203
|
+
dispose: async ({ instance }) => {
|
|
6204
|
+
await instance.dispose?.();
|
|
6205
|
+
},
|
|
6117
6206
|
};
|
|
6118
6207
|
|
|
6119
6208
|
/**
|
|
@@ -8713,7 +8802,7 @@ class ServiceDiscoveryConfigurator extends BaseConfigBuilder {
|
|
|
8713
8802
|
}
|
|
8714
8803
|
|
|
8715
8804
|
// Generated by genversion.
|
|
8716
|
-
const version$1 = '10.1.
|
|
8805
|
+
const version$1 = '10.1.2';
|
|
8717
8806
|
|
|
8718
8807
|
/**
|
|
8719
8808
|
* Default implementation of {@link IServiceDiscoveryProvider}.
|
|
@@ -8876,95 +8965,6 @@ const enableServiceDiscovery = (configurator, callback) => {
|
|
|
8876
8965
|
configurator.addConfig(configureServiceDiscovery(callback ?? (() => Promise.resolve())));
|
|
8877
8966
|
};
|
|
8878
8967
|
|
|
8879
|
-
/**
|
|
8880
|
-
* Abstract base class for telemetry adapters.
|
|
8881
|
-
*
|
|
8882
|
-
* Provides a common implementation for filtering telemetry items before processing.
|
|
8883
|
-
* Subclasses must implement the `_processItem` method to define how telemetry items are handled.
|
|
8884
|
-
*
|
|
8885
|
-
* @template TelemetryItem - The type representing a telemetry item.
|
|
8886
|
-
* @implements {ITelemetryAdapter}
|
|
8887
|
-
*
|
|
8888
|
-
* @remarks
|
|
8889
|
-
* - An optional filter function can be provided to determine which telemetry items should be processed.
|
|
8890
|
-
*
|
|
8891
|
-
* @example
|
|
8892
|
-
* class MyTelemetryAdapter extends BaseTelemetryAdapter {
|
|
8893
|
-
* protected _processItem(item: TelemetryItem): void {
|
|
8894
|
-
* // Custom processing logic
|
|
8895
|
-
* }
|
|
8896
|
-
* }
|
|
8897
|
-
*/
|
|
8898
|
-
class BaseTelemetryAdapter {
|
|
8899
|
-
#filter;
|
|
8900
|
-
#initialized = false;
|
|
8901
|
-
/**
|
|
8902
|
-
* Creates a new instance of the TelemetryAdapter.
|
|
8903
|
-
*
|
|
8904
|
-
* @param filter - An optional function to filter telemetry items. If provided, only items for which the function returns true will be processed.
|
|
8905
|
-
*/
|
|
8906
|
-
constructor(filter) {
|
|
8907
|
-
this.#filter = filter;
|
|
8908
|
-
}
|
|
8909
|
-
/**
|
|
8910
|
-
* Processes a telemetry item by applying an optional filter before handling it.
|
|
8911
|
-
*
|
|
8912
|
-
* If a filter is defined and the item does not pass the filter, the method returns early.
|
|
8913
|
-
* Otherwise, it delegates the processing of the item to the internal `_processItem` method.
|
|
8914
|
-
*
|
|
8915
|
-
* @param item - The telemetry item to be processed.
|
|
8916
|
-
*/
|
|
8917
|
-
processItem(item) {
|
|
8918
|
-
// If the adapter is not initialized, do not process the item
|
|
8919
|
-
if (!this.#initialized) {
|
|
8920
|
-
return;
|
|
8921
|
-
}
|
|
8922
|
-
// If a filter is defined and the item does not pass the filter, do not process the item
|
|
8923
|
-
if (this.#filter && !this.#filter(item)) {
|
|
8924
|
-
return;
|
|
8925
|
-
}
|
|
8926
|
-
// Delegate the processing of the item to the internal `_processItem` method
|
|
8927
|
-
this._processItem(item);
|
|
8928
|
-
}
|
|
8929
|
-
/**
|
|
8930
|
-
* Initializes the telemetry adapter asynchronously.
|
|
8931
|
-
*
|
|
8932
|
-
* This method can only be called once. Subsequent calls will return immediately
|
|
8933
|
-
* without performing any initialization. It calls the protected `_initialize` method which
|
|
8934
|
-
* subclasses can override to provide custom initialization logic.
|
|
8935
|
-
*
|
|
8936
|
-
* TODO(#5112): Consider changing return type from Promise<void> to Promise<TelemetryItem[]>
|
|
8937
|
-
* to allow adapters to return telemetry items (errors/warnings) that occurred during
|
|
8938
|
-
* initialization, eliminating the chicken-and-egg problem with reporting init errors.
|
|
8939
|
-
*
|
|
8940
|
-
* @returns A promise that resolves when initialization is complete.
|
|
8941
|
-
* @sealed
|
|
8942
|
-
*/
|
|
8943
|
-
async initialize() {
|
|
8944
|
-
// If the adapter is already initialized, do not initialize it again
|
|
8945
|
-
if (this.#initialized) {
|
|
8946
|
-
return;
|
|
8947
|
-
}
|
|
8948
|
-
// Initialize the adapter
|
|
8949
|
-
await this._initialize();
|
|
8950
|
-
// Mark the adapter as initialized
|
|
8951
|
-
this.#initialized = true;
|
|
8952
|
-
}
|
|
8953
|
-
/**
|
|
8954
|
-
* Protected initialization method that subclasses can override.
|
|
8955
|
-
*
|
|
8956
|
-
* This method is called only once during the adapter's lifetime.
|
|
8957
|
-
* Subclasses should override this method to perform any necessary async setup.
|
|
8958
|
-
* The base implementation is a no-op for adapters that don't need initialization.
|
|
8959
|
-
*
|
|
8960
|
-
* @returns A promise that resolves when initialization is complete.
|
|
8961
|
-
* @protected
|
|
8962
|
-
*/
|
|
8963
|
-
async _initialize() {
|
|
8964
|
-
// Default implementation - no-op for adapters that don't need initialization
|
|
8965
|
-
}
|
|
8966
|
-
}
|
|
8967
|
-
|
|
8968
8968
|
/**
|
|
8969
8969
|
* Telemetry adapter that outputs telemetry data to the browser console
|
|
8970
8970
|
* with formatted titles and colour-coded log levels.
|
|
@@ -9402,7 +9402,7 @@ async function registerServiceWorker(framework) {
|
|
|
9402
9402
|
}
|
|
9403
9403
|
|
|
9404
9404
|
// Generated by genversion.
|
|
9405
|
-
const version = '5.
|
|
9405
|
+
const version = '5.2.0';
|
|
9406
9406
|
|
|
9407
9407
|
// Allow dynamic import without vite
|
|
9408
9408
|
const importWithoutVite = (path) => import(/* @vite-ignore */ path);
|
|
@@ -9422,7 +9422,7 @@ enableServiceDiscovery(configurator, async (builder) => {
|
|
|
9422
9422
|
});
|
|
9423
9423
|
// Avoid interactive Entra ID authentication when the SPA runs in CI or Playwright.
|
|
9424
9424
|
if (isEnabledEnvValue(import.meta.env.FUSION_SPA_MSAL_MOCK)) {
|
|
9425
|
-
const { enableMsalMock } = await import('../index-
|
|
9425
|
+
const { enableMsalMock } = await import('../index-CDpTfyge.js');
|
|
9426
9426
|
const mockServerUrl = import.meta.env.FUSION_SPA_MSAL_MOCK_SERVER_URL;
|
|
9427
9427
|
enableMsalMock(configurator, (builder) => {
|
|
9428
9428
|
// The SPA owns the HTTP adapter; MSAL owns applying the returned token and account.
|
|
@@ -9443,6 +9443,19 @@ else {
|
|
|
9443
9443
|
builder.setRequiresAuth(isEnabledEnvValue(import.meta.env.FUSION_SPA_MSAL_REQUIRES_AUTH));
|
|
9444
9444
|
});
|
|
9445
9445
|
}
|
|
9446
|
+
// Initialize tracing before app startup so network requests and logs share active trace context.
|
|
9447
|
+
if (import.meta.env.FUSION_SPA_TELEMETRY_OTLP_TRACES_ENDPOINT) {
|
|
9448
|
+
const { enableDevServerTracing } = await import('../enable-dev-server-tracing-DaQc5M9V.js');
|
|
9449
|
+
enableDevServerTracing(new URL(import.meta.env.FUSION_SPA_TELEMETRY_OTLP_TRACES_ENDPOINT, window.location.origin).href);
|
|
9450
|
+
}
|
|
9451
|
+
// The dev-server environment bridge owns activation; the SPA only consumes its endpoint.
|
|
9452
|
+
const devServerOtlpAdapter = import.meta.env.FUSION_SPA_TELEMETRY_OTLP_ENDPOINT
|
|
9453
|
+
? new (await import('../index-BO_d5C6N.js')).OtlpAdapter({
|
|
9454
|
+
url: new URL(import.meta.env.FUSION_SPA_TELEMETRY_OTLP_ENDPOINT, window.location.origin).href,
|
|
9455
|
+
fallback: true,
|
|
9456
|
+
serviceName: 'fusion.dev-server',
|
|
9457
|
+
})
|
|
9458
|
+
: undefined;
|
|
9446
9459
|
enableTelemetry(configurator, {
|
|
9447
9460
|
attachConfiguratorEvents: true,
|
|
9448
9461
|
configure: (builder) => {
|
|
@@ -9451,6 +9464,10 @@ enableTelemetry(configurator, {
|
|
|
9451
9464
|
filter: Number.isNaN(consoleLevel) ? undefined : (item) => item.level >= consoleLevel,
|
|
9452
9465
|
});
|
|
9453
9466
|
builder.setAdapter('console', consoleAdapter);
|
|
9467
|
+
// Only the dev-server environment bridge opts the shell into OTLP export.
|
|
9468
|
+
if (devServerOtlpAdapter) {
|
|
9469
|
+
builder.setAdapter('dev-server-otlp', devServerOtlpAdapter);
|
|
9470
|
+
}
|
|
9454
9471
|
builder.setMetadata(({ modules }) => {
|
|
9455
9472
|
const metadata = {
|
|
9456
9473
|
fusion: {
|