Skip to content

feat: integrate Grafana Dashboard monitoring into Web UI#4868

Open
m199369309 wants to merge 4 commits intoxorbitsai:mainfrom
m199369309:feat/grafana-dashboard-integration
Open

feat: integrate Grafana Dashboard monitoring into Web UI#4868
m199369309 wants to merge 4 commits intoxorbitsai:mainfrom
m199369309:feat/grafana-dashboard-integration

Conversation

@m199369309
Copy link
Copy Markdown
Contributor

@m199369309 m199369309 commented Apr 28, 2026

Summary

  • Add /v1/cluster/ui_config backend endpoint that returns Grafana configuration from environment variables (XINFERENCE_GRAFANA_URL, XINFERENCE_GRAFANA_DATASOURCE, XINFERENCE_GRAFANA_DASHBOARD_UID, XINFERENCE_CLUSTER_NAME)
  • Add new "Monitoring" page (/monitoring) that embeds a Grafana Dashboard via iframe with kiosk=tv mode, theme-following (light/dark), and variable pass-through
  • Add grafanaUtils.js utility for building Grafana iframe URLs (full dashboard + single panel embed)
  • Add "Monitoring" menu item to sidebar navigation
  • Add i18n translations for monitoring UI (en/zh/ja/ko)

Motivation

After #4857 added comprehensive Prometheus metrics, users need a way to visualize these metrics directly within the xinference Web UI without switching to a separate Grafana instance. This PR embeds Grafana Dashboards via iframe, providing a seamless monitoring experience.

Configuration

Environment Variable Required Default Description
XINFERENCE_GRAFANA_URL Yes "" Grafana base URL. When empty, monitoring menu is hidden
XINFERENCE_GRAFANA_DATASOURCE No "" Prometheus datasource name
XINFERENCE_GRAFANA_DASHBOARD_UID No xinference-overview Dashboard UID
XINFERENCE_CLUSTER_NAME No "" Cluster label for multi-cluster filtering

Test plan

  • Verify /v1/cluster/ui_config returns correct JSON with/without env vars set
  • Verify /monitoring page loads and displays Grafana Dashboard when configured
  • Verify monitoring page shows "not configured" message when XINFERENCE_GRAFANA_URL is empty
  • Verify theme-following works (switch xinference theme → Grafana theme updates)
  • Verify monitoring menu item appears in sidebar
  • Verify no regression on existing pages

Add a new "Monitoring" page that embeds a Grafana Dashboard via iframe,
along with a backend API endpoint to supply Grafana configuration from
environment variables. This enables users to view Prometheus metrics
(cluster overview, worker resources, model service quality, LLM-specific
metrics) directly within the xinference Web UI.

Changes:
- Backend: add `/v1/cluster/ui_config` endpoint returning Grafana URL,
  datasource, dashboard UID, and cluster name from env vars
- Frontend: new `grafanaUtils.js` utility for building iframe URLs with
  theme and variable support
- Frontend: new `/monitoring` route and page component with theme-following
- Frontend: add "Monitoring" menu item to sidebar navigation
- i18n: add monitoring-related translations (en/zh/ja/ko)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@XprobeBot XprobeBot added this to the v2.x milestone Apr 28, 2026
m199369309 and others added 3 commits April 28, 2026 23:52
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
"collapsed": false,
"gridPos": { "h": 1, "w": 24, "x": 0, "y": 0 },
"id": 100,
"title": "集群概览",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Could you change to English?

"collapsed": false,
"gridPos": { "h": 1, "w": 24, "x": 0, "y": 5 },
"id": 101,
"title": "Worker 资源",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ditto.

},
{
"id": 4,
"title": "GPU 利用率",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ditto.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants