service_stats
Read live CPU, memory, network and PID usage for a running service to see how much a healthy service consumes. Branch on the available flag: null counters mean unknown, not idle.
Instructions
Get live CPU, memory, network and PID usage for a running service.
Returns ``{available, stats: {cpu_pct, mem_used_bytes, mem_limit_bytes,
mem_pct, net_rx_bytes, net_tx_bytes, pids}, gpus, cached}``.
**Branch on ``available``, never on zeroes.** ``available: false`` with
``stats: null`` is the normal answer when the service has no running
container or the daemon cannot reach Docker; every individual counter
is likewise ``null`` when unknown, so a missing metric never
masquerades as an idle one. ``cpu_pct`` follows the docker convention —
``100.0`` is one fully-used core, so a multi-core host can exceed 100.
For *why* a service is unhealthy use ``diagnose_service``; this tool
answers *how much* a healthy one is consuming. The daemon caches the
sample for 2 seconds, so polling it in a loop is cheap.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Service name or job id of an existing service (app, model or database); both resolve to the same row. |