Rumqtt release R18: Traceability, metering and native-TLS support
Overview
You cannot improve something you don't see or understand. MQTT brokers often handle thousands of device connections and millions of message pushes every day. This is why it is important to be able to see inside a broker and figure out what’s going on, and we realised that visibility into our broker's internal state is as important as any other feature.
Rich monitoring capabilities can provide a holistic understanding of the flow of data and allow users to make fine improvements. Keeping this in mind, we have made a lot of improvements to rumqtt in release 18.
The last release added new internals to our broker rumqttd. With this release, we add more visibility to its internals - focussing on its traceability and metering capability. Going forward we’ll build on top of these features to provide robust monitoring capabilities. Expect more frequent releases, our roadmap is packed with good stuff!
What’s changed
Traceability in rumqttd 🔍
Treating logs as a first class citizen is a key part of increasing the system's visibility. To that end, tracing support has now been added to rumqttd. This allows logs to have context and structure while being emitted in human-readable format.
From the tokio blog,
Effectively developing systems and operating them in production requires visibility into their behavior at runtime.
... tracing is a collection of libraries that provide a framework for instrumenting Rust programs to collect structured, context-aware, event driven diagnostics.
With hundreds and thousands of devices connected to a broker, finding debug information about a particular client can be very challenging. In production there are either not enough logs or a lot of logs! Tracing support with dynamic log filtering makes this scenario extremely easy to deal with.
Every log line emitted by rumqttd now contains contextual information and machine readable fields. This means that logs can be used effectively with other programs and we can filter logs based on a particular client, topic, tenants, and much more.
Old logs:
08:55:42 [INFO ] (2 ) rumqttd::router::routing : test-1 [I] connect id =
108:55:42 [INFO ] (2 ) rumqttd::router::routing : test-1 [I] subscribe filter = hello/world
New logs:
2022-11-21T08:57:13.147116Z INFO rumqttd::router::routing: Adding subscription on topic hello/world in
rumqttd::router::routing::subscribe with topic: "hello/world", pkid: 1 in
rumqttd::router::routing::incoming_payload with client_id: "test-1" in
rumqttd::router::routing::[>] incoming with connection_id: 1
Quick demo:
Metering in rumqttd 🎰
rumqttd can now collect metrics about connections, topics and subscriptions. This allows the end-user to obtain quantitative data like data usage, throughput, active number of connections, etc. to name a few.
This feature lays groundwork for robust monitoring. It allows rumqttd to integrate with third party monitoring solutions like Prometheus or Datadog, usage based billing solutions like Chargebee or Stripe, or custom use cases like throttling devices based on usage limits using MetersLink (example).
We plan on releasing integrations with your favourite monitoring systems like Prometheus soon!
Native TLS support in rumqttc 🔒
Previously rumqttc could only be compiled with rustls - which certain embedded targets did not support. It also lacked support for some old cipher suites. native-tls support has now landed in rumqttc and it solves these problems! rumqttd has had support for native-tls for a while now and this has been a long requested feature for rumqttc.
Learn more
With this release we’ve taken a step towards better monitoring and observability of rumqtt. We’ve also added many bug fixes and other little improvements too. For more details on this release you can have a look at the release notes and full changelog can be found at R17...R18.
We believe in the OSS philosophy and encourage contributions of all sizes! Please show us some love by ⭐️ing the project on GitHub. Better still, raise a pull request! You can also join our Discord server and follow our development cycle closely.