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

feat: healthcheck #401

Merged
merged 44 commits into from
Dec 12, 2023
Merged

feat: healthcheck #401

merged 44 commits into from
Dec 12, 2023

Conversation

frisonisland
Copy link
Contributor

@frisonisland frisonisland commented Dec 7, 2023

Goal

The goal is to introduce the three health check endpoints (/health, /health/live, /health/ready) that should be available on every Carbonio service.

Health check implementation

  • Implemented endpoint/routing with HealthServlet
  • Implemented HealthUseCase to aggregate readiness/liveliness based on different possible service healthchecks
  • Implemented DatabaseServiceDependency to check database status. Has options to avoid keep polling connections (polling interval) and live + ready is based on the same check on connection availability.

Testing

  • added test containers dependency
  • updated JettyServerFactory to allow setting filters and listeners
  • Tested health check with Consul in production environment

frisonisland and others added 17 commits December 6, 2023 12:33
- adds liveliness endpoint for healthcheck
- adds DatabaseHealthCheck to check db is live and ready + first tests
- adds HealthService to check on all registered HealthChecks
- java doc HealthCheck interface
- adds also DbPool startup in HealthServletTest
- add test for HealthServlet when db started/not started
- adds HealthResponse POJO for health JSON response
- document DbPool getDatabaseConnection instance-level method
- small refactors in methods naming and variables
- update HealthServletTest to use mariadb 10.4.31
- fix doCheckStatus to return correct status(was returning true always)
- simplify canConnectToDatabase and make it private
- align tests with changes
- improve builder
- add javadoc
- add logging
- simplify response creation
- handle unknown routes (return 404)
- improve test readability
@ppolito-zextras ppolito-zextras self-requested a review December 11, 2023 11:46
- found jna is needed by zmconfigd Jython and no others, directly. Was updated beacuse needed by TestContainers
@frisonisland frisonisland marked this pull request as ready for review December 11, 2023 14:24
@ppolito-zextras ppolito-zextras removed their request for review December 12, 2023 09:58
Copy link
Member

@keshavbhatt keshavbhatt left a comment

Choose a reason for hiding this comment

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

I just ask if it is okay to rely on this endpoint in production to suggest if mailbox is healthy. I suggest to wait for addition of other required service dependencies.

@frisonisland frisonisland merged commit 237ee66 into devel Dec 12, 2023
@frisonisland frisonisland deleted the feat/healthcheck branch December 12, 2023 16:34
@frisonisland frisonisland mentioned this pull request Dec 15, 2023
1 task
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.

5 participants