Example of Rails, Sidekiq and Puma metrics exported to Prometheus + Grafana
This example illustrates how to use yabeda gem suite with rails application to draw graphs for app metrics.
Recent versions of Docker and Docker Compose installed.
docker-compose upto start.
- Go to rails application at http://localhost:5000
- Hit the button and refresh page few times
- Go to Grafana Web UI at localhost (user:
- Look for graphs
- After starting up docker-compose will run
rails-stressorservice to simulate huge load for the rails app. By default will do the request for 2 minutes. Settings could be changed in
docker-compose.ymlconfig (command parameter of the
You also could run rails stressor again by executing
docker-compose up rails_stressor command.
- Sample Rails application is equipped with yabeda-rails, yabeda-sidekiq, yabeda-puma-plugin, and yabeda-prometheus gems and properly configured.
- Raw rails metrics are exposed at http://localhost:5000/metrics
- Raw sidekiq metrics are exposed at http://localhost:5100/metrics
- Raw puma metrics are exposed at http://localhost:5100/metrics
- The Prometheus Web UI runs at http://localhost:9090
- The Grafana Web UI runs at http://localhost:3000 , user:
- The Sidekiq Web UI is available at http://localhost:5000/sidekiq
Possible errors and their solutions
Permission denied error / My grafana container is not running (Stopping after boot)
If your grafana's container is not running correctly after you run
docker-compose up you're probably getting this error, if you check at
docker ps -a you'll see your grana container with the status
Exited, picks the id of this container and run
docker logs YOUR_GRAFANA_CONTAINER_ID and check if the errors is equal to the following:
GF_PATHS_DATA='/var/lib/grafana' is not writable. You may have issues with file permissions, more information here: http://docs.grafana.org/installation/docker/#migration-from-a-previou s-version-of-the-docker-container-to-5-1-or-later mkdir: cannot create directory '/var/lib/grafana/plugins': Permission denied
Replace at your
docker-compose.yml line 38 by your user's
id that you will get on the following command:
The configurations are based off the following articles and repositories:
This example is available as open source under the terms of the MIT License.