Skip to content

feat(actuator): public install_health_indicators container scan (v26.06.98)#128

Merged
ancongui merged 1 commit into
mainfrom
feat/actuator-public-indicator-scan
Jun 12, 2026
Merged

feat(actuator): public install_health_indicators container scan (v26.06.98)#128
ancongui merged 1 commit into
mainfrom
feat/actuator-public-indicator-scan

Conversation

@ancongui

Copy link
Copy Markdown
Contributor

Summary

  • Promote the HealthIndicator container scan from private closures in the FastAPI/Starlette create_app factories to a public, documented helper: pyfly.actuator.install_health_indicators(context, aggregator, *, groups=None).
  • Built on the container's public registered_types() / get_registration() surface — no more container._registrations access.
  • All four adapter call sites (actuator + admin paths, both adapters) delegate to it; behavior is preserved (idempotent rescan, bean-name-over-class-name, uninstantiated beans skipped).
  • HealthAggregator.has_indicator(name) added; add_indicator defensively copies the groups set.
  • Exported install_health_indicators and build_actuator_routes from pyfly.actuator.

Out-of-web-stack processes (e.g. flydocs' EDA workers serving /actuator/health/* for Kubernetes httpGet probes) can now wire indicators without copying framework internals.

Testing

  • 6 new tests in tests/actuator/test_health_indicators_wiring.py (scan, None-context no-op, bean-name precedence, idempotent rescan preserving existing registrations, groups= membership, uninstantiated-bean skip).
  • Full suite: 4714 passed. ruff check, ruff format --check, mypy src (strict) all clean.

…ase v26.06.98

The HealthIndicator container scan existed only as private closures in
the FastAPI and Starlette create_app factories, each reaching into
container._registrations. Promote it to a public, documented helper —
pyfly.actuator.install_health_indicators — built on the container's
public registered_types()/get_registration() surface, with a groups=
parameter for probe-group membership, and export it together with
build_actuator_routes from pyfly.actuator. All four adapter call sites
(actuator + admin, both adapters) now delegate to it, so standalone
processes (e.g. EDA workers serving /actuator/health/* from their own
Starlette app) can wire indicators without copying framework internals.
HealthAggregator gains has_indicator() and defensively copies the
groups set on add_indicator().
@ancongui ancongui merged commit 3a501c0 into main Jun 12, 2026
6 checks passed
@ancongui ancongui deleted the feat/actuator-public-indicator-scan branch June 12, 2026 09:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant