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

Function parseOtlpHeaders

apps/sim/lib/monitoring/otlp.ts:7–27  ·  view source on GitHub ↗
(raw: string)

Source from the content-addressed store, hash-verified

5 * @see https://opentelemetry.io/docs/specs/otel/protocol/exporter/
6 */
7export function parseOtlpHeaders(raw: string): Record<string, string> {
8 const out: Record<string, string> = {}
9 if (!raw) return out
10 for (const part of raw.split(',')) {
11 const trimmed = part.trim()
12 if (!trimmed) continue
13 const eq = trimmed.indexOf('=')
14 if (eq <= 0) continue
15 const key = trimmed.slice(0, eq).trim()
16 if (!key) continue
17 const rawVal = trimmed.slice(eq + 1).trim()
18 let val = rawVal
19 try {
20 val = decodeURIComponent(rawVal)
21 } catch {
22 // value wasn't URL-encoded; keep as-is.
23 }
24 out[key] = val
25 }
26 return out
27}

Callers 2

initializeOpenTelemetryFunction · 0.90
trigger.config.tsFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected