Discorso Prometheus

||||
-|-|
:discourse2: | Riepilogo | Discourse Prometheus è l’esportatore ufficiale di Prometheus per Discourse
:hammer_and_wrench: | Link al repository | https://github.com/discourse/discourse-prometheus
:open_book: | Guida all’installazione | Come installare i plugin in Discourse

Il plugin Discourse Prometheus raccoglie le metriche chiave di Discourse e le espone nel percorso /metrics in modo che Prometheus possa consumarle.

Queste metriche possono essere utilizzate per tracciare in grafici una vasta gamma di dati, come:

Tempi mediani e al 99° percentile per pagine di argomenti, categorie, top e più recenti. Suddivisione del tempo di esecuzione tra SQL/Redis e App.

Tracciamento delle visualizzazioni di pagina

Tracciamento degli errori

Tracciamento dello spazio degli oggetti Ruby, inclusa la frequenza di allocazione, heap e così via.

Statistiche della memoria di V8 ospitata

Coda dei lavori programmati e durate/esecuzioni dei job di Sidekiq.

Per visualizzare l’elenco completo delle metriche disponibili, installa il plugin e visita NOME_SITO/metrics come amministratore.

Di default, consentiamo l’accesso al percorso metrics agli amministratori e agli indirizzi IP privati.


Discourse Prometheus è intelligente abbastanza da aggregare i dati per tutti i processi unicorn biforcuti (forked) e presentarli come metriche coerenti su un singolo endpoint. Lo utilizziamo internamente per tenere traccia dei nostri siti.

Dashboard di esempio su:


L’impostazione globale di Discourse denominata prometheus_trusted_ip_allowlist_regex (env: DISCOURSE_PROMETHEUS_TRUSTED_IP_ALLOWLIST_REGEX) consente di impostare gli indirizzi IP attendibili di Prometheus. L’impostazione accetta espressioni regolari per definire intervalli IP avanzati. Questo è utile nel caso in cui l’indirizzo IP di Prometheus sia dinamico.

51 Mi Piace
Install Prometheus plugin + Prometheus on your server
Add more metrics to Discourse Prometheus
Prometheus exporter problem with SecureRandom (multisite?)
Webhook for Discourse Uptime Monitoring?
Best configurations for speeding up standalone discourse
Huge increase in Redis use after changing hosts
Prometheus scrape job cannot reach the metrics
Prometheus pluging Cross-Origin Request
How to avoid upstream timeouts?
Staging instance on same Production instance Docker Server?
A lot of CPU cores or fast cores?
Memory creep in last couple of updates
What's the correct REGEX for the allowlist in app.yml?
Tracking discourse usage by hour?
Discourse disk space limits per user?
Admin Reporting & Analysis: Incremental Changes
Out of memory errors with custom plugin
Postgres connection error on 'bundle exec rails c'
Getting extreme load warning while server resources are not being used
Real-time updating of topics freezes under high activity
Docker image update: Redis 6 and 25% smaller image size
Real-time updating of topics freezes under high activity
Real-time updating of topics freezes under high activity
What happens next?
High load due to peak anonymous sessions, increase unicorn workers?
Opinions on AWS vs DO Page Speed / Performance
Can I ignore some user agents?
Extreme Load Error After Upgrading to 3.3.0.beta3-dev Yesterday (on Prem)
Multiple Discourse Instances with WordPress, Ghost and subfolder support
Display community health stats on lemon (lemon = RPi + Pimoroni Unicorn Hat HD)

Sto attualmente gestendo discourse su Kubernetes, in esecuzione su più pod app e sidekiq. Ho un paio di domande riguardo al plugin:

  1. Il plugin aggrega le metriche da tutti i pod dell’app? Presumo che aggreghi le metriche per i processi unicorn in esecuzione su una singola istanza/pod.
  2. Sono curioso del motivo per cui si osservano i tempi solo per alcune azioni del controller. Questa query è correlata al codice su discourse-prometheus/lib/collector.rb at main · discourse/discourse-prometheus · GitHub.

Ciao,

Dove posso trovare l’impostazione prometheus_trusted_ip_allowlist_regex? :crying_cat_face:

Sto usando Discourse v3.4.0.beta3-dev

Devi impostare DISCOURSE_PROMETHEUS_TRUSTED_IP_ALLOWIST_REGEX in app.yml.

1 Mi Piace

Non sono sicuro di cosa stia succedendo, ma questa integrazione non funziona più. Non riesco a far visualizzare nulla al dashboard in Grafana… /metrics restituisce qualcosa, ma qualsiasi altra cosa non funziona veramente.

Molti errori come quello sottostante

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)

Ri-condivido questo perché ho trovato una soluzione che ha funzionato per me Discourse Prometheus 404 metrics for Grafana - #2 by DevTeVe