Repository navigation
feat(attributes): Add WebSocket span name convention - #836
Conversation
Add a span name convention for the websocket op, built from the namespace (messaging.destination.name) and the event name. Add messaging.websocket.event.name to hold the event or message pattern, since no messaging attribute covers it. Requested in getsentry/sentry-javascript#26768, which names NestJS WebSocket spans WS <namespace> <pattern>. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Semver Impact of This PR🟡 Minor (new features) 📋 Changelog PreviewThis is how your changes will appear in the changelog. New Features ✨
🤖 This preview updates automatically when you update the PR. |
Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
Hate to be that guy but AFAICT, the messaging namespace is mostly reserved to queues/topic messaging systems. Which I don't think websockets really can be categorized as.
For example, OTel says about messaging.destination.name
SHOULD uniquely identify a specific queue, topic or other entity within the broker.
Something else to consider, adding messaging.* attributes might make it easier for WS spans to slip into queue dashboard widgets (assuming we or users don't filter on span ops)
WDYT about adding our own websocket.* namespaced attributes? As long as there's no OTel standard, I think this should be fine. Very open to hearing other opinions on this though, so please feel free to disagree with me 😅
|
@Lms24 I went with No strong feelings here. Happy to switch to |
messaging.* is meant for queues and topics, and a WebSocket namespace is not a broker entity. Use websocket.namespace and websocket.event.name instead and move the span name convention to model/name/websocket.json. Span names stay WS <namespace> <event>. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Lms24
left a comment
There was a problem hiding this comment.
thanks for making the namespace changes! Can we also add a span description rule for the spans?
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…Socket spans Follows the WebSocket span convention from getsentry/sentry-conventions#836, whose name and description templates are built from these attributes. Dynamic namespaces stay unset so the concrete child namespace doesn't end up in descriptions. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…Socket spans Follows the WebSocket span convention from getsentry/sentry-conventions#836, whose name and description templates are built from these attributes. Dynamic namespaces stay unset so the concrete child namespace doesn't end up in descriptions. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Adds a span name convention for the
websocketop, plus two new attributes:websocket.namespaceandwebsocket.event.name.Names follow what getsentry/sentry-javascript#26768 already emits for NestJS gateways:
WS {{websocket.namespace}} {{websocket.event.name}}, e.g.WS /chat messageWS {{websocket.event.name}}, e.g.WS joinRoomWebSocket messageThe span description rule uses the same attributes without the
WSprefix, e.g./chat messageorjoinRoom.OTel has no WebSocket semantic conventions. Its socket.io instrumentation reuses
messaging.*, butmessaging.*is meant for queues and topics, and a WebSocket namespace isn't a broker entity. A separatewebsocket.*namespace also keeps WebSocket spans out of queue data. It isn't tied to socket.io, because NestJS also supports plainws, which has no namespaces.Both attributes use
manualscrubbing. Event names are developer-defined strings, and namespaces can be dynamic (e.g./tenant-123), so user-configured rules can still apply.Refs getsentry/sentry-javascript#26768
🤖 Generated with Claude Code