Skip to content

vllm.distributed.kv_transfer.kv_connector.v1.offloading.metrics

Classes:

OffloadPromMetrics

Bases: KVConnectorPromMetrics

Methods:

  • observe –

    Observe transfer statistics.

_observe_info(info, engine_idx)

Publish the static config facts of one engine, one series per mapping.

The spec declares the label names, so a payload only fills them. A declared name that no series fills reads empty on every series. A payload name that the spec did not declare is dropped. Either gap logs once.

The check covers the payload as a whole, and not one series, because the declaration holds the names of every series. A name that one series owns reads empty on the other series by design. A series that leaves a name of its own unfilled therefore stays hidden here.

Parameters:

  • info

    (Sequence[dict[str, Any]]) –

    One mapping of label name to label value for each series, as OffloadingManager.config_info() returns it.

  • engine_idx

    (int) –

    Index of the reporting engine.

observe(transfer_stats_data, engine_idx=0)

Observe transfer statistics.

OffloadingConnectorStats dataclass

Bases: KVConnectorStats

Offloading connector stats use flat metric names as keys.

The data dict is structured using _StatsKey / _MetricType::

{
    _StatsKey.TYPES: {name: _MetricType.*, ...},
    _StatsKey.DATA:  {name: {labelvalues: value, ...}, ...},
    _StatsKey.INFO:  [{labelname: labelvalue, ...}, ...] | None,
}

This structure is self-describing: it survives IPC serialization without needing the full OffloadingMetricMetadata objects on the receiving side.

Counter values are aggregated by summing per-label-tuple, gauge values use the latest snapshot per-label-tuple, and histogram values are lists of observed samples per-label-tuple. Unlabeled metrics use () as their labelvalues tuple.

INFO holds the static config facts of one series each, which the scheduler sends once per process. It stays out of DATA, because its label names are known only when the payload arrives. It holds label names, not metric names, so a manager that accesses its own metrics walks metric_sections().

Methods:

  • increase_counter –

    Increase a counter on the stats payload.

  • metric_sections –

    Return the type section and the value section, in that order.

  • observe_histogram –

    Record a histogram observation on the stats payload.

  • reduce –

    Reduce the observations collected during a time interval to one or

  • set_gauge –

    Set a gauge snapshot on the stats payload.

  • set_info –

    Put the static config facts of this engine on the stats payload.

increase_counter(counter_name, counter_increase_value=1, labelvalues=())

Increase a counter on the stats payload.

metric_sections()

Return the type section and the value section, in that order.

A manager that accesses its own metrics walks these sections. Each one is a mutable reference.

observe_histogram(histogram_name, histogram_value, labelvalues=())

Record a histogram observation on the stats payload.

reduce()

Reduce the observations collected during a time interval to one or more representative values (eg avg/median/sum of the series). This is meant to be called by the logger to produce a summary of the stats for the last time interval.

set_gauge(gauge_name, gauge_value, labelvalues=())

Set a gauge snapshot on the stats payload.

set_info(info)

Put the static config facts of this engine on the stats payload.

Parameters:

  • info

    (Sequence[ConfigInfoMapping]) –

    One mapping of info metric label name to label value for each series, as OffloadingManager.config_info() returns it. An empty mapping still gives one series, with an empty value on every label the spec declared. Values are stringified here, as the Prometheus label values they become, so every frontend reads the same strings.

_ConnectorMetricName

Connector-side metrics emitted by scheduler-side offloading code.

_MetricType

Type tags embedded in the serialized stats payload.

_StatsKey

Top-level keys in the serialized stats dict.

_TransferMetricName

Flat metric names for GPU↔offload-medium transfer operations.

_TransferType

Transfer direction labels for deprecated CPU offload metrics.