Skip to content

Commit 0a3b58c

Browse files
Maurice PetersMaurice Peters
authored andcommitted
Frontend OTel: add switch to disable CDN via meta/flag; disable CDN in Conduit index.html to rely on local shim (no external requests)
1 parent 13a22d4 commit 0a3b58c

2 files changed

Lines changed: 13 additions & 0 deletions

File tree

Abies.Conduit/wwwroot/index.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
<meta name="viewport" content="width=device-width, initial-scale=1.0">
1010
<!-- Aspire: point browser OTLP exporter to API proxy to avoid CORS -->
1111
<meta name="otlp-endpoint" content="http://localhost:5179/otlp/v1/traces">
12+
<!-- Disable CDN imports for OpenTelemetry; use local shim -->
13+
<meta name="otel-cdn" content="off">
1214
<!-- Local Conduit CSS to avoid CORS errors -->
1315
<link rel="stylesheet" href="css/main.css" />
1416
<link href="https://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css" rel="stylesheet" type="text/css" crossorigin="anonymous">

Abies/wwwroot/abies.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,17 @@ let SpanStatusCode = { OK: 1, ERROR: 2 };
1717
void (async () => {
1818
try {
1919
const otelInit = (async () => {
20+
// Allow disabling CDN-based OTel via flag or meta tag
21+
const useCdn = (() => {
22+
try {
23+
if (window.__OTEL_USE_CDN === false) return false;
24+
const m = document.querySelector('meta[name="otel-cdn"]');
25+
const v = (m && m.getAttribute('content')) || '';
26+
if (v && v.toLowerCase() === 'off') return false;
27+
} catch {}
28+
return true;
29+
})();
30+
if (!useCdn) throw new Error('OTel CDN disabled');
2031
// Try to load the OTel API first; if it fails, keep using no-op
2132
let api;
2233
try {

0 commit comments

Comments
 (0)