Discourse Prometheus

:discourse2: Summary Discourse Prometheus is the official Prometheus exporter for Discourse
:hammer_and_wrench: Repository Link https://github.com/discourse/discourse-prometheus
:open_book: Install Guide How to install plugins in Discourse

The Discourse Prometheus plugin collects key metrics from Discourse and exposes them in the /metrics path so prometheus can consume them.

These metrics can be used to Graph all sorts of data like:

Median and 99th percentile times for topic / categories / top and latest pages. Breaking down execution time between SQL/Redis and App.

Page view tracking

Error tracking

Ruby object space tracking including allocation rate, heaps and so on.

Hosted V8 memory statistics

Scheduled Job Queue and Sidekiq job durations and executions.

To see a full list of metrics available, install the plugin and visit SITENAME/metrics as an admin.

Out of the box we allow the metrics route to admins and private ips.


Discourse Prometheus is smart enough to aggregate data for all forked unicorn processes and present it as cohesive metrics on a single endpoint. We use it internally to keep track of our sites.

Sample dashboard at:


Discourse global setting called prometheus_trusted_ip_allowlist_regex (env: DISCOURSE_PROMETHEUS_TRUSTED_IP_ALLOWLIST_REGEX) is allowing to set Prometheus’s trusted IP addresses. The setting accepts regular expression to set advanced IP ranges. This is useful in a case when Prometheus IP address is dynamic.

50 Likes

I’m currently managing discourse on Kubernetes, running on multiple app and sidekiq pods. I have a couple of questions regarding the plugin:

  1. Does the plugin aggregate metrics from all the app pods? I’m assuming it does aggregate metrics for unicorn processes running on a single instance/pod.
  2. I’m curious about the reason behind observing timings for only some controller actions. This query is related to the code at discourse-prometheus/lib/collector.rb at main · discourse/discourse-prometheus · GitHub.