mochi-mqtt / server

The fully compliant, embeddable high-performance Go MQTT v5 server for IoT, smarthome, and pubsub
MIT License
1.3k stars 223 forks source link

Metrics #413

Closed perbu closed 4 months ago

perbu commented 5 months ago

Hi.

I'm building a custom broker based off of mochi-mqtt. One things I'm adding is prometheus metrics. I'm doing this in a plugin. A couple of questions arise.

Should I contribute this work? I guess it would end up in the hooks repo. The downside of doing it in a plugin is that there is a bit higher setup-cost and a higher CPU and memory overhead (you have to track clients two places, etc). So, if y'all are planning native metrics support (the README says it is on the roadmap) there is no point in building a nice metric-plugin.

All the best,

Per.

perbu commented 5 months ago

There are some hooks that I think might make sense. Specifically hooks that are called on various errors.

dgduncan commented 5 months ago

@perbu I think implementing this with hooks in the hooks repository makes the most sense. I can’t speak for everyone, but I do not think the native metrics are being actively worked on at the moment. Most of us use the stats topic or listener.

I believe there was a PR that was closed recently due to inactivity that was implementing something similar if you would like to look at that for inspiration.

perbu commented 5 months ago

Thanks! I'll link these for posterity;

perbu commented 4 months ago

I've got the answers I wanted, thanks.

If I can whip the plugin into acceptable shape I'll contribute it in the plugin repo.