Skip to content

[config-server] Allow specification of down health status#2056

Merged
ryanjbaxter merged 1 commit into
spring-cloud:mainfrom
antechrestos:features/allow-customisation-of-health-status
Mar 7, 2022
Merged

[config-server] Allow specification of down health status#2056
ryanjbaxter merged 1 commit into
spring-cloud:mainfrom
antechrestos:features/allow-customisation-of-health-status

Conversation

@antechrestos
Copy link
Copy Markdown
Contributor

@antechrestos antechrestos commented Mar 2, 2022

Allow developer to set the property spring.cloud.config.server.health.down-health-status to a custom value. This may be usefull when you make the clone critical (init container for instance), yet want your pod not to be down if your remote is unavailable or cannot be reached; the service will be restricted yet should be seen as alive by the platform.

For instance we may use RESTRICTED status that is used by spring cloud admin to display it in yellow...

@antechrestos
Copy link
Copy Markdown
Contributor Author

@spencergibb @ryanjbaxter this pull request is for discussion.

BTW @spencergibb , I may have spotted an issue in the documentation. Health Indicator section indicates that to disable the health check, you need to set management.health.config.enabled=false. However, in the code, another property is referenced - the one we find on your stackoverflow answer or in the official documentation. I can make another PR if needed.

@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 2, 2022

Codecov Report

Merging #2056 (3030a2c) into main (863285d) will decrease coverage by 0.00%.
The diff coverage is 80.00%.

Impacted file tree graph

@@             Coverage Diff              @@
##               main    #2056      +/-   ##
============================================
- Coverage     77.11%   77.11%   -0.01%     
- Complexity     1440     1441       +1     
============================================
  Files           183      183              
  Lines          5362     5366       +4     
  Branches        699      699              
============================================
+ Hits           4135     4138       +3     
- Misses          956      957       +1     
  Partials        271      271              
Impacted Files Coverage Δ
...fig/server/config/ConfigServerHealthIndicator.java 83.05% <80.00%> (-0.59%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 863285d...3030a2c. Read the comment docs.

Copy link
Copy Markdown
Contributor

@ryanjbaxter ryanjbaxter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a test that actually uses the property? I don't think it will actually work the way the code is now since there is no setter.


private Map<String, Repository> repositories = new LinkedHashMap<>();

private String downHealthStatus = "DOWN";
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would set this to Status.DOWN.getCode()

@ryanjbaxter
Copy link
Copy Markdown
Contributor

Allow developer to set the property 'spring.cloud.config.server.health.down-health-status' to a custom value
@ryanjbaxter ryanjbaxter added this to the 4.0.0-M2 milestone Mar 7, 2022
@ryanjbaxter ryanjbaxter merged commit 0021fd1 into spring-cloud:main Mar 7, 2022
@antechrestos
Copy link
Copy Markdown
Contributor Author

@ryanjbaxter thanks

@antechrestos antechrestos deleted the features/allow-customisation-of-health-status branch March 7, 2022 22:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants