Monitoring Userflows using Prometheus and Grafana

Grainite makes it easy for developers to track metrics using Prometheus by providing access to counters and gauges in the Action Handlers themselves. Userflows utilizes these APIs to track various metrics for users as well as flows using Prometheus and display them on a Grafana dashboard.

Prometheus Setup

Follow the guide here to install Prometheus.

The app directory contains a prometheus.yml file under monitoring/, which should be used for your Prometheus instance.

  scrape_interval:     15s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
  evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute.
  # scrape_timeout is set to the global default (10s).

# A scrape configuration containing exactly one endpoint to scrape:
# Here it's Prometheus itself.
  # The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
  - job_name: 'userflows_grainite_prometheus'
    metrics_path: '/export-dashboard'
    scrape_interval: 5s

    - targets: ['localhost:5154']

If you are not running Grainite locally, be sure to change the target in prometheus.yml to point to the correct host.

Grafana Setup

Follow the guide here to install Grafana.

Add the Prometheus data source to Grafana. Be sure to change the URL to point to your Prometheus installation.

Finally, import the userflows dashboard, found at monitoring/UserFlowsDashboard.json into Grafana to view the metrics.

Last updated