otel_web_socket_channel 0.1.0 copy "otel_web_socket_channel: ^0.1.0" to clipboard
otel_web_socket_channel: ^0.1.0 copied to clipboard

OpenTelemetry instrumentation for `package:web_socket_channel`. Wraps a channel to emit a connection-lifetime span, opt-in per-frame events and `messaging.*` semconv attributes.

Changelog #

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.

0.1.0 - 2026-08-10 #

Added #

  • OTelWebSocketChannel — wraps any WebSocketChannel and opens a single connection-lifetime CLIENT span. Sets messaging.system=websocket, url.* / server.* info, the negotiated subprotocol, and close-code / close-reason on the way out.
  • Connection-failure path: if the inner channel's ready future errors, the span is flipped to Error via recordException + setStatus(Error) in OTel-spec order.
  • Stream-error path: an error on the inbound stream also marks the span Error and surfaces error.type.
  • OTelWebSocketChannel.connect(uri) factory: convenience that calls WebSocketChannel.connect and wraps the result.
  • Per-frame events (opt-in via recordFrames: true): each sink.add and inbound message emits a websocket.send / websocket.receive child span carrying frame type and size.
  • WebSocketSemantics — typed attribute-key enum implementing OTelSemantic, package-local pending the upstream OTel messaging-spec websocket sub-spec.
  • runWithoutWebSocketInstrumentation / runWithoutWebSocketInstrumentationAsync — zone-scoped suppression helpers, mirroring dartastic_grpc_otel and dartastic_http_otel. Preemptive: the dartastic SDK doesn't use websockets for export today, but log streaming over websockets is a plausible future and the recursion shape would be identical.
  • 5 unit tests pin: happy path with full attribute set + close codes, server-initiated close, handshake failure, per-frame spans (both text + binary), and the suppression scope.
0
likes
160
points
71
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

OpenTelemetry instrumentation for `package:web_socket_channel`. Wraps a channel to emit a connection-lifetime span, opt-in per-frame events and `messaging.*` semconv attributes.

Homepage
Repository (GitHub)
View/report issues

License

Apache-2.0 (license)

Dependencies

dartastic_opentelemetry, dartastic_opentelemetry_api, stream_channel, web_socket_channel

More

Packages that depend on otel_web_socket_channel