fix: grafana link and uid drift in dashboards - #224
Conversation
📝 WalkthroughWalkthroughGrafana configuration is updated with a production root URL, dashboard metrics are renamed for metric consistency, a dashboard identifier is changed, and the Grafana URL is externalized as an environment variable across Docker Compose and nginx configuration for dynamic deployment setup. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~15 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 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.
Pull request overview
This pull request fixes Grafana integration issues by addressing configuration drift and correcting metric names in dashboards. The changes make Grafana URLs configurable via environment variables and align dashboard queries with the actual OpenTelemetry instrumentation.
Changes:
- Added configurable GRAFANA_URL environment variable for nginx proxy configuration
- Changed dashboard UID from "integr8scode-main" to "integr8scode" to fix drift
- Corrected metric names in coordinator-execution dashboard to match actual instrumentation (queue_schedule_total, queue_enqueue_total, queue_wait_time_seconds_bucket)
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| frontend/nginx.conf.template | Updated Grafana proxy to use configurable GRAFANA_URL environment variable instead of hardcoded URL |
| docker-compose.yaml | Added GRAFANA_URL env var for frontend; changed GRAFANA_ROOT_URL default to empty string |
| backend/grafana/provisioning/dashboards/integr8scode.json | Changed dashboard UID from "integr8scode-main" to "integr8scode" |
| backend/grafana/provisioning/dashboards/coordinator-execution.json | Fixed metric names to match actual OpenTelemetry instrumentation |
| backend/grafana/grafana.ini | Added hardcoded production root_url configuration |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| environment: | ||
| - GF_LOG_LEVEL=warn | ||
| - GF_SERVER_ROOT_URL=${GRAFANA_ROOT_URL:-http://localhost:3000/} | ||
| - GF_SERVER_ROOT_URL=${GRAFANA_ROOT_URL:-} |
There was a problem hiding this comment.
The default value for GRAFANA_ROOT_URL is now empty (:-) instead of the previous default "http://localhost:3000/". An empty root_url may cause Grafana to malfunction or generate incorrect URLs in local development environments. Consider providing a sensible default like "http://localhost:3000/" or "http://localhost:5001/grafana/" for local development, or documenting that this variable must be set explicitly.
| - GF_SERVER_ROOT_URL=${GRAFANA_ROOT_URL:-} | |
| - GF_SERVER_ROOT_URL=${GRAFANA_ROOT_URL:-http://localhost:3000/} |
| "timezone": "", | ||
| "title": "System Overview", | ||
| "uid": "integr8scode-main", | ||
| "uid": "integr8scode", |
There was a problem hiding this comment.
The dashboard UID has been changed from "integr8scode-main" to "integr8scode", but other dashboards still reference the old UID in their navigation links. The following files need to be updated to use "/d/integr8scode" instead of "/d/integr8scode-main":
- dlq-monitoring.json (line 31)
- event-stream-monitoring.json (line 33)
- kafka-events-monitoring.json (line 33)
- rate-limiting-dashboard.json (line 30)
Without these updates, navigation links from these dashboards to the System Overview will be broken.
There was a problem hiding this comment.
Actionable comments posted: 3
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
backend/grafana/provisioning/dashboards/coordinator-execution.json (1)
149-188:⚠️ Potential issue | 🟠 MajorPanel wait-time queries will fail silently; queue.wait_time metric is defined but never recorded.
Two of the three renamed metrics are properly implemented:
queue_enqueue_totalis recorded viaQueueMetrics.record_enqueue()queue_schedule_totalis recorded viaQueueMetrics.record_schedule()However,
queue_wait_time_seconds_bucketis defined as a histogram instrument inQueueMetrics._create_instruments()but therecord_wait_time()method is never called anywhere in the backend. Panels 1 and 5 (both referencingqueue_wait_time_seconds_bucket) will display no data.Either implement the call to
QueueMetrics.record_wait_time()where execution wait times are measured, or remove the metric references from the dashboard.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@backend/grafana/provisioning/dashboards/coordinator-execution.json` around lines 149 - 188, The dashboard panels reference the histogram metric queue_wait_time_seconds_bucket which is created in QueueMetrics._create_instruments() but never recorded; add calls to QueueMetrics.record_wait_time(duration_seconds) at the point where job/execution wait time is measured (e.g., before execution starts or when dequeuing/assigning work) so the histogram buckets are populated, or alternatively remove the panels referencing queue_wait_time_seconds_bucket/queue wait-time from the Grafana JSON; ensure you use the QueueMetrics.record_wait_time() method and the same duration units expected by the histogram to match the existing queue_enqueue_total and queue_schedule_total usage.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@backend/grafana/grafana.ini`:
- Around line 1-2: The grafana.ini currently hardcodes root_url which conflicts
with the docker-compose environment variable GF_SERVER_ROOT_URL
(GRAFANA_ROOT_URL) and can be overridden to an empty string; remove the root_url
line from grafana.ini (the [server] section entry named root_url) so the
container env var GF_SERVER_ROOT_URL/GRAFANA_ROOT_URL is the single source of
truth (or alternatively, if you prefer INI as source, remove GF_SERVER_ROOT_URL
from docker-compose and set the value in grafana.ini) — pick one source and
delete the other to avoid empty-string overrides.
In `@backend/grafana/provisioning/dashboards/integr8scode.json`:
- Line 911: Update any hardcoded Grafana dashboard links that point to the old
UID to match the new UID value "integr8scode": search for occurrences of the URL
string "/d/integr8scode-main" (e.g., in event-stream-monitoring.json and
kafka-events-monitoring.json) and replace them with "/d/integr8scode" so
cross-dashboard navigation references the new "uid": "integr8scode".
In `@docker-compose.yaml`:
- Line 193: GF_SERVER_ROOT_URL in docker-compose.yaml currently defaults to an
empty string via the GRAFANA_ROOT_URL fallback, which can silently override the
root_url in grafana.ini; update the environment entry for GF_SERVER_ROOT_URL so
it uses a non-empty default (the production root URL used in grafana.ini) when
GRAFANA_ROOT_URL is unset, ensure the value matches the grafana.ini root_url to
avoid dual-source ambiguity, and test by bringing the compose stack up without
GRAFANA_ROOT_URL to confirm alert links are correct.
---
Outside diff comments:
In `@backend/grafana/provisioning/dashboards/coordinator-execution.json`:
- Around line 149-188: The dashboard panels reference the histogram metric
queue_wait_time_seconds_bucket which is created in
QueueMetrics._create_instruments() but never recorded; add calls to
QueueMetrics.record_wait_time(duration_seconds) at the point where job/execution
wait time is measured (e.g., before execution starts or when dequeuing/assigning
work) so the histogram buckets are populated, or alternatively remove the panels
referencing queue_wait_time_seconds_bucket/queue wait-time from the Grafana
JSON; ensure you use the QueueMetrics.record_wait_time() method and the same
duration units expected by the histogram to match the existing
queue_enqueue_total and queue_schedule_total usage.
ℹ️ Review info
Configuration used: defaults
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
backend/grafana/grafana.inibackend/grafana/provisioning/dashboards/coordinator-execution.jsonbackend/grafana/provisioning/dashboards/integr8scode.jsondocker-compose.yamlfrontend/nginx.conf.template
|



Summary by cubic
Fixes Grafana routing and stabilizes dashboard links/UID to prevent drift. Corrects queue wait-time metrics and updates dashboards to the renamed metrics so panels render correctly.
Bug Fixes
Migration
Written for commit ab79431. Summary will update on new commits.
Summary by CodeRabbit