Add health check endpoint#202
Open
devin-ai-integration[bot] wants to merge 2 commits intomasterfrom
Open
Conversation
- Add GET /health endpoint that checks application and database status - Returns 200 with status UP when database is healthy - Returns 503 with status DOWN when database is unavailable - Add unit test with Mockito for both healthy and unhealthy scenarios - Add spring-boot-starter-test dependency to ftgo-application module Co-Authored-By: Wes Convery <2wconvery@gmail.com>
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
Report database as DOWN when isValid() returns false instead of silently treating an invalid connection as healthy. Add test coverage for this case. Co-Authored-By: Wes Convery <2wconvery@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a
GET /healthendpoint to the FTGO application that checks application and database connectivity status.Endpoint behavior:
200 OKwith{"status": "UP", "database": {"status": "UP"}}when the database connection is healthy503 Service Unavailablewith{"status": "DOWN", "database": {"status": "DOWN", "error": "..."}}when the database is unreachable or the connection is invalidChanges:
HealthCheckController.java— new REST controller with a/healthGET endpoint that validates DB connectivity viaDataSource.getConnection()andconnection.isValid(2)with proper return value checkingHealthCheckControllerTest.java— unit tests using Mockito covering healthy DB, connection refused, and invalid connection scenariosftgo-application/build.gradle— addedspring-boot-starter-testas a test dependency for Mockito supportReview & Testing Checklist for Human
GET /healthreturns200withstatus: UPwhen the app is running with a healthy MySQL connectionGET /healthreturns503withstatus: DOWNwhen MySQL is stopped or unreachable/actuator/healthendpointNotes
spring-boot-starter-actuator, which provides/actuator/health. This new/healthendpoint is a custom, simpler alternative at the root path for easier integration with load balancers and container orchestration health probes.DataSourcebean is auto-injected by Spring Boot from the existing MySQL configuration.Link to Devin session: https://app.devin.ai/sessions/f9d0275342fc4acd955f123f8ea9bbdc
Requested by: @WesternConcrete
Devin Review