Skip to content

feat(vindex/metrics): add OS memory pressure, paging, disk I/O, and host capacity metrics - #206

Merged
mhutchinson merged 1 commit into
transparency-dev:mainfrom
mhutchinson:feat/hardware-pressure-metrics
Dec 1, 2026
Merged

mhutchinson merged 1 commit into
transparency-dev:mainfrom
mhutchinson:feat/hardware-pressure-metrics

Conversation

@mhutchinson

Copy link
Copy Markdown
Contributor

Summary

Adds a lightweight, read-only scrape-time Prometheus Collector in vindex/internal/metrics (auto-registered on prometheus.DefaultRegisterer, zero new dependencies) so operators can immediately diagnose undersized VMs, memory paging/swap thrashing, disk I/O saturation, and CPU starvation from a single /metrics scrape or Grafana dashboard.

New Metrics

Metric Type Source Platform
vindex_process_major_page_faults_total Counter getrusage(RUSAGE_SELF).Majflt Unix (Linux, macOS, BSD)
vindex_process_swap_bytes Gauge /proc/self/status (VmSwap) Linux
vindex_process_rss_anon_bytes Gauge /proc/self/status (RssAnon) Linux
vindex_process_rss_file_bytes Gauge /proc/self/status (RssFile) Linux
vindex_process_io_read_bytes_total Counter /proc/self/io (read_bytes) Linux
vindex_process_io_write_bytes_total Counter /proc/self/io (write_bytes) Linux
vindex_memory_psi_some_seconds_total Counter /proc/pressure/memory (some) Linux >=4.20
vindex_memory_psi_full_seconds_total Counter /proc/pressure/memory (full) Linux >=4.20
vindex_io_psi_some_seconds_total Counter /proc/pressure/io (some) Linux >=4.20
vindex_io_psi_full_seconds_total Counter /proc/pressure/io (full) Linux >=4.20
vindex_cpu_psi_some_seconds_total Counter /proc/pressure/cpu (some) Linux >=4.20
vindex_host_memory_total_bytes Gauge /proc/meminfo (MemTotal) Linux
vindex_host_memory_available_bytes Gauge /proc/meminfo (MemAvailable) Linux
vindex_host_cpus Gauge runtime.NumCPU() All

Grafana Dashboard

  • Adds a Hardware & Resource Pressure row to deploy/sumdb/grafana/dashboards/sumdb_overview.json with panels for Memory/Swap vs Host RAM Headroom, Linux PSI Stall Fraction (Memory/I/O/CPU), Process Physical Disk I/O, Major Page Fault Rate, and CPU Utilization (% of Host CPUs).

Verification

  • go test -race -v ./vindex/internal/metrics/... (includes prometheus.NewPedanticRegistry(), testutil.GatherAndCompare, testutil.GatherAndLint, missing-/proc fallback, and live default-registry smoke test)
  • go vet ./vindex/internal/metrics/...
  • Cross-compile verified for GOOS=darwin GOARCH=arm64 and GOOS=windows GOARCH=amd64
  • Validated deploy/sumdb/grafana/dashboards/sumdb_overview.json with python3 -m json.tool

@mhutchinson
mhutchinson requested a review from patflynn November 30, 2026 14:53
@mhutchinson
mhutchinson merged commit 267a6c3 into transparency-dev:main Dec 1, 2026
12 checks passed
@mhutchinson mhutchinson mentioned this pull request Dec 3, 2026
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.

2 participants