Tutorial: Prometheus#3023
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
✅ Files skipped from review due to trivial changes (2)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughAdds Prometheus and Grafana tutorial steps with metrics scraping, dashboard provisioning, and integration tests that verify the tutorial endpoints and metrics output. ChangesMetrics Tutorials
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@distribution/src/test/java/com/predic8/membrane/tutorials/operation/PrometheusTutorialTest.java`:
- Around line 22-25: Update the Javadoc in PrometheusTutorialTest so it matches
the actual endpoint used by the tutorial and assertions. The current reference
to /actuator/prometheus is outdated; change it to /metrics to align with the
test’s behavior and the tutorial config, keeping the description consistent with
the Prometheus tutorial’s real endpoint.
In `@distribution/tutorials/operation/50-Prometheus.yaml`:
- Around line 23-27: The Docker example in the Prometheus tutorial is missing
the host mapping needed for `host.docker.internal` to resolve on Linux. Update
the documented `docker run` command in the Prometheus tutorial so it includes
the host-gateway mapping, or explicitly note a platform-specific alternative,
and keep the example aligned with the scrape config that targets
`host.docker.internal:2000`.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 0bb563e8-fb25-4721-9d1b-c2fceae817bc
📒 Files selected for processing (3)
distribution/src/test/java/com/predic8/membrane/tutorials/operation/PrometheusTutorialTest.javadistribution/tutorials/operation/50-Prometheus.yamldistribution/tutorials/operation/prometheus/prometheus.yml
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
distribution/src/test/java/com/predic8/membrane/tutorials/operation/GrafanaTutorialTest.java (1)
33-47: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winCover backend B as well.
60-Grafana.yamladds a second API on port2002returning404, but this test never hits it. That leaves the tutorial’s status-code path unverified.Proposed fix
given() .when() .get("http://localhost:2001") .then() .statusCode(200); + + given() + .when() + .get("http://localhost:2002") + .then() + .statusCode(404); given() .when() .get("http://localhost:2000/metrics")🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@distribution/src/test/java/com/predic8/membrane/tutorials/operation/GrafanaTutorialTest.java` around lines 33 - 47, The Grafana tutorial test only verifies the backend on ports 2001 and 2000, so the new backend B status-code path from 60-Grafana.yaml is not covered. Update metricsEndpointReachableForScraping in GrafanaTutorialTest to also exercise the API on port 2002 and assert the expected 404 response, keeping the existing checks for the other endpoints intact.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@distribution/tutorials/operation/grafana/dashboards/membrane.json`:
- Around line 26-29: The dashboard panels in membrane.json hard-code a
Prometheus datasource UID that is not provisioned, so update the datasource
references used by the affected panel definitions to match the
provisioned/default datasource instead of PBFA97CFB590B2093. Check the repeated
panel datasource blocks and make the dashboard resolve via the datasource
provisioned in datasource.yml or another stable provisioned reference, so all
queries use the same valid datasource entry.
In `@distribution/tutorials/operation/grafana/docker-compose.yml`:
- Around line 2-9: The Prometheus service in the Grafana docker-compose setup
needs a Linux-compatible host-gateway mapping because it scrapes
host.docker.internal:2000. Update the prometheus service definition to include
an extra_hosts entry mapping host.docker.internal to host-gateway, matching the
tutorial path used by 60-Grafana.yaml so it works reliably on Linux as well as
Docker Desktop.
---
Nitpick comments:
In
`@distribution/src/test/java/com/predic8/membrane/tutorials/operation/GrafanaTutorialTest.java`:
- Around line 33-47: The Grafana tutorial test only verifies the backend on
ports 2001 and 2000, so the new backend B status-code path from 60-Grafana.yaml
is not covered. Update metricsEndpointReachableForScraping in
GrafanaTutorialTest to also exercise the API on port 2002 and assert the
expected 404 response, keeping the existing checks for the other endpoints
intact.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: e3e0e5b8-1b2f-42b3-b754-70a3a0fcd998
📒 Files selected for processing (7)
distribution/src/test/java/com/predic8/membrane/tutorials/operation/GrafanaTutorialTest.javadistribution/tutorials/operation/60-Grafana.yamldistribution/tutorials/operation/grafana/dashboards/membrane.jsondistribution/tutorials/operation/grafana/docker-compose.ymldistribution/tutorials/operation/grafana/prometheus/prometheus.ymldistribution/tutorials/operation/grafana/provisioning/dashboards/dashboards.ymldistribution/tutorials/operation/grafana/provisioning/datasources/datasource.yml
✅ Files skipped from review due to trivial changes (3)
- distribution/tutorials/operation/grafana/provisioning/datasources/datasource.yml
- distribution/tutorials/operation/grafana/provisioning/dashboards/dashboards.yml
- distribution/tutorials/operation/grafana/prometheus/prometheus.yml
…and set Prometheus UID
|
/ok-to-test |
Summary by CodeRabbit
/metricsscraping example and backend traffic to produce observable counters.membrane_count.