Repository navigation
feat(process_health): add application health aggregation #1009
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
martinhavelka (wukchung)
wants to merge
63
commits into
microsoft:main
Choose a base branch
from
wukchung:u/wukchung/application-health
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+12,496
−7,241
Open
Changes from 17 commits
Commits
Show all changes
63 commits
Select commit
Hold shift + click to select a range
b1ff66b
feat(oxidizer_health): add application health aggregation
wukchung 938b0de
docs(oxidizer_health): introduce readiness with a quick start
wukchung e82535b
docs(oxidizer_health): show how to publish and diagnose health changes
wukchung 94963cc
docs(oxidizer_health): distinguish publishers from health states
wukchung 6d43428
refactor(oxidizer_health): aggregate component changes on one worker
wukchung a3f3380
chore(oxidizer_health): declare external types used by public handles
wukchung fc941d9
fix(oxidizer_health): keep orphaned signals local and wait for batch …
wukchung 37d7e88
test(oxidizer_health): verify worker progress, teardown, and health t…
wukchung a908043
fix(oxidizer_health): keep filtered diagnostics out of debug output
wukchung 19f799a
chore(oxidizer_health): sort the workspace dependency
wukchung 792a01e
fix(oxidizer_health): keep readiness false across overlapping failures
wukchung 8016eff
docs(oxidizer_health): link the startup example to Aggregator
wukchung 9b22b0d
test(oxidizer_health): verify coalesced readiness and publisher removal
wukchung 0a37630
test(oxidizer_health): detect an invalid self-join without blocking
wukchung 3f8c81b
docs(oxidizer_health): clarify aggregation and readiness examples
wukchung 6f6998c
docs(oxidizer_health): focus README on aggregation
wukchung 71ddb91
refactor(oxidizer_health): rename HTTP readiness module to kubernetes…
wukchung 82b9184
test(oxidizer_health): observe worker progress without mutation watch…
wukchung dee639f
fix(oxidizer_health): prevent false readiness across failures and rem…
wukchung 0e43b94
perf(oxidizer_health): group diagnostics only when requested
wukchung 2e81f77
fix(oxidizer_health): release queued signals and wake readers when th…
wukchung b60ae13
refactor(oxidizer_health): send registration directly to the worker
wukchung 74d08d5
test(oxidizer_health): wait for a later worker turn before observing …
wukchung 28afbfb
fix(oxidizer_health): declare HTTP adapter types for release planning
wukchung b79ade9
docs(oxidizer_health): distinguish terminal readiness from retained r…
wukchung 73300d1
docs(oxidizer_health): keep startup unready until initialization succ…
wukchung 7ceecd6
docs(oxidizer_health): clarify filter visibility and snapshot lifetime
wukchung 1b17dd7
test(oxidizer_health): map terminal-state mutation to the cursor cont…
wukchung acacd0f
feat(oxidizer_health): add application health framework
wukchung 0b8e85d
style(oxidizer_health): format report example
wukchung 702e2c8
fix(oxidizer_health): construct foldhash maps with defaults
wukchung a10a20a
style(oxidizer_health): elide attribute value lifetimes
wukchung 475acec
test(oxidizer_health): simplify monitor ownership
wukchung aba3e51
test(oxidizer_health): align monitor mutability
wukchung 22ab722
style(oxidizer_health): sort crate manifest
wukchung d873192
test(oxidizer_health): use a fresh terminal monitor cursor
wukchung c28dfbe
test(oxidizer_health): cover typed attributes and report display
wukchung 48ef1be
test(oxidizer_health): cover typed boolean attributes
wukchung 4bb9e97
test(oxidizer_health): cover clone and retirement contracts
wukchung d32ed91
test(oxidizer_health): fail ownership mutants promptly
wukchung ded8609
test(oxidizer_health): map ownership mutants to focused contracts
wukchung cbf70d8
style(oxidizer_health): format report display test
wukchung 341fe1c
feat(oxidizer_health): finalize application health framework
wukchung a1eb73d
docs(oxidizer_health): clarify framework and readiness timing
wukchung 2e5ca60
docs(oxidizer_health): clarify framework and readiness timing
wukchung cae3b0f
refactor(health): rename crate and use observed telemetry
wukchung 4aacef3
chore(health): join transferred pull request history
wukchung fd628e6
test(health): use future assertion helpers
wukchung c6698f2
style(health): sort workspace dependency
wukchung 787f422
fix(process_health): use publishable package identity
wukchung 38882f2
fix(process_health): keep report iterator contract minimal
wukchung 7f11776
fix(process_health): emit worker termination on exit
wukchung 4aca8f7
refactor(process_health): simplify diagnostics API
wukchung ed07ab5
fix(process_health): use path-only test dependency
wukchung ab35ef8
docs(process_health): qualify publisher drop behavior
wukchung 4394b75
test(process_health): close mutation coverage gaps
wukchung e253699
chore(process_health): merge main to resolve conflicts
wukchung e61ab96
test(process_health): await equal-signal worker turn
wukchung c2c058c
test(process_health): synchronize worker failure observation
wukchung 7306581
test(process_health): bound mutation waits
wukchung 717361a
test(process_health): refresh Gamma hints
wukchung 881ab38
test(process_health): use fast Gamma oracles
wukchung 7c31c25
test(process_health): map Gamma to fast oracles
wukchung File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| # Copyright (c) Microsoft Corporation. | ||
| # Licensed under the MIT License. | ||
|
|
||
| [package] | ||
| name = "oxidizer_health" | ||
| description = "Application health aggregation with component reports and HTTP readiness adapters." | ||
| version = "0.1.0" | ||
| readme = "README.md" | ||
| keywords = ["health", "readiness", "diagnostics"] | ||
| categories = ["asynchronous"] | ||
| edition.workspace = true | ||
| rust-version.workspace = true | ||
| authors.workspace = true | ||
| license.workspace = true | ||
| homepage.workspace = true | ||
| include.workspace = true | ||
| repository = "https://github.com/microsoft/oxidizer/tree/main/crates/oxidizer_health" | ||
|
|
||
| [package.metadata.cargo_check_external_types] | ||
| # Filter exposes bitflags iteration; health handles implement ThreadAware. | ||
| allowed_external_types = [ | ||
| "bitflags::iter::Iter", | ||
| "bitflags::iter::IterNames", | ||
| "bitflags::traits::Flags", | ||
| "bitflags::traits::PublicFlags", | ||
| "thread_aware_core::thread_aware::ThreadAware", | ||
| ] | ||
|
|
||
| [package.metadata.docs.rs] | ||
| all-features = true | ||
|
|
||
| [features] | ||
| default = [] | ||
| http = ["dep:http", "dep:tower"] | ||
| request-handler = ["dep:bytesbuf", "dep:http", "dep:http_extensions", "dep:layered", "dep:tick"] | ||
|
|
||
| [dependencies] | ||
| arc-swap.workspace = true | ||
| bitflags.workspace = true | ||
| bytesbuf = { workspace = true, optional = true, features = ["std"] } | ||
| http = { workspace = true, optional = true } | ||
| http_extensions = { workspace = true, optional = true } | ||
| layered = { workspace = true, optional = true } | ||
| performables.workspace = true | ||
| thread_aware = { workspace = true, features = ["std"] } | ||
| tick = { workspace = true, optional = true } | ||
| tower = { workspace = true, optional = true } | ||
| tracing.workspace = true | ||
|
wukchung marked this conversation as resolved.
Resolved
|
||
|
|
||
| [dev-dependencies] | ||
| bytesbuf = { path = "../bytesbuf", default-features = false, features = ["std"] } | ||
| ctor.workspace = true | ||
| futures = { workspace = true, features = ["executor"] } | ||
| http.workspace = true | ||
| http_extensions = { path = "../http_extensions", default-features = false, features = ["test-util"] } | ||
| layered = { path = "../layered", default-features = false } | ||
| static_assertions.workspace = true | ||
| testing_aids = { path = "../testing_aids" } | ||
| tick = { path = "../tick", default-features = false } | ||
| tower = { workspace = true, features = ["util"] } | ||
|
|
||
| # >>> anvil-managed: anvil-lints | ||
| [lints] | ||
| workspace = true | ||
| # <<< anvil-managed: anvil-lints | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,135 @@ | ||
| <div align="center"> | ||
| <img src="https://raw.githubusercontent.com/microsoft/oxidizer/refs/heads/main/logo.svg" alt="Oxidizer Health Logo" width="96"> | ||
|
|
||
| # Oxidizer Health | ||
|
|
||
| [](https://crates.io/crates/oxidizer_health) | ||
| [](https://docs.rs/oxidizer_health) | ||
| [](https://crates.io/crates/oxidizer_health) | ||
| [](https://github.com/microsoft/oxidizer/actions/workflows/anvil-pr.yml) | ||
| [](https://codecov.io/gh/microsoft/oxidizer) | ||
| [](https://github.com/microsoft/oxidizer/blob/main/LICENSE) | ||
| <a href="https://github.com/microsoft/oxidizer"><img src="https://raw.githubusercontent.com/microsoft/oxidizer/refs/heads/main/logo.svg" alt="This crate was developed as part of the Oxidizer project" width="20"></a> | ||
|
|
||
| </div> | ||
|
|
||
| Health signal collection, aggregation, and HTTP readiness helpers for Rust services. | ||
|
|
||
| [`Publisher`][__link0]s collect application-defined health signals into named [`Component`][__link1]s. | ||
| Each component aggregates its publishers, and an [`Aggregator`][__link2] combines the components into | ||
| an overall service state: [`Healthy`][__link3], [`Degraded`][__link4], or | ||
| [`Unhealthy`][__link5]. At each level, the worst state wins. | ||
| [Reports][__link6] retain diagnostic attributes and publisher counts, while the optional | ||
| [Kubernetes HTTP helpers][__link7] expose readiness | ||
| through Tower or [`http_extensions`][__link8]. | ||
|
|
||
| ## Quick start | ||
|
|
||
| Create an [`Aggregator`][__link9], register an application-defined component, and publish a health signal. | ||
| [`Aggregator::component`][__link10] creates the named component on first use; subsequent calls with the | ||
| same name return a handle to that component. The name identifies a subsystem, not a built-in check. | ||
|
|
||
| ```rust | ||
| use oxidizer_health::{Aggregator, Health}; | ||
|
|
||
| let aggregator = Aggregator::new(); | ||
| let backend = aggregator.component("backend"); | ||
| let mut monitor = aggregator.monitor(); | ||
| let mut publisher = backend.publisher(); | ||
|
|
||
| publisher.degraded("connection pool exhausted"); | ||
| while monitor.state() != Health::Degraded { | ||
| monitor.changed().await; | ||
| } | ||
| assert_eq!(monitor.state(), Health::Degraded); | ||
| ``` | ||
|
|
||
| Publishing updates the local [`Signal`][__link11] immediately; aggregation runs in the background. | ||
| [`Monitor::changed`][__link12] notifies observers when state or report data may have changed. | ||
| Re-read the current state after each notification, as updates can coalesce. | ||
|
|
||
| Dropping a publisher removes its contribution; dropping the last [`Component`][__link13] handle unregisters | ||
| the component. A component without publishers is `Unhealthy`, as is an [`Aggregator`][__link14] without components. | ||
|
|
||
| ## Diagnose a change | ||
|
|
||
| A read-only [`Monitor`][__link15] provides component reports independently of publishers. | ||
| This example publishes a problem, waits for aggregation, and prints its diagnostic signal: | ||
|
|
||
| ```rust | ||
| use oxidizer_health::{Aggregator, Filter, Health}; | ||
|
|
||
| let aggregator = Aggregator::new(); | ||
| let backend = aggregator.component("backend"); | ||
| let mut monitor = aggregator.monitor(); | ||
| let mut publisher = backend.publisher(); | ||
| publisher.degraded("connection pool exhausted"); | ||
| while monitor.state() != Health::Degraded { | ||
| monitor.changed().await; | ||
| } | ||
|
|
||
| for report in monitor.reports(Filter::DEGRADED | Filter::UNHEALTHY).await { | ||
| println!("{report}"); | ||
| for state in [Health::Degraded, Health::Unhealthy] { | ||
| for (signal, count) in report.signals(state) { | ||
| println!(" {signal} ({count} publishers)"); | ||
| } | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| Reports group identical signals and count their publishers. [`Filter`][__link16] selects diagnostic | ||
| signals; all registered components and their aggregate states remain in the reports. | ||
| An empty component has an `Unhealthy` summary with no signals. For continuous observation, | ||
| read the reports, await [`Monitor::changed`][__link17], and repeat. | ||
|
|
||
| ## Features | ||
|
|
||
| * `http` enables the [Tower readiness service][__link18]. | ||
| * `request-handler` enables the [`http_extensions` readiness handler][__link19]. | ||
|
|
||
| No features are enabled by default. Collection, aggregation, change notifications, and reports | ||
| are available in the default configuration. | ||
|
|
||
| ## Additional documentation | ||
|
|
||
| * Register a [`Component`][__link20] with [`Aggregator::component`][__link21] and report changes with [`Publisher::publish`][__link22]. | ||
| * Get a read-only [`Monitor`][__link23] with [`Aggregator::monitor`][__link24] to observe changes independently of publishers. | ||
| * Select diagnostic signals with [`Filter`][__link25] and inspect their attributes and publisher counts with [`Report::signals`][__link26]. | ||
| * Serve readiness with one of the [Kubernetes HTTP adapters][__link27]. | ||
|
|
||
|
|
||
| <hr/> | ||
| <sub> | ||
| This crate was developed as part of <a href="https://github.com/microsoft/oxidizer">The Oxidizer Project</a>. Browse this crate's <a href="https://github.com/microsoft/oxidizer/tree/main/crates/oxidizer_health">source code</a>. | ||
| </sub> | ||
|
|
||
| [__cargo_doc2readme_dependencies_info]: ggGmYW0CYXZlMC43LjNhdIQborR2_k_xJd4bTcf2krrNPIcbP72Pw1UdRjkbim_eMDe2BBthYvRhcoQb8jQ9lj2XPi8b7yhWCRw1-yobiz3jGP3aJcsb5-dYyF9Q4KZhZIGCb294aWRpemVyX2hlYWx0aGUwLjEuMA | ||
| [__link0]: https://docs.rs/oxidizer_health/0.1.0/oxidizer_health/?search=Publisher | ||
| [__link1]: https://docs.rs/oxidizer_health/0.1.0/oxidizer_health/?search=Component | ||
| [__link10]: https://docs.rs/oxidizer_health/0.1.0/oxidizer_health/?search=Aggregator::component | ||
| [__link11]: https://docs.rs/oxidizer_health/0.1.0/oxidizer_health/?search=Signal | ||
| [__link12]: https://docs.rs/oxidizer_health/0.1.0/oxidizer_health/?search=Monitor::changed | ||
| [__link13]: https://docs.rs/oxidizer_health/0.1.0/oxidizer_health/?search=Component | ||
| [__link14]: https://docs.rs/oxidizer_health/0.1.0/oxidizer_health/?search=Aggregator | ||
| [__link15]: https://docs.rs/oxidizer_health/0.1.0/oxidizer_health/?search=Monitor | ||
| [__link16]: https://docs.rs/oxidizer_health/0.1.0/oxidizer_health/?search=Filter | ||
| [__link17]: https://docs.rs/oxidizer_health/0.1.0/oxidizer_health/?search=Monitor::changed | ||
| [__link18]: https://docs.rs/oxidizer_health/latest/oxidizer_health/kubernetes_http/fn.service.html | ||
| [__link19]: https://docs.rs/oxidizer_health/latest/oxidizer_health/kubernetes_http/fn.request_handler.html | ||
| [__link2]: https://docs.rs/oxidizer_health/0.1.0/oxidizer_health/?search=Aggregator | ||
| [__link20]: https://docs.rs/oxidizer_health/0.1.0/oxidizer_health/?search=Component | ||
| [__link21]: https://docs.rs/oxidizer_health/0.1.0/oxidizer_health/?search=Aggregator::component | ||
| [__link22]: https://docs.rs/oxidizer_health/0.1.0/oxidizer_health/?search=Publisher::publish | ||
| [__link23]: https://docs.rs/oxidizer_health/0.1.0/oxidizer_health/?search=Monitor | ||
| [__link24]: https://docs.rs/oxidizer_health/0.1.0/oxidizer_health/?search=Aggregator::monitor | ||
| [__link25]: https://docs.rs/oxidizer_health/0.1.0/oxidizer_health/?search=Filter | ||
| [__link26]: https://docs.rs/oxidizer_health/0.1.0/oxidizer_health/?search=Report::signals | ||
| [__link27]: https://docs.rs/oxidizer_health/latest/oxidizer_health/kubernetes_http/ | ||
| [__link3]: https://docs.rs/oxidizer_health/0.1.0/oxidizer_health/?search=Health::Healthy | ||
| [__link4]: https://docs.rs/oxidizer_health/0.1.0/oxidizer_health/?search=Health::Degraded | ||
| [__link5]: https://docs.rs/oxidizer_health/0.1.0/oxidizer_health/?search=Health::Unhealthy | ||
| [__link6]: https://docs.rs/oxidizer_health/0.1.0/oxidizer_health/?search=Report | ||
| [__link7]: https://docs.rs/oxidizer_health/latest/oxidizer_health/kubernetes_http/ | ||
| [__link8]: https://docs.rs/http_extensions | ||
| [__link9]: https://docs.rs/oxidizer_health/0.1.0/oxidizer_health/?search=Aggregator |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.