Skip to content
Open
Show file tree
Hide file tree
Changes from 13 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 Nov 23, 2026
938b0de
docs(oxidizer_health): introduce readiness with a quick start
wukchung Nov 23, 2026
e82535b
docs(oxidizer_health): show how to publish and diagnose health changes
wukchung Nov 23, 2026
94963cc
docs(oxidizer_health): distinguish publishers from health states
wukchung Nov 23, 2026
6d43428
refactor(oxidizer_health): aggregate component changes on one worker
wukchung Nov 23, 2026
a3f3380
chore(oxidizer_health): declare external types used by public handles
wukchung Nov 23, 2026
fc941d9
fix(oxidizer_health): keep orphaned signals local and wait for batch …
wukchung Nov 23, 2026
37d7e88
test(oxidizer_health): verify worker progress, teardown, and health t…
wukchung Nov 23, 2026
a908043
fix(oxidizer_health): keep filtered diagnostics out of debug output
wukchung Nov 23, 2026
19f799a
chore(oxidizer_health): sort the workspace dependency
wukchung Nov 23, 2026
792a01e
fix(oxidizer_health): keep readiness false across overlapping failures
wukchung Nov 23, 2026
8016eff
docs(oxidizer_health): link the startup example to Aggregator
wukchung Nov 23, 2026
9b22b0d
test(oxidizer_health): verify coalesced readiness and publisher removal
wukchung Nov 23, 2026
0a37630
test(oxidizer_health): detect an invalid self-join without blocking
wukchung Nov 23, 2026
3f8c81b
docs(oxidizer_health): clarify aggregation and readiness examples
wukchung Nov 24, 2026
6f6998c
docs(oxidizer_health): focus README on aggregation
wukchung Nov 24, 2026
71ddb91
refactor(oxidizer_health): rename HTTP readiness module to kubernetes…
wukchung Nov 24, 2026
82b9184
test(oxidizer_health): observe worker progress without mutation watch…
wukchung Nov 24, 2026
dee639f
fix(oxidizer_health): prevent false readiness across failures and rem…
wukchung Nov 24, 2026
0e43b94
perf(oxidizer_health): group diagnostics only when requested
wukchung Nov 24, 2026
2e81f77
fix(oxidizer_health): release queued signals and wake readers when th…
wukchung Nov 24, 2026
b60ae13
refactor(oxidizer_health): send registration directly to the worker
wukchung Nov 24, 2026
74d08d5
test(oxidizer_health): wait for a later worker turn before observing …
wukchung Nov 25, 2026
28afbfb
fix(oxidizer_health): declare HTTP adapter types for release planning
wukchung Nov 25, 2026
b79ade9
docs(oxidizer_health): distinguish terminal readiness from retained r…
wukchung Nov 25, 2026
73300d1
docs(oxidizer_health): keep startup unready until initialization succ…
wukchung Nov 25, 2026
7ceecd6
docs(oxidizer_health): clarify filter visibility and snapshot lifetime
wukchung Nov 25, 2026
1b17dd7
test(oxidizer_health): map terminal-state mutation to the cursor cont…
wukchung Nov 25, 2026
acacd0f
feat(oxidizer_health): add application health framework
wukchung Nov 26, 2026
0b8e85d
style(oxidizer_health): format report example
wukchung Nov 26, 2026
702e2c8
fix(oxidizer_health): construct foldhash maps with defaults
wukchung Nov 26, 2026
a10a20a
style(oxidizer_health): elide attribute value lifetimes
wukchung Nov 26, 2026
475acec
test(oxidizer_health): simplify monitor ownership
wukchung Nov 26, 2026
aba3e51
test(oxidizer_health): align monitor mutability
wukchung Nov 26, 2026
22ab722
style(oxidizer_health): sort crate manifest
wukchung Nov 26, 2026
d873192
test(oxidizer_health): use a fresh terminal monitor cursor
wukchung Nov 26, 2026
c28dfbe
test(oxidizer_health): cover typed attributes and report display
wukchung Nov 26, 2026
48ef1be
test(oxidizer_health): cover typed boolean attributes
wukchung Nov 26, 2026
4bb9e97
test(oxidizer_health): cover clone and retirement contracts
wukchung Nov 26, 2026
d32ed91
test(oxidizer_health): fail ownership mutants promptly
wukchung Nov 26, 2026
ded8609
test(oxidizer_health): map ownership mutants to focused contracts
wukchung Nov 26, 2026
cbf70d8
style(oxidizer_health): format report display test
wukchung Nov 26, 2026
341fe1c
feat(oxidizer_health): finalize application health framework
wukchung Nov 26, 2026
a1eb73d
docs(oxidizer_health): clarify framework and readiness timing
wukchung Nov 26, 2026
2e5ca60
docs(oxidizer_health): clarify framework and readiness timing
wukchung Nov 26, 2026
cae3b0f
refactor(health): rename crate and use observed telemetry
wukchung Nov 27, 2026
4aacef3
chore(health): join transferred pull request history
wukchung Nov 27, 2026
fd628e6
test(health): use future assertion helpers
wukchung Nov 27, 2026
c6698f2
style(health): sort workspace dependency
wukchung Nov 27, 2026
787f422
fix(process_health): use publishable package identity
wukchung Nov 27, 2026
38882f2
fix(process_health): keep report iterator contract minimal
wukchung Nov 27, 2026
7f11776
fix(process_health): emit worker termination on exit
wukchung Nov 27, 2026
4aca8f7
refactor(process_health): simplify diagnostics API
wukchung Nov 27, 2026
ed07ab5
fix(process_health): use path-only test dependency
wukchung Nov 27, 2026
ab35ef8
docs(process_health): qualify publisher drop behavior
wukchung Nov 27, 2026
4394b75
test(process_health): close mutation coverage gaps
wukchung Nov 27, 2026
e253699
chore(process_health): merge main to resolve conflicts
wukchung Nov 27, 2026
e61ab96
test(process_health): await equal-signal worker turn
wukchung Nov 27, 2026
c2c058c
test(process_health): synchronize worker failure observation
wukchung Nov 27, 2026
7306581
test(process_health): bound mutation waits
wukchung Nov 27, 2026
717361a
test(process_health): refresh Gamma hints
wukchung Nov 27, 2026
881ab38
test(process_health): use fast Gamma oracles
wukchung Nov 27, 2026
7c31c25
test(process_health): map Gamma to fast oracles
wukchung Nov 27, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ azure_identity = { version = "1.0.0", default-features = false }
azure_storage_blob = { version = "1.0.0", default-features = false }
backtrace = { version = "0.3.76", default-features = false }
base64 = { version = "0.23.0", default-features = false, features = ["alloc"] }
bitflags = { version = "2.13.2", default-features = false }
bolero = { version = "0.13.4", default-features = false }
bon = { version = "3.10.3", default-features = false }
brotli = { version = "9.0.0", default-features = false }
Expand Down Expand Up @@ -220,6 +221,7 @@ opentelemetry = { version = "0.33.0", default-features = false }
opentelemetry-semantic-conventions = { version = "0.33.0", default-features = false }
opentelemetry_sdk = { version = "0.33.0", default-features = false }
opool = { version = "0.2.0", default-features = false }
oxidizer_health = { path = "crates/oxidizer_health", default-features = false, version = "0.1.0" }
parking_lot = { version = "0.13.0", default-features = false }
paste = { package = "pastey", version = "0.2.3", default-features = false }
path-tree = { version = "0.8.3", default-features = false }
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ These are the primary crates built out of this repo:
- [`observed_destination_memory`](./crates/observed_destination_memory/README.md) - In-memory destination for Observed pipeline.
- [`observed_destination_stdout`](./crates/observed_destination_stdout/README.md) - stdout destination for Observed pipeline.
- [`ohno`](./crates/ohno/README.md) - High-quality Rust error handling.
- [`oxidizer_health`](./crates/oxidizer_health/README.md) - Application health aggregation with component reports and HTTP readiness adapters.
- [`performables`](./crates/performables/README.md) - Thread-aware synchronization and ownership primitives.
- [`plurality`](./crates/plurality/README.md) - A highly efficient pooling memory allocator.
- [`rallocator`](./crates/rallocator/README.md) - Windows, Linux and macOS x64/ARM64 owner-return allocator with Seismograph allocation events.
Expand Down
65 changes: 65 additions & 0 deletions crates/oxidizer_health/Cargo.toml
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",
]
Comment thread
wukchung marked this conversation as resolved.
Resolved

[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
Comment thread
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
142 changes: 142 additions & 0 deletions crates/oxidizer_health/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
<div align="center">
<img src="https://raw.githubusercontent.com/microsoft/oxidizer/refs/heads/main/logo.svg" alt="Oxidizer Health Logo" width="96">

# Oxidizer Health

[![crate.io](https://img.shields.io/crates/v/oxidizer_health.svg)](https://crates.io/crates/oxidizer_health)
[![docs.rs](https://docs.rs/oxidizer_health/badge.svg)](https://docs.rs/oxidizer_health)
[![MSRV](https://img.shields.io/crates/msrv/oxidizer_health)](https://crates.io/crates/oxidizer_health)
[![CI](https://github.com/microsoft/oxidizer/actions/workflows/anvil-pr.yml/badge.svg)](https://github.com/microsoft/oxidizer/actions/workflows/anvil-pr.yml)
[![Coverage](https://codecov.io/gh/microsoft/oxidizer/graph/badge.svg?token=FCUG0EL5TI)](https://codecov.io/gh/microsoft/oxidizer)
[![License](https://img.shields.io/badge/license-MIT-blue.svg)](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>

Component health reports and HTTP readiness checks for Rust services.

A service reports the worst state among its components: `Healthy`, `Degraded`, or `Unhealthy`.
For example, if a database is degraded and a cache is healthy, the service is degraded.
Use the overall state for readiness checks and [component reports][__link0] to find the reason.

## Quick start

Register a component for the database. Use its [`Publisher`][__link1] to report slow queries:

```rust
use oxidizer_health::{Aggregator, Health};

let aggregator = Aggregator::new();
let database = aggregator.component("database");
let mut publisher = database.publisher();

publisher.degraded("slow queries");
assert_eq!(publisher.signal().state(), Health::Degraded);
```

Publishing updates the local signal immediately. [`Aggregator::state`][__link2] reads the latest
aggregate, so it can briefly report the previous state. A component without publishers is
`Unhealthy`, as is a service without components.

## Write a custom health check

Your application decides what to measure, when to measure it, and what counts as unhealthy.
A check is ordinary Rust code that publishes its result.
For example, a database client can count consecutive failures and reset the count after a
successful request. After each request, it passes the current count to this function:

```rust
use oxidizer_health::{Aggregator, Health, Publisher};

fn report_failures(publisher: &mut Publisher, failures: u32) {
let state = match failures {
0 => Health::Healthy,
1..=2 => Health::Degraded,
_ => Health::Unhealthy,
};
publisher.publish(state, [("consecutive_failures", i64::from(failures))]);
}

let aggregator = Aggregator::new();
let database = aggregator.component("database");
let mut publisher = database.publisher();

report_failures(&mut publisher, 3);
assert_eq!(publisher.signal().state(), Health::Unhealthy);

report_failures(&mut publisher, 0);
assert_eq!(publisher.signal().state(), Health::Healthy);
```

These thresholds are the client’s policy. A new publisher starts `Healthy`. Publishing
`Unhealthy` immediately afterward does not prevent a probe from seeing that initial `Healthy`.

If required dependencies must block readiness at startup, register their components on a new
[`Aggregator`][__link3] before creating any publishers or serving probes. Keep each component alive and
empty until its first successful check. An empty component is `Unhealthy`. After success,
create its publisher and reuse it for later failures and recoveries. Dropping the publisher
removes its contribution. Dropping the last [`Component`][__link4] handle unregisters the component.

## Diagnose a change

When readiness is false, a read-only [`Monitor`][__link5] can identify the component and show what its
publishers reported. This observer prints the component summary followed by each distinct problem:

```rust
use oxidizer_health::{Filter, Health, Monitor};

async fn show_problems(monitor: &Monitor) {
for report in monitor.reports(Filter::DEGRADED | Filter::UNHEALTHY).await {
if report.state() == Health::Healthy {
continue;
}
println!("{report}");
for state in [Health::Degraded, Health::Unhealthy] {
for (signal, _) in report.signals(state) {
println!(" {signal}");
}
}
}
}
```

For the quick start, the report names `database` and the signal reads `Degraded (reason=slow queries)`.
The filter selects signals, not components. A component without publishers has an `Unhealthy`
summary but no signal to print. For continuous monitoring, read the reports, await
[`Monitor::changed`][__link6], then read again. Multiple updates can produce one notification.

## HTTP readiness

Health reporting works without HTTP. Enable `http` to use `http::service` with Tower,
or `request-handler` to use `http::request_handler` with `http_extensions`.
Both return HTTP 200 with JSON `true` for `Healthy` and HTTP 503 with JSON `false` otherwise.

## Additional documentation

* Register a [`Component`][__link7] with [`Aggregator::component`][__link8] and report changes with [`Publisher::publish`][__link9].
* Get a read-only [`Monitor`][__link10] with [`Aggregator::monitor`][__link11] to observe changes independently of publishers.
* Select diagnostic signals with [`Filter`][__link12] and inspect their attributes and publisher counts with [`Report::signals`][__link13].
* Serve readiness with one of the [HTTP adapters][__link14].


<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_eMDe2BBthYvRhcoQbQAaznBUfBvQbcDNw_m5OW1Yb2LWTSpdyZSgb5wJ43Y7YvK1hZIGCb294aWRpemVyX2hlYWx0aGUwLjEuMA
[__link0]: https://docs.rs/oxidizer_health/0.1.0/oxidizer_health/?search=Report
[__link1]: https://docs.rs/oxidizer_health/0.1.0/oxidizer_health/?search=Publisher
[__link10]: https://docs.rs/oxidizer_health/0.1.0/oxidizer_health/?search=Monitor
[__link11]: https://docs.rs/oxidizer_health/0.1.0/oxidizer_health/?search=Aggregator::monitor
[__link12]: https://docs.rs/oxidizer_health/0.1.0/oxidizer_health/?search=Filter
[__link13]: https://docs.rs/oxidizer_health/0.1.0/oxidizer_health/?search=Report::signals
[__link14]: https://docs.rs/oxidizer_health/latest/oxidizer_health/http/
[__link2]: https://docs.rs/oxidizer_health/0.1.0/oxidizer_health/?search=Aggregator::state
[__link3]: https://docs.rs/oxidizer_health/0.1.0/oxidizer_health/?search=Aggregator
[__link4]: https://docs.rs/oxidizer_health/0.1.0/oxidizer_health/?search=Component
[__link5]: https://docs.rs/oxidizer_health/0.1.0/oxidizer_health/?search=Monitor
[__link6]: https://docs.rs/oxidizer_health/0.1.0/oxidizer_health/?search=Monitor::changed
[__link7]: https://docs.rs/oxidizer_health/0.1.0/oxidizer_health/?search=Component
[__link8]: https://docs.rs/oxidizer_health/0.1.0/oxidizer_health/?search=Aggregator::component
[__link9]: https://docs.rs/oxidizer_health/0.1.0/oxidizer_health/?search=Publisher::publish
Loading
Loading