Skip to content

Commit 2b5221f

Browse files
Maurice PetersMaurice Peters
authored andcommitted
Frontend OTel: read meta otlp-endpoint; set endpoint in Conduit index.html to API proxy for Aspire
1 parent df3fbbb commit 2b5221f

2 files changed

Lines changed: 8 additions & 0 deletions

File tree

Abies.Conduit/wwwroot/index.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
<base href="/">
88
<meta charset="UTF-8">
99
<meta name="viewport" content="width=device-width, initial-scale=1.0">
10+
<!-- Aspire: point browser OTLP exporter to API proxy to avoid CORS -->
11+
<meta name="otlp-endpoint" content="http://localhost:5179/otlp/v1/traces">
1012
<!-- Local Conduit CSS to avoid CORS errors -->
1113
<link rel="stylesheet" href="css/main.css" />
1214
<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: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,12 @@ void (async () => {
3535
const guessOtlp = () => {
3636
// Allow explicit global override
3737
if (window.__OTLP_ENDPOINT) return window.__OTLP_ENDPOINT;
38+
// Allow per-app meta override: <meta name="otlp-endpoint" content="https://collector:4318/v1/traces">
39+
try {
40+
const meta = document.querySelector('meta[name="otlp-endpoint"]');
41+
const v = meta && meta.getAttribute('content');
42+
if (v) return v;
43+
} catch {}
3844
// Prefer a same-origin proxy to avoid CORS issues with collectors
3945
try { return new URL('/otlp/v1/traces', window.location.origin).href; } catch {}
4046
// Fallback to common local collector endpoints

0 commit comments

Comments
 (0)