# Discourse Prometheus

**URL:** https://meta.discourse.org/t/discourse-prometheus/72666
**Category:** Plugin
**Tags:** official, prometheus
**Created:** [October 24, 2017, 5:35am UTC](https://meta.discourse.org/t/discourse-prometheus/72666 "2017-10-24T05:35:30Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![Discourse](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/discourse/32/148734_2.png) [@Discourse](https://meta.discourse.org/u/Discourse)
#### Post date: [October 24, 2017, 5:35am UTC](https://meta.discourse.org/t/discourse-prometheus/72666/1 "2017-10-24T05:35:30Z")

</div>

| | | |
| --- | --- | --- |
| :discourse2: | **Summary** | **Discourse Prometheus** is the official [Prometheus](https://prometheus.io/) exporter for Discourse |
| :hammer_and_wrench: | **Repository Link** | [https://github.com/discourse/discourse-prometheus](https://github.com/discourse/discourse-prometheus) |
| :open_book: | **Install Guide** | [How to install plugins in Discourse](https://meta.discourse.org/t/install-plugins-in-discourse/19157) |

> [@](#):
>
> :discourse2: As this is an #official plugin maintained by the Discourse team, #Support, #Contribute > Bug, #Contribute > UX, and #Contribute > Feature requests can be made in the respective categories here on Meta, and tagged with the appropriate plugin tag. Click on a link below to get one started. :+1:
> 
> [:question:&nbsp; **Support**](https://meta.discourse.org/new-topic?category_id=6&body=%3E%20Before%20asking,%20did%20you%20search%20first%3F%20Press%20%F0%9F%94%8D%20at%20the%20upper%20right%20to%20search.&tags=prometheus "Ask for support on configuring and using Discourse Prometheus") [:bug:&nbsp; **Bug**](https://meta.discourse.org/new-topic?category_id=1&tags=prometheus "A bug report means something is broken, preventing normal/typical use of the plugin") [:eyes:&nbsp; **UX**](https://meta.discourse.org/new-topic?category_id=9&tags=prometheus "Discussion about the user interface of Discourse Prometheus, and how features are presented (including language and UI elements)") [:bulb:&nbsp; **Feature**](https://meta.discourse.org/new-topic?category_id=2&tags=prometheus "Discussion about how existing Discourse Prometheus features can be improved or enhanced, and how proposed new features could work")

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:

 ![image](https://global.discourse-cdn.com/meta/original/3X/a/5/a5abdc264335b029c374c9518ffd96d49cd7276f.png)

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

 ![image](https://global.discourse-cdn.com/meta/original/3X/b/5/b5a67446af73d926d6071271d2c4cca08109e1b7.png)

Page view tracking

 ![image](https://global.discourse-cdn.com/meta/original/3X/1/0/109d1bd8ede9689c9d5a130e67961029b98617d8.png)

Error tracking

 ![image](https://global.discourse-cdn.com/meta/original/3X/9/0/9058d660018c3883276901b1dbd3865698e7e306.png)

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

 ![image](https://global.discourse-cdn.com/meta/original/3X/7/6/7615ca29bc99348c7a2243b869e5757c8a6228f7.png)

Hosted V8 memory statistics

 ![image](https://global.discourse-cdn.com/meta/original/3X/f/3/f375be53f58ec281012782781a503375003e1578.png)

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 Stats | Grafana Labs](https://grafana.com/grafana/dashboards/3539-new-site-dashboard/)**

* * *

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.

> Last edited by @JammyDodger 2024-06-03T21:55:48Z
> 
> > **Check document**
> >
> > Perform check on document:

---

<div class="post-metadata">

### Author: ![Mudit\_Maheshwari](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mudit_maheshwari/32/331278_2.png) [@Mudit\_Maheshwari](https://meta.discourse.org/u/Mudit_Maheshwari)
#### Post date: [February 29, 2024, 12:21am UTC](https://meta.discourse.org/t/discourse-prometheus/72666/99 "2024-02-29T00:21:29Z")

</div>

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](https://github.com/discourse/discourse-prometheus/blob/main/lib/collector.rb#L460).

---

<div class="post-metadata">

### Author: ![inlann](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/inlann/32/455089_2.png) [@inlann](https://meta.discourse.org/u/inlann)
#### Post date: [December 4, 2024, 9:48am UTC](https://meta.discourse.org/t/discourse-prometheus/72666/102 "2024-12-04T09:48:11Z")

</div>

Hello,

Where can I find the setting `prometheus_trusted_ip_allowlist_regex`? :crying_cat_face:

 ![image](https://global.discourse-cdn.com/meta/original/4X/c/6/2/c62c5f251c17467a4cb3233f7f61f3bdb8742e34.png)

I’m using Discourse v3.4.0.beta3-dev

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [December 4, 2024, 1:59pm UTC](https://meta.discourse.org/t/discourse-prometheus/72666/103 "2024-12-04T13:59:10Z")

</div>

You have to set `DISCOURSE_PROMETHEUS_TRUSTED_IP_ALLOWIST_REGEX` in `app.yml`.

---

<div class="post-metadata">

### Author: ![DevTeVe](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/devteve/32/487601_2.png) [@DevTeVe](https://meta.discourse.org/u/DevTeVe)
#### Post date: [October 20, 2025, 6:05pm UTC](https://meta.discourse.org/t/discourse-prometheus/72666/104 "2025-10-20T18:05:48Z")

</div>

Not sure what’s happening but this integration is not working anymore. I couldn’t get the dashboard in grafana to display anything… the `/metrics` does return something but anything beyond that does not really work

Many errors like the one below

```plaintext
Started GET "/metrics/api/v1/label/instance/values?limit=40000&start=1760980620&end=1760982480&match%5B%5D=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%5B%5D=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%5B%5D=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%5B%5D=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)

```

---

<div class="post-metadata">

### Author: ![DevTeVe](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/devteve/32/487601_2.png) [@DevTeVe](https://meta.discourse.org/u/DevTeVe)
#### Post date: [October 22, 2025, 8:02am UTC](https://meta.discourse.org/t/discourse-prometheus/72666/105 "2025-10-22T08:02:13Z")

</div>

Cross-posting this as I found a solution that worked for me [Discourse Prometheus 404 metrics for Grafana - #2 by DevTeVe](https://meta.discourse.org/t/discourse-prometheus-404-metrics-for-grafana/386221/2)
