Skip to content

Proposal: fix image_pulling_throughput to exclude cached layer bytes #13244

Open

Description

@ahmetb

What is the problem you're trying to solve

Background: image_pulling_throughput divides the whole image size (all layers + config) by how long the pull took. Layers that were already in the content store (i.e. cached) still get counted in this metric, so the MB/s comes out way higher than what actually went over the network.

Fully cached pulls really skew the data: they pull in ~milliseconds but still report the full image size, so the histogram picks up these huge outliers, making the whole metric unusable in a real-world setting.

This problem was actually flagged when the metric was added in #7313:

the current thoughtput is not taking already exist layers or image into account. (This means the metrics will show a quick pulling for existing images. As user always want to know which image pulling is slow, this can be fixed later.)

Most pulls hit cache at least partially in practice in a multi-tenant cluster, so the histogram ends up mostly noisy and isn't really useful for spotting slow pulls.

Describe the solution you'd like

  1. Use the bytes actually fetched from the registry, not the declared image size.
    For pulls that didn't fetch anything (fully cached) skip recording a sample.

  2. Preserve original metric image_pulling_throughput, but deprecate it because its bucket are useless on modern hardware.

  3. Introduce image_pulling_throughput_mibps metric

    The HELP text of the Prometheus metric should say what the duration actually covers. It's the whole pull including layer extraction and unpack, not just network transfer (this is not obvious from the metric name today).

Additional context

I have a PR ready if there's interest.

/area metrics
/kind enhancement

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions