Skip to content

feat(monitoring): add Monitoring view mirroring concave-web - #1

Open
devin-ai-integration[bot] wants to merge 1 commit into
mainfrom
devin/1777385375-monitoring-view
Open

feat(monitoring): add Monitoring view mirroring concave-web#1
devin-ai-integration[bot] wants to merge 1 commit into
mainfrom
devin/1777385375-monitoring-view

Conversation

@devin-ai-integration

Copy link
Copy Markdown

Summary

Adds a Monitoring view to the Bubble Tea TUI that mirrors the Prometheus/Grafana surface now shipping in concave-web (Gradient-Linux/concave-web#1). Business logic stays in concave; the TUI only reads from upstream HTTP endpoints.

New package — internal/monitoring

  • Prober with Probe(ctx) (reachability via /-/healthy + /api/v1/status/buildinfo and /api/health) and Query(ctx, expr) (PromQL instant, reduced to first scalar sample).
  • Graceful degradation: empty URL ⇒ Configured:false; HTTP errors and decode failures propagate into the Sample.Error field so the view can render them inline.
  • Covered by new unit tests in internal/monitoring/monitoring_test.go.

Config — cmd/concave-tui/config

  • New [monitoring] TOML section with prometheus_url / grafana_url. Both default to empty; when both are empty the view renders a guidance card pointing at the config file and mentioning the Flow (:9090/:3000 bundled) and Forge suites.
  • Covered by TestMonitoringURLsRoundTrip.

TUI — cmd/concave-tui/model

  • New MonitoringModel between Fleet and Teams in the sidebar. Viewer-gated, refresh-on-r, auto-refresh every 15 s.
  • Sidebar icon MN, label Monitoring; shortcut shifted from 8 to 9 for System on admin sessions.
  • Two existing order-checking tests (TestRootSwitchesViewsWhenAuthenticated, TestAdminVisibleViewsIncludeSystemAndUsers, TestViewerVisibleViewsIncludeMonitoringScreens) updated to reflect the new view index — this is a direct consequence of the new sidebar entry, not a semantic change.
  • New monitoring_test.go covers: guidance when unconfigured, reachability + PromQL rendering with a stubbed prober, unreachable-error rendering.

No new dependencies. go vet ./... and go test ./... pass.

Review & Testing Checklist for Human

Risk: yellow — adds a new sidebar entry (so view indices shift) and a new outbound HTTP path for probing Prometheus/Grafana, but both URLs are empty by default so the view is a no-op until the user opts in.

  • Confirm TUI launches as before for users who have NOT edited ~/.config/concave-tui/config.toml — the existing [display] / [layout] content is untouched; a fresh [monitoring] block should be appended with empty URLs.
  • With the Flow suite installed and running, set prometheus_url = "http://127.0.0.1:9090" and grafana_url = "http://127.0.0.1:3000", restart the TUI, switch to the Monitoring view (number 7 for viewers, or tab), and confirm the reachability badges flip to reachable and the PromQL rows populate.
  • With only Prometheus configured (Grafana URL blank), confirm Grafana shows not configured rather than erroring.

Notes

  • Monitoring URLs are intentionally NOT surfaced in the TUI settings modal — they are infrastructure-level concerns best edited in the TOML file alongside the other sysadmin-visible settings. Happy to wire them into SettingsModel as a follow-up if preferred.
  • The key-number shortcut for System (and Users) shifts by one for admin sessions because the new view sits before them. The existing tab / shift+tab cycling continues to work as before.
  • Related: feat(monitoring): add Prometheus and Grafana integration concave-web#1 (web monitoring surface).

Link to Devin session: https://app.devin.ai/sessions/5d19efa113054ca4953d9ed9309ce705
Requested by: @ElFariss

Adds a new Monitoring view to the Bubble Tea TUI that mirrors the
Prometheus/Grafana surface now shipping in concave-web.

- internal/monitoring: small HTTP prober that probes /-/healthy,
  /api/v1/status/buildinfo and /api/health, plus a Query() helper
  that reduces a PromQL vector to its first scalar sample.
- cmd/concave-tui/config: new [monitoring] section with
  prometheus_url and grafana_url (empty by default; disables the
  view when both are blank).
- cmd/concave-tui/model/monitoring.go: MonitoringModel, wired into
  RootModel between Fleet and Teams. Gracefully renders a guidance
  card when no URLs are configured, a badge per service with
  version info when reachable, and a PromQL snapshot (targets up,
  CPU busy, memory available, root filesystem free, GPU util).
- Existing visibleViews-order tests updated for the new view index.
- Unit tests cover reachability parsing, PromQL scalar extraction,
  error paths, and view rendering with a stubbed prober.
@devin-ai-integration

Copy link
Copy Markdown
Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

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.

1 participant