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 by default, with no configuration mechanism for applications to map those statuses to appropriate Eureka InstanceStatus values.
Engineering Problem
Understanding the Problem
Applications can define custom Spring Boot Actuator health statuses, but EurekaHealthCheckHandler did not provide a configurable way to translate those statuses into corresponding Eureka InstanceStatus values. As a result, unsupported custom statuses defaulted to UNKNOWN.
Solution
Implementation Approach
Added configurable health status mapping through the eureka.client.status.mapping.* configuration namespace. The implementation supports custom status mappings, performs case-insensitive matching, preserves existing default behaviour as a fallback, maintains backward compatibility, and adds unit test coverage including null-safety 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 →