Skip to content

skyhisi/uwsgi_prometheus_plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

uwsgi_prometheus_plugin

Build License: GPL 2

Prometheus exporter for uWSGI as a plugin

This plugin runs a Prometheus exporter inside the uWSGI process which avoids the need to configure and manage a separate process.

Building

The plugin can be built using the built-in uWSGI plugin building option, for convenience the provided Makefile will do this.

git clone https://github.com/skyhisi/uwsgi_prometheus_plugin.git
cd uwsgi_prometheus_plugin
make

This will generate the plugin file prometheus_plugin.so

Depending on your OS, some extra packages may need to be installed:

  • Debian
    apt install uwsgi build-essential libcap-dev libpcre3-dev libssl-dev
    
  • Fedora
    dnf groupinstall 'C Development Tools and Libraries'
    dnf install uwsgi libcap-devel pcre-devel openssl-devel
    

uWSGI Configuration

Load the plugin by adding it to the configuration file, for example as an ini file:

[uwsgi]
plugins=http,python3,./prometheus_plugin.so
...

By default, for compatibility with other uWSGI exporters, the plugin will listen on TCP port 9117.

This can be changed with the prometheus-listen option, for example in an ini file:

prometheus-listen=127.0.0.1:8081

Prometheus Configuration

Add a new target to the prometheus.yml file, for example:

scrape_configs:
  - job_name: uwsgi
    static_configs:
      - targets: ['127.0.0.1:9117']

Example Prometheus Queries

Some example queries:

  • Request rate across all workers:
    sum(rate(uwsgi_worker_requests[5m])) without (id)
    
  • Count of busy workers:
    sum (uwsgi_worker_busy) without (id)
    

About

Prometheus exporter for uWSGI as a plugin

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages