zone-eu / zone-mta

📤 Modern outbound MTA cross platform and extendable server application
European Union Public License 1.2
583 stars 93 forks source link

Scrape metrics via prometheus for each zone #373

Open rjnz2023 opened 4 months ago

rjnz2023 commented 4 months ago

I was curious to know if there was a way to scrape metrics based on each zone via Prometheus. I know you can scrape it as a whole through /metrics endpoint, but is there a query we can do to get per-zone metrics by specific the zone in the query parameter?

If not, does anyone know how we can probably go about coding this and potentially making a pull request? Any guidance would be appreciated.

andris9 commented 4 months ago

The problem with Zone-MTA, in this case, is that it is a multi-process application. The primary process forks a bunch of worker processes, and all "action" happens in these forked processes. You can not ask for metrics from each process individually, so to get numbers to Prometheus output you would have to send counter updates from child processes to the main process that then would gather these values and generate the aggregated metrics output. Current metrics are defined here.