Add settings for health indicator shard_capacity thresholds#136141
Add settings for health indicator shard_capacity thresholds#136141samxbr merged 30 commits intoelastic:mainfrom
Conversation
🔍 Preview links for changed docs |
ℹ️ Important: Docs version tagging👋 Thanks for updating the docs! Just a friendly reminder that our docs are now cumulative. This means all 9.x versions are documented on the same page and published off of the main branch, instead of creating separate pages for each minor version. We use applies_to tags to mark version-specific features and changes. Expand for a quick overviewWhen to use applies_to tags:✅ At the page level to indicate which products/deployments the content applies to (mandatory) What NOT to do:❌ Don't remove or replace information that applies to an older version 🤔 Need help?
|
There was a problem hiding this comment.
Pull Request Overview
This PR introduces configurable thresholds for the shard capacity health indicator, allowing administrators to customize when the indicator reports YELLOW and RED statuses. Previously, these thresholds were hardcoded to 10 and 5 remaining shards respectively.
- Adds two new dynamic cluster settings for configuring YELLOW and RED thresholds
- Updates the ShardsCapacityHealthIndicatorService to use configurable thresholds instead of hardcoded values
- Includes comprehensive test coverage and documentation for the new settings
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| ShardsCapacityHealthIndicatorService.java | Adds configurable threshold settings with validation and dynamic updates |
| ShardsCapacityHealthIndicatorServiceTests.java | Updates all tests to use the new constructor and adds threshold validation tests |
| NodeConstruction.java | Updates service instantiation to pass settings parameter |
| ClusterSettings.java | Registers the new settings with cluster configuration |
| HealthFeatures.java | New feature specification for the settings |
| module-info.java | Exports the new HealthFeatures class |
| META-INF/services/org.elasticsearch.features.FeatureSpecification | Registers the HealthFeatures service |
| health-diagnostic-settings.md | Documents the new configuration settings |
| 30_feature.yml | Adds integration tests for the new settings functionality |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
server/src/main/java/org/elasticsearch/health/node/ShardsCapacityHealthIndicatorService.java
Outdated
Show resolved
Hide resolved
...r/src/test/java/org/elasticsearch/health/node/ShardsCapacityHealthIndicatorServiceTests.java
Outdated
Show resolved
Hide resolved
…ityHealthIndicatorService.java Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
Hi @samxbr, I've created a changelog YAML for you. |
|
Pinging @elastic/es-data-management (Team:Data Management) |
rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/health/30_feature.yml
Outdated
Show resolved
Hide resolved
server/src/main/java/org/elasticsearch/health/node/ShardsCapacityHealthIndicatorService.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/elasticsearch/health/node/ShardsCapacityHealthIndicatorService.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/elasticsearch/health/node/ShardsCapacityHealthIndicatorService.java
Outdated
Show resolved
Hide resolved
rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/health/30_feature.yml
Outdated
Show resolved
Hide resolved
server/src/main/java/org/elasticsearch/health/metadata/HealthMetadata.java
Outdated
Show resolved
Hide resolved
server/src/test/java/org/elasticsearch/health/metadata/HealthMetadataSerializationTests.java
Outdated
Show resolved
Hide resolved
...alClusterTest/java/org/elasticsearch/health/node/ShardsCapacityHealthIndicatorServiceIT.java
Show resolved
Hide resolved
nielsbauman
left a comment
There was a problem hiding this comment.
I left one more small cleanup comment, but other than that LGTM.
Thanks a lot for working and iterating on this!
| } | ||
|
|
||
| static HealthIndicatorDetails buildDetails(List<ShardLimitValidator.Result> results) { | ||
| static HealthIndicatorDetails buildDetails(List<ShardLimitValidator.Result> results, HealthMetadata healthMetadata) { |
There was a problem hiding this comment.
We don't need this healthMetadata anymore.
Add dynamic settings to allow user to configure the unhealthy thresholds (yellow/red) of shard capacity health indicator. They replace the current hard-coded values:
health.shard_capacity.unhealthy_threshold.yellow(default 10)health.shard_capacity.unhealthy_threshold.red(default 5)Behavior:
REDthreshold needs to be smaller thanYELLOWthreshold, so the health indicator follows the order fromGREEN->YELLOW->REDCloses #116697