feat(app): add monitoring API for liveness and readiness#500
Open
varex83 wants to merge 7 commits into
Open
Conversation
Add the monitoring API module serving /livez and /readyz, with a background readiness checker that tracks beacon-node sync status, peer counts, cluster quorum connectivity, and validator-client activity per epoch. Readiness failure reasons map to Charon-compatible /readyz metric codes.
iamquang95
requested changes
Jun 25, 2026
| pub fn router_with_state(state: MonitoringState) -> Router { | ||
| Router::new() | ||
| .route("/livez", get(livez)) | ||
| .route("/readyz", get(readyz)) |
Collaborator
There was a problem hiding this comment.
missing /metrics endpoint
Collaborator
Author
There was a problem hiding this comment.
we naturally expose it by spawning the vise exporter
| /// Metrics that back the monitoring API readiness checks. | ||
| #[derive(Debug, Metrics)] | ||
| #[metrics(prefix = "app")] | ||
| pub struct MonitoringMetrics { |
Collaborator
There was a problem hiding this comment.
missing app_beacon_node_version and app_validator_stack_params
| ct: CancellationToken, | ||
| readiness: ReadyState, | ||
| ) { | ||
| let config = match tokio::select! { |
Collaborator
There was a problem hiding this comment.
missing a background run on beaconNodeVersionMetric
Address PR #500 review: define the missing app_beacon_node_version and app_validator_stack_params metrics, and add a background task that periodically refreshes the beacon node version gauge (on startup, then every 10 minutes) and runs the version compatibility check, mirroring Charon's beaconNodeVersionMetric. Co-Authored-By: Bohdan Ohorodnii <varex83@users.noreply.github.com> Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
# Conflicts: # crates/app/src/health/checker.rs # crates/app/src/health/checks.rs # crates/app/src/health/gatherer.rs # crates/app/src/health/model.rs # crates/app/src/health/reducers.rs # crates/app/src/health/select.rs
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Adds the monitoring API module (
crates/app/src/monitoringapi/) serving/livezand/readyz, ported from Charon'sapp/monitoringapi.go.router.rs— axum router exposing/livez(always 200) and/readyz(200 when ready, 500 + failure reason otherwise).readiness.rs—ReadinessErrorenum of failure reasons,ReadyStateshared via awatchchannel, and aReadinessChecktrait so the HTTP layer stays decoupled from node wiring. Each error variant maps to a Charon-compatible/readyzmetric code viareadyz_code().checker.rs— background readiness checker tracking beacon-node sync status, peer counts, cluster quorum connectivity, and validator-client activity per epoch, with Charon-equivalent error precedence and the 320-slot / 6-round thresholds.metrics.rs—app-prefixed gauges (readyz, beacon-node syncing, beacon-node peers).Notes
feat/app-healthsince this builds on that branch.MissedTickBehavior::Skipto match Go's drop-missed-ticks ticker semantics.ChainConfig.Test plan
cargo test -p pluto-app monitoringapi(13 tests pass)cargo clippy -p pluto-app --all-targets --all-features -- -D warningscargo +nightly fmtFollow-up (not in this PR): tests for readyz codes 7/8, a gauge-mapping table test, and the
Nonepeer-count invariant.