Skip to content

Complete monitoring setup with Mimir and Alerts#1063

Open
Amselll wants to merge 205 commits intonextfrom
feature/mimir
Open

Complete monitoring setup with Mimir and Alerts#1063
Amselll wants to merge 205 commits intonextfrom
feature/mimir

Conversation

@Amselll
Copy link
Collaborator

@Amselll Amselll commented Feb 25, 2026

This Pull Request completes the Monitoring Setup for MaMpf. It includes Grafana Mimir as a long-term data storage, email alerts, more metrics, and a clearer dashboard.

Mimir as Long-Term Storage

We added a new container for Grafana Mimir, which serves as the scalable, long-term storage backend for the metrics provided by Prometheus.

Alerts

We have integrated Grafana Alerting. This allows for proactive monitoring of the MaMpf infrastructure. Currently, only alerts for RAM and CPU are integrated. The test email in the contact point file will need to be replaced.

An explanation on how to add new alerts and contact email addresses can be found in the updated monitoring guide.

Below is a screenshot of the mail catcher showing what an alert email looks like (for testing the limit was set to 1%, now its 80%):

image

New Dashboard

The dashboard is divided into 4 sections:

  1. Infrastructure and resources:
    IMG-20260217-WA0027
  2. Application:
    IMG-20260217-WA0028
    image
  3. Trends: Some database metrics like registered users over time.
  4. Puma Metrics: Some additional Puma metrics like the number of threads or workers (only available in clustered mode).

New Metrics

  • Network traffic of the app container
  • RAM usage in %
  • Requests per second
  • Requests that returned an error in the past 24 hours
  • Average SQL latency
  • Average latency
  • Total requests per controller over the last 24 hours
  • Number of logins in the past 24 hours
  • Puma worker metrics
  • Puma thread metrics

@Amselll Amselll changed the title Complete monitoring setup with Mimir and alerts Complete monitoring setup with Mimir and Alerts Feb 25, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR completes the repo’s monitoring setup by adding a Prometheus → Mimir remote-write pipeline, Grafana provisioning (datasources/dashboards/alerting), and extending the Ruby Prometheus exporter integration to expose additional app and Puma metrics.

Changes:

  • Add a dockerized monitoring stack (Prometheus, Grafana Mimir, Grafana) plus provisioning for datasources, dashboards, and alert rules/contact points.
  • Extend MampfCollector with additional DB, network, and per-Puma-process metrics.
  • Enable Prometheus exporter middleware + Puma/process instrumentation outside of test.

Reviewed changes

Copilot reviewed 17 out of 19 changed files in this pull request and generated 12 comments.

Show a summary per file
File Description
package.json Fix JSON formatting/closing brace.
lib/collectors/mampf_collector.rb Add new gauges for DB counts, network traffic, and Puma CPU/RAM per process.
docker/monitoring/prometheus.yml Define Prometheus scrape config and remote_write to Mimir.
docker/monitoring/mimir.yml Add a single-node filesystem-backed Mimir config.
docker/monitoring/grafana/provisioning/datasources/datasources.yml Provision Prometheus and Mimir datasources (Mimir default).
docker/monitoring/grafana/provisioning/dashboards/dashboards.yml Provision file-based dashboards folder.
docker/monitoring/grafana/provisioning/alerting/notification_policies.yml Provision Grafana notification policy routing to Mailcatcher.
docker/monitoring/grafana/provisioning/alerting/contact_points.yml Provision an email contact point (Mailcatcher).
docker/monitoring/grafana/provisioning/alerting/alert_rules.yml Provision CPU/RAM alert rules based on Puma process metrics.
docker/monitoring/grafana/dashboards/mampf-overview.json Add the new “MaMpf General Overview” dashboard.
docker/monitoring/docker-compose.yml Add Prometheus/Mimir/Grafana services for monitoring.
docker/monitoring/MONITORING.md Add instructions for using/editing monitoring dashboards and alerts.
docker/monitoring/ACTIVATE_CLUSTER_MODE.md Document steps to test Puma clustered mode locally.
docker/development/run.sh Start prometheus_exporter in development container.
docker/development/compose.yml Expose exporter port and document optional WEB_CONCURRENCY for cluster testing.
config/puma.rb Start Prometheus exporter process/Puma instrumentation hooks (non-test).
config/initializers/prometheus_exporter.rb Enable Prometheus exporter middleware in non-test envs.
.github/workflows/tests.yml Minor formatting tweak.
.devcontainer/devcontainer.json Add monitoring compose file to devcontainer setup (but currently introduces JSON issues).
Comments suppressed due to low confidence (1)

.devcontainer/devcontainer.json:56

  • Monitoring services expose Grafana on port 2345 (and Prometheus/Mimir on 19090/9009), but these ports are not included in forwardPorts/portsAttributes. In Codespaces/remote devcontainers this usually means the monitoring UIs won’t be reachable via forwarded ports.
    "forwardPorts": [
        3000,
        3145,
        3036,
        3037,
        1080,
        5050,
        8060,
        3004,
        5933
    ],

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Amselll and others added 2 commits February 26, 2026 13:46
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@codecov
Copy link

codecov bot commented Feb 26, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (next@bde8cc4). Learn more about missing BASE report.

Additional details and impacted files
@@           Coverage Diff           @@
##             next    #1063   +/-   ##
=======================================
  Coverage        ?   55.23%           
=======================================
  Files           ?      368           
  Lines           ?    10993           
  Branches        ?        0           
=======================================
  Hits            ?     6072           
  Misses          ?     4921           
  Partials        ?        0           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants