Menu

Discourse integration for Grafana Cloud

Discourse is an application that is used to host a discussion platform. The Discourse integration uses the Grafana Agent to collect metrics from a Discourse instance. Such as HTTP traffic, request rates, latency, sidekiq jobs, and browser heap usage. This integration includes two useful alerts and three pre-built dashboards to help monitor and visualize Discourse metrics.

This integration supports Discourse 2.8+

Pre-install configuration for the Discourse integration

This integration monitors a Discourse instance that is exposing Prometheus metrics via the official exporter plugin. Refer to the Discourse documentation for detailed guidance on how to install plugins in Discourse.

In order for the plugin to work, you must add the plugin’s git clone URL to the app.yml file.

Note: The app.yml file can be found in /var/discourse/containers.

Modify the following example snippet according to your environment:

hooks:
  after_code:
    - exec:
        cd: $home/plugins
        cmd:
          - sudo -E -u discourse git clone https://github.com/discourse/discourse-prometheus.git

Once the app.yml file is updated, rebuild the container using the following command:

cd /var/discourse
./launcher rebuild app

The configuration of DISCOURSE_PROMETHEUS_TRUSTED_IP_ALLOWLIST_REGEX may need to be configured to trust the Grafana Agent to scrape the metrics.

For more information on how to install Discourse, refer to their Installation documentation.

Install Discourse integration for Grafana Cloud

  1. In your Grafana instance, click Integrations and Connections (lightning bolt icon)
  2. Navigate to the Discourse tile and review the prerequisites. Then click Install integration.
  3. Once the integration is installed, follow the steps on the Configuration Details page to setup Grafana Agent and start sending Discourse metrics to your Grafana Cloud instance.

Post-install configuration for the Discourse integration

You should instruct Grafana Agent to scrape your Discourse nodes.

With the official exporter plugin enabled, Discourse exposes a /metrics endpoint. To scrape it, add the snippet in the next step to your agent configuration file.

Make sure to change targets in the snippet according to your environment.

metrics:
  wal_directory: /tmp/wal
  configs:
    - name: integrations
      scrape_configs:
      - job_name: integrations/discourse
        metrics_path: /metrics
        scrape_interval: 15s
        static_configs:
        - targets:
          - localhost:80

Dashboards

The Discourse integration installs the following dashboards in your Grafana Cloud instance to help monitor your metrics.

  • Discourse Jobs Processing
  • Discourse Overview

Discourse Jobs Dashboard

image

Discourse Overview Dashboard 1

image

Discourse Overview Dashboard 2

image

Alerts

The Discourse integration includes the following useful alerts:

Group: DiscourseAlerts

AlertDescription
DiscourseRequestsHigh5xxErrorsCritical: More than 10% of all requests result in a 5XX.
DiscourseRequestsHigh4xxErrorsWarning: More than 30% of all requests result in a 4XX.

Metrics

The following metrics are automatically written to your Grafana Cloud instance by connecting your Discourse instance through this integration:

  • discourse_active_app_reqs
  • discourse_http_duration_seconds
  • discourse_http_requests
  • discourse_page_views
  • discourse_queued_app_reqs
  • discourse_rss
  • discourse_scheduled_job_count
  • discourse_scheduled_job_duration_seconds
  • discourse_sidekiq_job_count
  • discourse_sidekiq_job_duration_seconds
  • discourse_sidekiq_jobs_enqueued
  • discourse_v8_used_heap_size

Changelog

# 0.0.1 - December 2022

Initial Release

Cost

By connecting your Discourse instance to Grafana Cloud you might incur charges. To view information on the number of active series that your Grafana Cloud account uses for metrics included in each Cloud tier, see Active series and dpm usage and Cloud tier pricing.