fix: report disk usage for datadir mount point#8913
Closed
frederik12321 wants to merge 1 commit into
Closed
Conversation
|
frederik seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
1e14e6b to
d664376
Compare
Pass the datadir path to `psutil::disk::disk_usage()` so that disk metrics (`disk_node_bytes_total`, `disk_node_bytes_free`) reflect the filesystem containing the data directory, not the root filesystem. This fixes incorrect reporting for operators who mount a separate drive for beacon chain data. All three consumers are updated: - `/lighthouse/health` HTTP endpoint (BN + VC) - Remote monitoring (`monitoring_api`) - Prometheus `/metrics` scraping (BN + VC) Closes sigp#6687 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
d664376 to
a467a07
Compare
Author
|
Closing this PR — I used AI tooling (Claude) to generate these changes and wouldn't be able to adequately explain or maintain the code myself. The fix is valid if someone wants to pick it up. |
This was referenced Feb 28, 2026
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
datadirpath topsutil::disk::disk_usage()instead of hardcoding"/", so thatdisk_node_bytes_totalanddisk_node_bytes_freereflect the filesystem containing the data directory/lighthouse/healthHTTP endpoint, remote monitoring, and Prometheus/metricsscrapingdata_diris unavailableMotivation
Operators who mount a separate drive for beacon chain data see incorrect disk stats because the health metrics always report the root filesystem. This affects remote monitoring dashboards and alerting.
Closes #6687
Changes
Core fix (
common/health_metrics/src/observe.rs):observe_health_with_data_dir()andobserve_system_health_with_data_dir()free functions that accept adata_dir: &PathparameterObservetrait impls delegate to the new functions with"/"as fallbackpsutil::disk::disk_usage(data_dir)automatically resolves the path to its containing filesystemPrometheus metrics (
beacon_node/http_metrics,validator_client/http_metrics):data_dir: Option<PathBuf>to metricsContextstructsdata_dirtoscrape_health_metrics_for_data_dir()when availableHTTP health endpoint (
beacon_node/http_api,validator_client/http_api):data_dirtoobserve_health_with_data_dir()in/lighthouse/healthhandlersRemote monitoring (
common/monitoring_api):data_dir: Option<PathBuf>toConfigandMonitoringHttpClientobserve_system_health_with_data_dir()whendata_diris availableConfig propagation (
beacon_node/src/config.rs,validator_client/src/config.rs,beacon_node/client/src/builder.rs,validator_client/src/lib.rs):data_dirthrough to monitoring config and metrics contextAlso fixes a minor typo in an error message:
"Unable to disk usage info"→"Unable to get disk usage info".Test plan
cargo check --workspace— zero errors, zero warningscargo fmt --all -- --check— cleancargo clippy --workspace— no new warnings--datadir /some/separate/mountand confirm/lighthouse/healthreturns disk stats for that mount instead of root🤖 Generated with Claude Code