API Reference¶
Hook¶
Kedro hook that samples system resources in a background thread and dispatches metrics to one or more pluggable sinks.
Sampled metrics (all can be disabled by passing False): - {prefix}.mem.rss_mb — RSS memory across main process + children - {prefix}.mem.swap_mb — system swap usage - {prefix}.cpu.percent — system-wide CPU utilisation - {prefix}.io.read_mb — disk read delta since last sample - {prefix}.io.write_mb — disk write delta since last sample - {prefix}.net.sent_mbs — network bytes sent per second - {prefix}.net.recv_mbs — network bytes received per second
Each metric is tagged with the currently-running Kedro node name.
Example (settings.py)::
from kedro_psutil_telemetry.hook import PipelinePsutilTelemetry, mlflow_sink
HOOKS = (
PipelinePsutilTelemetry(interval=0.5, sink=mlflow_sink),
)
Sinks¶
Bases: Protocol
Interface for telemetry destinations.
Called once per metric per sample. Implementations must be thread-safe as they are invoked from the background monitoring thread.
Sink that logs metrics via the Python logger.
Sink that logs metrics to an active MLflow run.
Tags are not forwarded — MLflow does not support per-metric tags. No-op if MLflow is not installed or no run is active.