Ruby Rack Integration for Grafana Cloud
The Rack webserver interface for Ruby allows easily building web applications. This integration enables the agent to send metrics to Grafana Cloud along with a useful default dashboard for visualization.
Use the walkthrough in Grafana Cloud to install the Ruby Rack Integration, like in our Quickstart.
This integration monitors a Rack web application (e.g. any Sinatra or Rails application) using the
Collector middleware included in the Ruby Prometheus client library.
To get started, add the Prometheus client library to your Gemfile:
Then change the
config.ru file of your Rack application to use the Prometheus
Exporter middlewares before running your app:
require 'prometheus/middleware/collector' require 'prometheus/middleware/exporter' use Prometheus::Middleware::Collector use Prometheus::Middleware::Exporter run Sinatra::Application
You can refer to this example Sinatra app for a complete setup of the Prometheus client library.
Post-install configuration for the Ruby Rack Integration
In the agent configuration file, the agent must be pointed to the Ruby process, such as
ruby:9292 in the example below, that exposes a
prometheus: wal_directory: /tmp/wal global: scrape_interval: 5s configs: - name: integrations scrape_configs: - job_name: integrations/ruby-rack static_configs: - targets: ['ruby:9292'] remote_write: - url: http://cortex:9009/api/prom/push