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

hyperglass-community / hyperglass / 44912266850
87%

Build:
DEFAULT BRANCH: main
Ran 21 Nov 2026 02:08PM UTC
Jobs 2
Files 441
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

21 Nov 2026 02:07PM UTC coverage: 85.71% (+0.3%) from 85.367%
44912266850

push

github

web-flow
feat(api): add optional Prometheus metrics (#526)

* feat(api): add optional Prometheus metrics

Operators could not see whether queries were failing, on which device,
or why, without reading logs. Expose Prometheus metrics behind
`metrics.enable`, off by default because the endpoint is unauthenticated.

Query metrics count outcomes and failure reasons per device and directive,
time device execution on cache misses, and count cache hits and misses.
Failures are recorded from the existing exception handlers, so the
overall execution deadline (DeviceTimeout), state-unavailable 503s and
request validation errors are all attributed without new error types.
Label values come only from validated device and directive ids and
exception class names; failures before validation are labeled `unknown`,
so request input cannot inflate cardinality. Recording is best-effort and
can never fail a query. HTTP metrics come from Litestar's Prometheus
middleware, labeled by route template.

uvicorn workers are separate processes, so `hyperglass start` points
PROMETHEUS_MULTIPROC_DIR at a fresh directory under the system temporary
directory (writable by the image's non-root user, unlike the app path's
parents) and removes it on exit, or empties a configured one. The metrics
endpoint skips the state recovery hook so it still answers during a Redis
outage.

App construction moves into create_app() so tests can build an app with
metrics enabled; the module-level `app` is unchanged.

Closes #519.

* fix(api): count a failed query once when its error handler fails

During a Redis outage default_handler fails while reading params, and
Litestar then calls an exception handler again for the same request. Both
calls recorded the failure, so one failed query was counted twice. Mark
the request once its failure is recorded.

465 of 754 branches covered (61.67%)

Branch coverage included in aggregate %.

327 of 330 new or added lines in 8 files covered. (99.09%)

17727 of 20471 relevant lines covered (86.6%)

6.65 hits per line

Uncovered Changes

Lines Coverage ∆ File
2
97.33
hyperglass/api/metrics.py
1
99.51
hyperglass/util/tests/test_metrics_endpoint.py
Jobs
ID Job ID Ran Files Coverage
1 backend - 44912266850.1 21 Nov 2026 02:09PM UTC 317
87.91
GitHub Action Run
2 frontend - 44912266850.2 21 Nov 2026 02:08PM UTC 124
70.36
GitHub Action Run
Source Files on build 44912266850
  • Tree
  • List 441
  • Changed 11
  • Source Changed 5
  • Coverage Changed 11
Coverage ∆ File Lines Relevant Covered Missed Hits/Line Branch Hits Branch Misses
  • Back to Repo
  • Github Actions Build #44912266850
  • 849ab0e0 on github
  • Prev Build on main (#44871735296)
  • Next Build on main (#44912338157)
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