(url: string)
| 53 | // The HTTP exporter doesn't auto-suffix the signal path even though |
| 54 | // the spec says the env var is a base URL. |
| 55 | function normalizeOtlpTracesUrl(url: string): string { |
| 56 | if (!url) return url |
| 57 | try { |
| 58 | const u = new URL(url) |
| 59 | if (u.pathname.endsWith('/v1/traces')) return url |
| 60 | const base = url.replace(/\/$/, '') |
| 61 | return `${base}/v1/traces` |
| 62 | } catch { |
| 63 | return url |
| 64 | } |
| 65 | } |
| 66 | |
| 67 | // Metrics counterpart to `normalizeOtlpTracesUrl`. Operates on the parsed |
| 68 | // pathname (not a raw string suffix) so query strings and trailing slashes |
no test coverage detected