Skip to main content

Monitoring with Prometheus

Dawarich can export certain metrics in a format that can be used by Prometheus.

Configuration​

To enable metrics export, you need to set a few environment variables. The value will be different depending on the container. Make sure you set the correct variable values for appropriate containers.

dawarich_app​

VariableDefaultDescription
PROMETHEUS_EXPORTER_ENABLEDfalseEnable the Prometheus metrics exporter
PROMETHEUS_EXPORTER_HOST0.0.0.0Host address to bind the metrics exporter to
PROMETHEUS_EXPORTER_PORT9394Port number to bind the metrics exporter to

dawarich_sidekiq​

VariableDefaultDescription
PROMETHEUS_EXPORTER_ENABLEDfalseEnable the Prometheus metrics exporter
PROMETHEUS_EXPORTER_HOSTdawarich_appName of the dawarich_app container
PROMETHEUS_EXPORTER_PORT9394Port number to bind the metrics exporter to

Update to docker-compose.yml​

Also, the default docker-compose.yml file uses command: ['bin/rails', 'server', '-p', '3000', '-b', '::']. If you want to monitor Dawarich with prometheus, make sure to change it to command: bin/dev.

Metrics​

Some of the metrics that can be exported are:

The application metrics are:

TypeNameDescription
Counterhttp_requests_totalTotal HTTP requests from web app
Summaryhttp_request_duration_secondsTime spent in HTTP reqs in seconds
Summaryhttp_request_redis_duration_secondsTime spent in HTTP reqs in Redis, in seconds
Summaryhttp_request_sql_duration_secondsTime spent in HTTP reqs in SQL in seconds
Summaryhttp_request_queue_duration_secondsTime spent queueing the request in load balancer in seconds
Summaryhttp_request_memcache_duration_secondsTime spent in HTTP reqs in Memcache in seconds

The sidekiq metrics are:

TypeNameDescription
Gaugeactive_record_connection_pool_connectionsTotal connections in pool
Gaugeactive_record_connection_pool_busyConnections in use in pool
Gaugeactive_record_connection_pool_deadDead connections in pool
Gaugeactive_record_connection_pool_idleIdle connections in pool
Gaugeactive_record_connection_pool_waitingConnection requests waiting
Gaugeactive_record_connection_pool_sizeMaximum allowed connection pool size

The complete list of metrics can be found in the prometheus_exporter library readme, which is being used by Dawarich.