Complete monitoring setup with Mimir and Alerts#1063
Open
Conversation
Also adjusted the welcome message accordingly.
Contributor
There was a problem hiding this comment.
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
MampfCollectorwith 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>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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%):
New Dashboard
The dashboard is divided into 4 sections:
New Metrics