MCPcopy Index your code
hub / github.com/simstudioai/sim / normalizeOtlpMetricsUrl

Function normalizeOtlpMetricsUrl

apps/sim/instrumentation-node.ts:71–84  ·  view source on GitHub ↗
(url: string)

Source from the content-addressed store, hash-verified

69// don't corrupt the result: swap a `/v1/traces` suffix for `/v1/metrics`,
70// otherwise append `/v1/metrics`.
71function 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

Callers 1

initializeOpenTelemetryFunction · 0.85

Calls 2

replaceMethod · 0.65
toStringMethod · 0.45

Tested by

no test coverage detected