hivemq-mqtt-client icon indicating copy to clipboard operation
hivemq-mqtt-client copied to clipboard

W3C trace context propagation and OpenTracing / OpenTelemetry support

Open frittentheke opened this issue 4 years ago • 4 comments

Problem or use case

While distributed systems are already a pain to debug, adding asynchronicity as with MQTT makes things even harder. More and more tools add OpenTracing (or later OpenTelemetry) capabilities to their code. While this comes quite natural to HTTP with its headers, it is not limited to be used via HTTP.

The W3C trying to standardize the way the context is propagated via MQTT in https://github.com/w3c/trace-context-mqtt

Would you kindly consider adding

Initially: Context Propagation (receive, forward and emit a new trace context - to NOT be a blackhole to tracing)

Later: Native support to add a spans / metadata to traces.

Preferred solution or suggestions

W3C is already working on a standard: https://github.com/w3c/trace-context-mqtt

frittentheke avatar Mar 11 '20 13:03 frittentheke

With OpenTelemetry going beta we could make use of this new standard. It supports W3C headers out of the box. We would only have to add the OpenTelementry API as a dependency and set two user properties, given that MQTT 5 is used. No API change is required. It will also work if the application does not use OpenTelemetry.

fischerman avatar Mar 17 '20 14:03 fischerman

I had a quick browse through the code and the change seems to be more complicated than anticipated due to the different API flavors and the enormous level of indirectness (builders, many layers of inheritance, ...), which I guess is in the nature of Java.

Any pointers w.r.t. the right place to inject / extract the context is appreciated. I might be able to piece up a pull request.

fischerman avatar Mar 19 '20 14:03 fischerman

@SgtSilvio @dobermai The W3C has now moved this to a draft status (https://w3c.github.io/trace-context-mqtt/) with Sergey Kanzhelev (Google) and Clemens Vasters (Microsoft) as editors.

frittentheke avatar Feb 11 '21 07:02 frittentheke

Any update here?

cforce avatar Nov 20 '23 10:11 cforce