spring-cloud/spring-cloud-netflix
Add support for custom actuator health status mapping in EurekaHealthCheckHandler
Contribution Overview
The Engineering Context
This contribution was made to the spring-cloud/spring-cloud-netflixopen-source repository. The work involved understanding the existing codebase, identifying the underlying engineering problem, implementing a focused solution, and validating the change against the project's existing behaviour and testing standards.
Original Issue
Support configurable mapping of custom Actuator health statuses to Eureka InstanceStatus.
Custom Spring Boot Actuator health statuses were mapped to UNKNOWN because EurekaHealthCheckHandler only supported the built-in status mapping.
Engineering Problem
Understanding the Problem
EurekaHealthCheckHandler used a fixed mapping for known Spring Boot Actuator statuses. Applications defining custom health statuses could not configure their corresponding Eureka InstanceStatus and therefore fell back to UNKNOWN.
Solution
Implementation Approach
Added configurable status mappings through eureka.client.status.mapping.*, allowing custom Actuator status codes to be mapped to Eureka InstanceStatus values. The implementation performs case-insensitive matching, preserves the existing default mappings as a fallback, handles null statuses safely, and adds regression tests for custom and null status handling.
Technologies
Engineering Stack
Pull Request
View the Contribution
View the pull request and the associated engineering discussion directly on GitHub.
View Pull Request on GitHub →