Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add a health endpoint #448

Merged
merged 2 commits into from
Jun 23, 2024
Merged

add a health endpoint #448

merged 2 commits into from
Jun 23, 2024

Conversation

andibraeu
Copy link
Contributor

I use openhab cloud in a kubernetes environment. When the mongodb connection gets lost, it doesn't recover alone.

Kubernetes doesn't see that the state isn't healthy by just probing the home page. So I created a health endpoint that returns HTTP status 200 in case every is ok, else it returns HTTP status 500.

Signed-off-by: Andreas Bräu <[email protected]>
@andibraeu
Copy link
Contributor Author

@digitaldan can you please have a look on that?

@digitaldan
Copy link
Contributor

Hi, LGTM, i'm working in the code this week, so will give this a quick test today or tomorrow. Thanks!

@digitaldan
Copy link
Contributor

HI one comment, can you add a config option to enable/disable this? I don't want to have this exposed on our public service, and would prefer not to try and block this specific route in our load balancer (its already complicated). Thanks !

@andibraeu
Copy link
Contributor Author

Sure, I added a config option. Usually things like that I would only expose to another endpoint, that is not public.

@andibraeu
Copy link
Contributor Author

@digitaldan can you please take a look again?

@@ -6,7 +6,10 @@
"logger" : {
"type": "console"
},
"subDomainCookies": false
"subDomainCookies": false,
"healthEndpoint" : {
Copy link
Contributor

Choose a reason for hiding this comment

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

Any reason why this can't be a single value, like "healthEndpointEnabled" : true ? Are you thinking there would be more options available in the future for the health endpoint that would warrent its own section/object ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, for example we could add another option to configure not to return error details, but just the health status.
Or configure, as I said in the other answer to check for other modules/dependencies.

@digitaldan
Copy link
Contributor

Hi, sorry i missed your changes in my sea of github notifications. Just left a few questions.

@digitaldan
Copy link
Contributor

LGTM, thanks.

@digitaldan digitaldan merged commit a8138a3 into openhab:main Jun 23, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants