OpenTelemetryServerSSEOptions
Options for the SSE transport — the shared options with the stream handle in responseHook.
@defjs/opentelemetry-server · Type
Signature
type OpenTelemetryServerSSEOptions = OpenTelemetryServerTransportOptions< EventStreamHandle<unknown> >;
Set on sse in OpenTelemetryServerOptions. It has no fields of its own: enabled, startSpanHook, requestHook and responseHook come from OpenTelemetryServerTransportOptions.
-
responseHook(span, stream, req)runs once the stream has opened, before the span recordssse.connected.streamis theEventStreamHandlethe transport returned;reqis the originalHttpRequest. -
SSE is traced at connection level. After startup the span stays open until
stream.closedsettles, and recordssse.connected, then one ofsse.closed(server EOF),sse.aborted(stream.close()or a caller abort of the open stream whose reason is notTimeoutError; the span still ends without error), orsse.error(including an abort whose reason isTimeoutError, which ends the spanERROR). No per-event spans are created. -
A non-2xx handshake is observed as a connection failure: the span ends
ERRORand, with alogger, oneWARNis emitted whatever the response body.
Pass { enabled: false } to skip SSE instrumentation. Span hooks run only when a tracer is supplied.