unbit / uwsgi

uWSGI application server container
http://projects.unbit.it/uwsgi
Other
3.46k stars 691 forks source link

Add prometheus exporter #1733

Open aperigault opened 6 years ago

aperigault commented 6 years ago

Hello,

For now uWSGI expose a http port with uWSGI stats in json format. To send that stats in prometheus we need to develop a prometheus exporter that read this stats and expose another http port with the same metrics in a different format. It could be usefull to add an option to replace uwsgi stats format by prometheus format:

metric_name [
  "{" label_name "=" `"` label_value `"` { "," label_name "=" `"` label_value `"` } [ "," ] "}"
] value [ timestamp ]
xrmx commented 6 years ago

There's at least two projects that already does that, not sure we need to add another one

unbit commented 6 years ago

@aperigault sorry, just rapidly read the docs, is it a text protocol you are suggesting to support in addition to json ?

ghost commented 6 years ago

There's at least two projects that already does that, not sure we need to add another one

It would be much simpler if you did not have to use intermediaries exporters. If the UWSGI were able to directly export statistics in the prometheus format. First of all you have to run and watch an additional process. Secondly, this additional process must be compatible with the current version of UWSGI. Currently, none support custom metrics.

is it a text protocol you are suggesting to support in addition to json ?

https://stackoverflow.com/questions/45083590/does-prometheus-allow-you-to-scrape-json-information-from-an-endpoint

I honestly did not penetrate in detail into the format of the metrics, but if you can't use the current JSON, it would be great to have a second flag, e.g. --prometheus-stats HTTP_PORT

dzen commented 6 years ago

@unbit yes it is. The goal here is to avoid deploying another project for each uwsgi we have :)

csawyerYumaed commented 6 years ago

Format Documentation: https://prometheus.io/docs/instrumenting/exposition_formats/ It's plain text UTF-8 line-oriented.

barryib commented 5 years ago

@unbit Any chance to have a prometheus stats pusher in uWSGI ?

unbit commented 5 years ago

@barryib you can ask for sponsored features by sending a mail to info at unbit.it.