You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(telemetry): W3C trace context extraction and SSE/transport observability (#416)
* feat(telemetry): extract W3C trace context from upstream and add SSE/transport observability
- Call propagation.extract() in middleware so server span becomes a child
of the upstream gateway (Envoy) span, connecting distributed traces
- Rename server span to 'http.server.request' (OTel/Datadog convention)
- Add http.transport (sse|jsonrpc) attribute: GET /mcp = SSE long-lived
stream, everything else = one-shot JSON-RPC
- Add http.response.close_reason (completed|client_disconnect): tracks
which event fired first — finish (server-side complete) vs close
(client disconnect), making SSE max-stream timeouts distinguishable
from genuine app slowness that triggers envoy upstream_rq_timeout alerts
- Add mcp.sse.connection.duration histogram (seconds) for SSE connection
lifetime, separate from http.server.request.duration to avoid SSE
long-tail skewing the one-shot request distribution
- Expand propagator to CompositePropagator([W3CTraceContext, W3CBaggage])
- Add deployment.environment resource attribute (OTEL_DEPLOYMENT_ENVIRONMENT)
* refactor(telemetry): collapse closeReason intermediate to a single mutable
- Default closeReason to 'completed' instead of undefined; the close
listener flips it to 'client_disconnect' only when relevant
- Drop the finalCloseReason intermediate const and the ?? 'completed'
fallback — they were tracking the same logical state
- finish listener becomes a bare flush reference; close listener stays
a small arrow that mutates before flushing
flushOnce() in the flush function continues to guard against double
emission, so a close-after-finish overwrite never reaches a downstream
consumer.
* refactor(telemetry): extract createDefaultPropagator helper
Centralize the W3C TraceContext + Baggage composite propagator chain
so test setup and initTelemetry register the exact same propagator —
preventing drift where one side adds a propagator the other lacks.
0 commit comments