Skip to content
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

Opentelemetry support for tracing request #2888

Open
EndyCZ opened this issue Sep 5, 2023 · 2 comments
Open

Opentelemetry support for tracing request #2888

EndyCZ opened this issue Sep 5, 2023 · 2 comments

Comments

@EndyCZ
Copy link

EndyCZ commented Sep 5, 2023

Hello everyone,

I was wondering whether it is possible to enable mosquitto MQTT broker to support tracing with open telemetry standard which would bring a lot of benefit for monitoring and tracing request in distributed systems especialy in IoT enviroment and microservices that uses MQTT as communication broker.

Looking at the following standards.

https://opentelemetry.io/
which are using following standards
https://www.w3.org/TR/trace-context/
And specificaly for MQTT https://w3c.github.io/trace-context-mqtt/

There are multiple stuff to implement to completely support the opentelemetry standard but the main one which I am asking is to implement the context propagation mechanism.

https://opentelemetry.io/docs/concepts/signals/traces/#context-propagation

Also on this site I found a nice picture about MQTT and Opentelemetry. https://www.hivemq.com/article/opentelemetry-distributed-tracing-mqtt-messages-iot-observability-apm/

Any feedback whether this is already in backlog?

Thanks a lot for any response. :)

@NorbertHeusser
Copy link
Contributor

NorbertHeusser commented Sep 13, 2023

Not sure, what you are looking for. Taking a look especially into the referenced document (https://w3c.github.io/trace-context-mqtt/ there seems to be a well defined way how the required information got propagated over an MQTT Broker (at least for MQTTv5). As Mosquitto does support Custom properties the information should be propagated through the Mosquitto (if the publisher add the custom properties).

If you want the broker to emit trace messages bout the processing of messages having these custom properties attached the easiest way would be to implement a plugin emitting these trace messages. Register for the MOSQ_EVT_MESSAGE_IN and MOSQ_EVT_MESSAGE_OUT event should be sufficient to inspect the all incoming/outgoing messages for the properties defined in the spec and emit a trace info.
Not sure, if there plugin events are already available on the master branch. So you might have to start on the develop branch.

@EndyCZ
Copy link
Author

EndyCZ commented Sep 15, 2023

Oh, thanks a lot. So basicaly if the MQTT client already supports opentelemetry and is using the MQTTv5 he will add the needed custom properties and mosquitto will just propage the custom properties to subscribers. I did not realize that. I will test functionality for tracing the request. Thanks a lot for the hint.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants