imaginary icon indicating copy to clipboard operation
imaginary copied to clipboard

Prometheus monitoring integration

Open panzerdev opened this issue 9 years ago • 3 comments

For monitoring the performance in a Prometheus monitored environment the code needs to be instrumented.

What would you think about adding this? I'd like to contribute to this as well.

panzerdev avatar Jan 03 '17 06:01 panzerdev

That would depend on what kind of monitoring you require. You can achieve this at multiple level, but basically programmatically or via standard HTTP logging already provided by imaginary.

The first one you would need to instrument Go code with Prometheus API client. I did a similar thing in the past for several metrics engines, such as InfluxDB. My approach was to write a custom http.Handler as a generic middleware that inspects and tracks incoming/outgoing HTTP traffic. If you require more low-level details, you can apply the same strategy at image processing engine level, just around bimg API calls.

This approach would require you to fork the project and maintain your own project. I don't have plans to overload imaginary with that functionality since imaginary was designed to be used a black-box service with minimal setup overhead and providing a simple ABI (instead of a programmatic API, which typically encourages more hackability).

Alternatively, the standard logging output approach would be the most convenient if you want to rely on the standard imaginary project without maintaining your own fork and without hacking it. That would be for sure less versatile and would only monitor basic HTTP scope data. The current logging implements the Apache log format, which includes typical data about each HTTP transaction, including response time, which I guess would be the most sensitive from a performance perspective.

h2non avatar Jan 03 '17 14:01 h2non

In case someone else is interested in this, I've written a simple prometheus exporter for imaginary. It only includes the metrics already available under /health, but converts them to a format prometheus can understand. You could also use something more generic such as this project for the conversion.

marcfrederick avatar Feb 24 '21 20:02 marcfrederick

Hey @h2non, Do we have any plans for setting up the basic metrics(prometheus or something else) for imaginary that could include HTTP requests, response P99, Transformation count etc Let it me know if this is already a plan, I can quickly setup the basic setup for the prometheus metrics for the same.

vaibsharma avatar Jun 08 '23 10:06 vaibsharma