Skip to content

Add the tpu_raiden_host_memory_breakdown_bytes (host_memory_breakdown_bytes) gauge metric to TPU Raiden telemetry to expose a 4-component breakdown of host DRAM usage in bytes ({component}): - #1395

Open
copybara-service[bot] wants to merge 1 commit into
mainfrom
test_1009082311

Conversation

@copybara-service

Copy link
Copy Markdown

Add the tpu_raiden_host_memory_breakdown_bytes (host_memory_breakdown_bytes) gauge metric to TPU Raiden telemetry to expose a 4-component breakdown of host DRAM usage in bytes ({component}):

  • kv_pool: bytes allocated to the Raiden host DRAM KV pool (allocated_host_dram_bytes_).
  • process_heap: non-KV-pool anonymous/heap memory (AnonPages * 1024 - kv_pool_bytes, clamped to >= 0 so kv_pool and process_heap do not double-count anonymous KV pool buffers).
  • page_cache: OS file-backed page cache ((Buffers + Cached) * 1024).
  • free: free host DRAM (MemFree * 1024).

Key details:

  • Registered kHostMemoryBreakdownBytes (MetricType::kGauge, label schema {component}) in metrics_backend.h and kAllMetrics.
  • Omitted host_ip from the metric label schema per cl/999559868 because Prometheus/GMP automatically attaches the host/pod IP via target labels (instance and pod), which XEye's _extract_host_ip parses directly.
  • Added ParseHostMemoryBreakdown, UpdateHostMemoryBreakdownMetrics, and throttled MaybeUpdateHostMemoryBreakdownMetrics (5-second interval using a lock-free atomic timestamp) in KVCacheManagerBase, gated to the primary local worker (local_rank == "0") so multi-worker SHM aggregation does not multiply host-wide /proc/meminfo gauges across ranks.
  • Added unit tests in metrics_api_test.cc, telemetry_binding_test.py, and kv_cache_manager_test.cc.

@copybara-service
copybara-service Bot force-pushed the test_1009082311 branch 3 times, most recently from ec007ab to 63481fa Compare October 29, 2026 16:15
…own_bytes`) gauge metric to TPU Raiden telemetry to expose a 4-component breakdown of host DRAM usage in bytes (`{component}`):

- `kv_pool`: bytes allocated to the Raiden host DRAM KV pool (`allocated_host_dram_bytes_`).
- `process_heap`: non-KV-pool anonymous/heap memory (`AnonPages * 1024 - kv_pool_bytes`, clamped to `>= 0` so `kv_pool` and `process_heap` do not double-count anonymous KV pool buffers).
- `page_cache`: OS file-backed page cache (`(Buffers + Cached) * 1024`).
- `free`: free host DRAM (`MemFree * 1024`).

Key details:
- Registered `kHostMemoryBreakdownBytes` (`MetricType::kGauge`, label schema `{component}`) in `metrics_backend.h` and `kAllMetrics`.
- Omitted `host_ip` from the metric label schema per cl/999559868 because Prometheus/GMP automatically attaches the host/pod IP via target labels (`instance` and `pod`), which XEye's `_extract_host_ip` parses directly.
- Added `ParseHostMemoryBreakdown`, `UpdateHostMemoryBreakdownMetrics`, and throttled `MaybeUpdateHostMemoryBreakdownMetrics` (5-second interval using a lock-free atomic timestamp) in `KVCacheManagerBase`, gated to the primary local worker (`local_rank == "0"`) so multi-worker SHM aggregation does not multiply host-wide `/proc/meminfo` gauges across ranks.
- Added unit tests in `metrics_api_test.cc`, `telemetry_binding_test.py`, and `kv_cache_manager_test.cc`.

PiperOrigin-RevId: 1009082311
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