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.

51 Me gusta

Actualmente estoy gestionando discourse en Kubernetes, ejecutándose en múltiples pods de aplicaciones y sidekiq. Tengo un par de preguntas sobre el plugin:

  1. ¿El plugin agrega métricas de todos los pods de la aplicación? Supongo que agrega métricas para los procesos de unicorn que se ejecutan en una sola instancia/pod.
  2. Tengo curiosidad por la razón por la que solo se observan tiempos para algunas acciones del controlador. Esta consulta está relacionada con el código en discourse-prometheus/lib/collector.rb at main · discourse/discourse-prometheus · GitHub.

Hola,

¿Dónde puedo encontrar la configuración prometheus_trusted_ip_allowlist_regex? :crying_cat_face:

Estoy usando Discourse v3.4.0.beta3-dev

Tienes que configurar DISCOURSE_PROMETHEUS_TRUSTED_IP_ALLOWIST_REGEX en app.yml.

1 me gusta

No estoy seguro de lo que está pasando, pero esta integración ya no funciona. No pude conseguir que el panel de control en Grafana mostrara nada… /metrics devuelve algo, pero cualquier cosa más allá de eso realmente no funciona.

Muchos errores como el siguiente:

Started GET "/metrics/api/v1/label/instance/values?limit=40000&start=1760980620&end=1760982480&match[]=discourse_page_views" for 16.63.57.20 at 2025-10-20 17:47:07 +0000
Started GET "/metrics/api/v1/label/job/values?limit=40000&start=1760980620&end=1760982480&match[]=discourse_page_views%7B%7D" for 16.63.57.20 at 2025-10-20 17:47:07 +0000
  Rendered layout layouts/no_ember.html.erb (Duration: 21.1ms | GC: 0.0ms)
  Rendered layout layouts/no_ember.html.erb (Duration: 26.0ms | GC: 0.0ms)
Started POST "/metrics/api/v1/query_range" for 16.63.57.20 at 2025-10-20 17:47:07 +0000
Started POST "/metrics/api/v1/query_range" for 16.63.57.20 at 2025-10-20 17:47:07 +0000
Started POST "/metrics/api/v1/query_range" for 16.63.57.20 at 2025-10-20 17:47:07 +0000
Started POST "/metrics/api/v1/query_range" for 16.63.57.20 at 2025-10-20 17:47:07 +0000
Started POST "/metrics/api/v1/query_range" for 16.63.57.20 at 2025-10-20 17:47:07 +0000
  Rendered layout layouts/no_ember.html.erb (Duration: 19.8ms | GC: 0.0ms)
  Rendered layout layouts/no_ember.html.erb (Duration: 28.2ms | GC: 0.0ms)
  Rendered layout layouts/no_ember.html.erb (Duration: 34.6ms | GC: 0.0ms)
  Rendered layout layouts/no_ember.html.erb (Duration: 44.4ms | GC: 0.0ms)
  Rendered layout layouts/no_ember.html.erb (Duration: 41.7ms | GC: 0.0ms)
Started POST "/metrics/api/v1/query_range" for 16.63.57.20 at 2025-10-20 17:47:07 +0000
Started POST "/metrics/api/v1/query_range" for 16.63.57.20 at 2025-10-20 17:47:08 +0000
Started POST "/metrics/api/v1/query_range" for 16.63.57.20 at 2025-10-20 17:47:08 +0000
Started POST "/metrics/api/v1/query_range" for 16.63.57.20 at 2025-10-20 17:47:08 +0000
  Rendered layout layouts/no_ember.html.erb (Duration: 23.6ms | GC: 0.0ms)
  Rendered layout layouts/no_ember.html.erb (Duration: 24.9ms | GC: 0.0ms)
  Rendered layout layouts/no_ember.html.erb (Duration: 19.9ms | GC: 0.0ms)
  Rendered layout layouts/no_ember.html.erb (Duration: 21.6ms | GC: 0.0ms)
Started GET "/metrics/api/v1/label/job/values?limit=40000&start=1760980620&end=1760982480&match[]=discourse_page_views%7B%7D" for 16.63.57.20 at 2025-10-20 17:47:37 +0000
Started GET "/metrics/api/v1/label/instance/values?limit=40000&start=1760980620&end=1760982480&match[]=discourse_page_views" for 16.63.57.20 at 2025-10-20 17:47:37 +0000
  Rendered layout layouts/no_ember.html.erb (Duration: 19.5ms | GC: 0.0ms)
  Rendered layout layouts/no_ember.html.erb (Duration: 20.9ms | GC: 0.0ms)
Started POST "/metrics/api/v1/query_range" for 16.63.57.20 at 2025-10-20 17:47:37 +0000
Started POST "/metrics/api/v1/query_range" for 16.63.57.20 at 2025-10-20 17:47:37 +0000
Started POST "/metrics/api/v1/query_range" for 16.63.57.20 at 2025-10-20 17:47:37 +0000
Started POST "/metrics/api/v1/query_range" for 16.63.57.20 at 2025-10-20 17:47:37 +0000
Started POST "/metrics/api/v1/query_range" for 16.63.57.20 at 2025-10-20 17:47:37 +0000
  Rendered layout layouts/no_ember.html.erb (Duration: 22.4ms | GC: 0.0ms)
  Rendered layout layouts/no_ember.html.erb (Duration: 22.0ms | GC: 0.0ms)
  Rendered layout layouts/no_ember.html.erb (Duration: 40.0ms | GC: 0.0ms)
  Rendered layout layouts/no_ember.html.erb (Duration: 37.0ms | GC: 0.0ms)
  Rendered layout layouts/no_ember.html.erb (Duration: 24.8ms | GC: 1.6ms)

Publicando esto también ya que encontré una solución que me funcionó Discourse Prometheus 404 metrics for Grafana - #2 by DevTeVe