Repository navigation
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
Conversation
copybara-service
Bot
force-pushed
the
test_1009082311
branch
3 times, most recently
from
October 29, 2026 16:15
ec007ab to
63481fa
Compare
…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
copybara-service
Bot
force-pushed
the
test_1009082311
branch
from
October 31, 2026 20:27
63481fa to
6d8cb98
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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>= 0sokv_poolandprocess_heapdo 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:
kHostMemoryBreakdownBytes(MetricType::kGauge, label schema{component}) inmetrics_backend.handkAllMetrics.host_ipfrom the metric label schema per cl/999559868 because Prometheus/GMP automatically attaches the host/pod IP via target labels (instanceandpod), which XEye's_extract_host_ipparses directly.ParseHostMemoryBreakdown,UpdateHostMemoryBreakdownMetrics, and throttledMaybeUpdateHostMemoryBreakdownMetrics(5-second interval using a lock-free atomic timestamp) inKVCacheManagerBase, gated to the primary local worker (local_rank == "0") so multi-worker SHM aggregation does not multiply host-wide/proc/meminfogauges across ranks.metrics_api_test.cc,telemetry_binding_test.py, andkv_cache_manager_test.cc.