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

kubernetes-sigs / inference-perf / 43153644407
87%

Build:
DEFAULT BRANCH: main
Ran 12 Nov 2026 04:27AM 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:15AM UTC coverage: 86.411% (+0.003%) from 86.408%
43153644407

push

github

web-flow
circuit-breaker: store HitSample.ts as float seconds (#1068)

Fixes #1060

## Old behavior

`HitSample.ts` was typed as `datetime`. `SimpleCircuitBreaker.feed()`
mapped `RequestLifecycleMetric.end_time` and `time.perf_counter()`
seconds onto `_MONOTONIC_ORIGIN = datetime(2000, 1, 1)` via
`timedelta(seconds=sample_time)`, and `RateOverWindow` converted
`window_sec` to `datetime.timedelta` for sliding-window eviction and
ordering.

## New behavior

`HitSample.ts` stores monotonic `float` seconds directly:
- `SimpleCircuitBreaker.feed()` passes `sample_time` straight to
`HitSample(sample_time, hit)` with `_MONOTONIC_ORIGIN` and
`datetime`/`timedelta` conversions removed.
- `RateOverWindow` stores `self.size = float(window_sec)` and compares
timestamps directly in `float` seconds.

## Changes

* `inference_perf/circuit_breaker/triggers/base.py`: Change
`HitSample.ts` from `datetime` to `float` and remove unused `datetime`
import.
* `inference_perf/circuit_breaker/simple_breaker.py`: Remove
`_MONOTONIC_ORIGIN` and `datetime`/`timedelta` imports; pass
`sample_time` directly to `HitSample`.
* `inference_perf/circuit_breaker/triggers/rate_over_window.py`: Replace
`datetime.timedelta(seconds=window_sec)` with `float(window_sec)` and
remove `import datetime`.
* `tests/required/circuit_breaker/test_request_timing.py`: Use `float`
seconds for hand-constructed `HitSample` timelines and drop
`test_request_time_mapping_preserves_microsecond_precision` (an existing
test `test_collector_window_uses_request_completion_times` keeps its
`simple_breaker.datetime` mock with `create=True`).
* `tests/required/circuit_breaker/test_triggers.py`: Use `float` seconds
for `HitSample` timelines and drop `BASE` and `datetime`/`timedelta`
imports.

## Validation

* `pdm run validate`
* `pdm run pytest tests/required/circuit_breaker` (`44 passed`)
* `TERM=xterm-256color pdm run test` (`3253 passed, 17 skipped`)
* `TERM=xterm-256color pdm run check:cov` (`86.41%`, meets floor and
base... (continued)

3 of 3 new or added lines in 3 files covered. (100.0%)

13742 of 15903 relevant lines covered (86.41%)

0.86 hits per line

Jobs
ID Job ID Ran Files Coverage
1 43153644407.1 12 Nov 2026 04:27AM UTC 141
86.41
GitHub Action Run
Source Files on build 43153644407
  • Tree
  • List 141
  • Changed 4
  • Source Changed 3
  • Coverage Changed 4
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • Github Actions Build #43153644407
  • 6d4b9c8a on github
  • Prev Build on main (#43102138070)
  • Next Build on main (#43155405771)
  • 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