(url: string)
| 69 | // don't corrupt the result: swap a `/v1/traces` suffix for `/v1/metrics`, |
| 70 | // otherwise append `/v1/metrics`. |
| 71 | function normalizeOtlpMetricsUrl(url: string): string { |
| 72 | if (!url) return url |
| 73 | try { |
| 74 | const u = new URL(url) |
| 75 | const path = u.pathname.replace(/\/$/, '') |
| 76 | if (path.endsWith('/v1/metrics')) return url |
| 77 | u.pathname = path.endsWith('/v1/traces') |
| 78 | ? path.replace(/\/v1\/traces$/, '/v1/metrics') |
| 79 | : `${path}/v1/metrics` |
| 80 | return u.toString() |
| 81 | } catch { |
| 82 | return url |
| 83 | } |
| 84 | } |
| 85 | |
| 86 | // deployment.environment in the GO value space (dev | staging | prod) without |
| 87 | // any new infra env var. Every deployed Sim tier already gets |
no test coverage detected