-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Requirement: Support for additonal metadata such as OpenTelemetry/TracingContext in WebSocket Messages #30
Comments
@RobWin wrote:
This is very interesting but seems like a big topic and I don't think I understand all the use cases. Would any of these use cases be solved by the There aren't currently any requirements around observability/traceability in the Use Cases & Requirements document. That is intended to be a living document though so that doesn't mean we couldn't add new requirements if there's a lot of demand for these features. That would require writing some new use cases & requirements in the style used in that document, and sufficient support for adding them. Similarly there aren't any requirements around Quality of Service, which I'm conscious is something people may care about that WebSockets don't provide on their own, and may be related to this and the As far as referencing other specifications goes it's appealing that Trace Context is an existing W3C Recommendation that we could reference and I note that there is a precedent in the MQTT v3 serialisation of the trace context protocol for serialising the metadata in JSON. That would be easy for us to re-use in Web Thing Protocol messages, e.g. {
...
"traceparent": "00-0af7651916cd43dd8448eb211c80319c-b7ad6b7169203331-01",
"tracestate": "congo=BleGNlZWRzIHRohbCBwbGVhc3VyZS4"
} I'm not sure whether the OpenTelemetry specifications by the Cloud Native Computing Foundation would be referenceable in a normative W3C specification. Are OpenTelemetry and W3C Trace Context competing or overlapping specifications, or are they used together? |
OpenTelemetry and W3C Trace Context are complementary, not competing, specifications. OpenTelemetry is an open-source, vendor-neutral observability framework designed to collect, process, and export traces (and also metrics, and logs). It provides the tooling (e.g., SDKs and APIs) needed to instrument and monitor distributed systems. W3C Trace Context, on the other hand, is a standardized way to propagate trace information (e.g., traceparent and tracestate headers) across services. OpenTelemetry uses W3C Trace Context as its default propagator. Use Case for Trace Context in W3C Web Thing Protocol: In a smart home ecosystem, W3C Trace Context would enable end-to-end tracing of a user request, such as turning on a light via a mobile app. The mobile app generates a traceparent header containing a unique trace ID and span ID, which propagates through the cloud service, home gateway, and eventually to the smart device (e.g., the light bulb). Each component updates the trace context with new span IDs to represent its role in the request. This propagation ensures that the request’s journey, including latencies and failures at each step, can be traced seamlessly across the distributed system. Developers gain the visibility needed to debug issues, optimize performance, and monitor the system’s behavior as a whole. Reading Trace Context:
Writing Trace Context:
Benefit: If missing: Proposed Requirement for W3C Web Thing Protocol: |
Summary: Detailed explanation: Message ID, W3C Trace ID, and W3C Span ID all serve to identify and track requests across distributed systems.
Span ID and Correlation ID are also both used in distributed systems, but they serve different purposes. Span IDs form a tree-like structure and can have a parent-child relationship with other spans. TraceId and SpanId are serialized into headers like traceparent and tracestate. traceparent Header:The The format of
Example
|
Description:
In modern distributed systems, observability and tracing are crucial for debugging, performance monitoring, and understanding the flow of requests across multiple services. OpenTelemetry and W3C Trace Context provide a standardized approach for tracing and capturing metadata about requests, enabling better visibility into the system's behavior.
As Thing Clients and Thing Servers communicate over WebSockets in the WebThing protocol, it's important to provide support for injecting tracing context into individual WebSocket messages. This would allow consumers and servers to track the flow of messages across various components and gain better insights into performance and errors.
Proposal:
I propose adding support for additonal metadata, such as OpenTelemetry/TracingContext, to WebSocket messages in the WebThing protocol. This would enable the transmission of trace context as metadata, allowing tools and observability systems to correlate events, measure latencies, and track the health of interactions between Thing Clients and Thing Servers.
Why Tracing Context is Needed:
Suggested Changes:
traceContext
(ormetadata
), that holds the OpenTelemetry-compatible trace information.Example:
When a Thing Client sends a message to a Thing Server, the message could include trace metadata:
This trace context would allow both the Thing Server and external observability systems to correlate the message with other services in the distributed system, providing a clearer picture of the request lifecycle.
Benefits:
Next Steps:
The text was updated successfully, but these errors were encountered: