• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

kubernetes-sigs / inference-perf / 43155405771
87%

Build:
DEFAULT BRANCH: main
Ran 12 Nov 2026 04:44AM UTC
Jobs 1
Files 141
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

12 Nov 2026 04:31AM UTC coverage: 86.411%. Remained the same
43155405771

push

github

web-flow
fix(reportgen): report null cache hit percent when zero queries recorded (#1057)

Fixes #1041

## Old behavior

The per-stage and summary Prometheus reports write a cache hit percent
of `0.0` when zero cache queries are recorded. For a stage with zero
cache queries, or a model server that does not declare prefix cache
counters (e.g. SGLang, TGI, which default to `total=0.0`), `_ratio()`
evaluated `(0.0 / 0.0) if den > 0 else 0.0` and returned `0.0`. This
made zero queries indistinguishable from all queries missing, and
disagreed with other report adapters that omit or report null cache hit
rate.

On main before this fix, the tests fail:
```
FAILED tests/required/reportgen/test_session_and_prometheus_reports.py::TestGeneratePrometheusMetricsReport::test_cache_hit_percent_is_null_when_nothing_queried_the_cache - assert 0.0 is None
FAILED tests/required/reportgen/test_session_and_prometheus_reports.py::TestSummarizePrometheusMetricsMissing::test_zero_cache_queries_yields_null_hit_percent - AssertionError: assert {'mean': 0.0} == {'mean': None}
```

## New behavior

`_ratio()` in `inference_perf/reportgen/base.py` returns `None` whenever
`den <= 0`.
- A stage with zero cache queries (or undeclared counters defaulting to
`0.0`) reports `prefix_cache_hit_percent`,
`external_prefix_cache_hit_percent`, and `mm_cache_hit_percent` as
`null` (`None`).
- A stage with queries > 0 and hits == 0 continues to report `0.0%`.
- An existing test
`test_cache_hit_percent_is_zero_when_nothing_queried_the_cache` that
pinned the old `0.0` behavior is updated to
`test_cache_hit_percent_is_null_when_nothing_queried_the_cache`
asserting `None`.

## Changes

* `inference_perf/reportgen/base.py`: Update `_ratio()` to return `None`
when `den <= 0`.
* `tests/required/reportgen/test_session_and_prometheus_reports.py`:
Update `test_cache_hit_percent_is_null_when_nothing_queried_the_cache`
to expect `None`, and add tests for zero cache queries across all cache
types and zero hits with... (continued)

2 of 2 new or added lines in 1 file covered. (100.0%)

13742 of 15903 relevant lines covered (86.41%)

0.86 hits per line

Jobs
ID Job ID Ran Files Coverage
1 43155405771.1 12 Nov 2026 04:44AM UTC 141
86.41
GitHub Action Run
Source Files on build 43155405771
  • Tree
  • List 141
  • Changed 1
  • Source Changed 1
  • Coverage Changed 0
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • Github Actions Build #43155405771
  • a8d9095f on github
  • Prev Build on main (#43153644407)
  • Next Build on main (#43156269305)
  • Delete
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc