Skip to content

feat(selfhost): GPU + AI-provider observability (exporter, Prometheus, dashboard) - #4536

Merged
JSONbored merged 1 commit into
mainfrom
feat/gpu-selfhost-observability
Jul 9, 2026
Merged

feat(selfhost): GPU + AI-provider observability (exporter, Prometheus, dashboard)#4536
JSONbored merged 1 commit into
mainfrom
feat/gpu-selfhost-observability

Conversation

@JSONbored

Copy link
Copy Markdown
Owner

Summary

  • gpu-exporter service (utkuozdemir/nvidia_gpu_exporter:1.3.2), own --profile gpu, matching the existing ollama/postgres-exporter style (<<: *default-logging, expose not ports, device reservation only evaluated once the profile is activated)
  • New gpu Prometheus scrape job — absent/down gracefully on a non-GPU install, no alert fires on it, mirroring the existing postgres/gittensory-backup job comments
  • New gittensory_ai_provider_request_duration_seconds histogram + gittensory_ai_provider_request_errors_total counter in src/selfhost/metrics.ts, labeled by provider/request_kind, instrumented in runProviderWithOtel (src/selfhost/ai.ts) around the existing withReviewSpan call — the error counter mirrors gittensory_ai_provider_failures_total's exemption for expected embedding-routing fallbacks (verified via 4 new tests)
  • grafana/dashboards/gpu-metrics.json: GPU Summary (utilization/VRAM/temp/power stat panels), AI Request Performance (rate, p50/p95/p99 latency via histogram_quantile, error rate), GPU Trends (all four metrics over time, including VRAM used-vs-total)
  • Resource-footprint table entry in the self-hosting operations docs (no new .env.example var — nothing here needs one; the gpu-exporter has no tunable settings worth exposing, matching sibling exporters)

Notes

  • Metric names for the exporter (nvidia_smi_utilization_gpu_ratio, nvidia_smi_memory_used_bytes/_total_bytes, nvidia_smi_temperature_gpu, nvidia_smi_power_draw_watts) and its default port (9835) verified against the exporter's own docs, not guessed
  • requestKind() stays "embedding" | "review" for now — extending it to vision/advisory is real future work once those call paths are distinguishable at this exact function, not done speculatively here

Test plan

  • npx vitest run test/unit/selfhost-ai.test.ts test/unit/selfhost-metrics.test.ts (182 tests)
  • npx tsc --noEmit clean on touched files (pre-existing unrelated drift in miner-opportunity-ranker.test.ts untouched)
  • docker compose config --quiet resolves cleanly
  • JSON/YAML validated

Part of #4325 (closed). Fixes #4367

…, dashboard)

- gpu-exporter service (utkuozdemir/nvidia_gpu_exporter:1.3.2), own
  --profile gpu, matching the ollama/postgres-exporter style
- gpu Prometheus scrape job, absent/down gracefully on non-GPU installs
- New gittensory_ai_provider_request_duration_seconds histogram and
  gittensory_ai_provider_request_errors_total counter, labeled by
  provider and request_kind, instrumented around the existing
  withReviewSpan call site in runProviderWithOtel — the error counter
  mirrors gittensory_ai_provider_failures_total's exemption for
  expected embedding-routing fallbacks
- grafana/dashboards/gpu-metrics.json: GPU Summary (utilization/VRAM/
  temp/power stats), AI Request Performance (rate/p50-p95-p99 latency/
  error rate), and GPU Trends rows
- Resource-footprint table entry in the self-hosting operations docs

This is the baseline the rest of the GPU-optimization work (embedding
cache, advisory routing, vision-verify) needs to measure real impact
against, rather than one-off manual benchmarks.
@superagent-security

Copy link
Copy Markdown
Contributor

Superagent didn't find any vulnerabilities or security issues in this PR.

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
gittensory-ui 0f71bc6 Commit Preview URL

Branch Preview URL
Jul 09 2026, 11:26 PM

@JSONbored JSONbored self-assigned this Jul 9, 2026
@JSONbored
JSONbored merged commit a43c918 into main Jul 9, 2026
10 checks passed
@JSONbored
JSONbored deleted the feat/gpu-selfhost-observability branch July 9, 2026 23:30
@codecov

codecov Bot commented Jul 9, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.04%. Comparing base (86eeea0) to head (0f71bc6).
⚠️ Report is 3 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4536   +/-   ##
=======================================
  Coverage   94.04%   94.04%           
=======================================
  Files         422      422           
  Lines       37579    37584    +5     
  Branches    13729    13729           
=======================================
+ Hits        35340    35345    +5     
  Misses       1583     1583           
  Partials      656      656           
Files with missing lines Coverage Δ
src/selfhost/ai.ts 98.67% <100.00%> (+0.01%) ⬆️
src/selfhost/metrics.ts 100.00% <ø> (ø)
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

feat(selfhost): GPU + AI-provider observability (exporter, Prometheus, Grafana dashboard)

1 participant