feat(flw-api): implement /health and /version monitoring endpoints#165
feat(flw-api): implement /health and /version monitoring endpoints#165Suraj-kumar00 wants to merge 1 commit intoPSMRI:mainfrom
Conversation
- Add HealthController and HealthService with MySQL and Redis health checks - Add VersionController and VersionService for Git commit and build info - Update JwtUserIdValidationFilter to bypass authentication for monitoring endpoints - Add git-commit-id-plugin and build-info goal to Maven configuration Closes PSMRI#102
📝 WalkthroughWalkthroughThe changes introduce health and version information endpoints to the application. A git-commit-id-plugin and build-info execution are added to the build configuration to generate build metadata. New REST controllers expose Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant HealthController
participant HealthService
participant MySQL
participant Redis
Client->>HealthController: GET /health
HealthController->>HealthService: checkHealth()
par MySQL Health Check
HealthService->>MySQL: Validate connection
MySQL-->>HealthService: Connection OK
HealthService->>MySQL: Query version
MySQL-->>HealthService: MySQL version
and Redis Health Check
HealthService->>Redis: PING
Redis-->>HealthService: PONG
HealthService->>Redis: Fetch version
Redis-->>HealthService: Redis version
end
HealthService-->>HealthController: Map{status, components, timestamp}
HealthController-->>Client: ResponseEntity (HTTP 200/503)
sequenceDiagram
participant Client
participant VersionController
participant VersionService
participant GitProperties
participant BuildProperties
participant TimeFormatter
Client->>VersionController: GET /version
VersionController->>VersionService: getVersionInfo()
par Property Loading
VersionService->>GitProperties: Load git.properties
GitProperties-->>VersionService: Git metadata
and Build Info
VersionService->>BuildProperties: Load build-info.properties
alt Properties Found
BuildProperties-->>VersionService: Build metadata
else Fallback
VersionService->>BuildProperties: Load Maven properties
BuildProperties-->>VersionService: Maven fallback data
end
end
VersionService->>TimeFormatter: Format current time (IST)
TimeFormatter-->>VersionService: Timestamp
VersionService-->>VersionController: Map{git, build, timestamp}
VersionController-->>Client: HTTP 200 + Version JSON
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 3❌ Failed checks (3 warnings)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Hi @drtechie, @vanitha1822, and @vishwab1 |
📋 Description
Closes #102
✅ Type of Change
ℹ️ Additional Information
http://localhost:8081/health{ "status": "DOWN", "timestamp": "2026-01-17T13:00:46.469321333Z", "components": { "mysql": { "status": "DOWN", "details": { "type": "MySQL", "host": "mysql-container", "port": "3306", "database": "db_iemr", "error": "java.sql.SQLException: Access denied for user 'root'@'172.18.0.5' (using password: YES)", "errorType": "RuntimeException" } }, "redis": { "status": "UP", "details": { "type": "Redis", "host": "redis-container", "port": 6379, "responseTimeMs": 649, "version": "7.2.4" } } } }http://localhost:8081/version{ "git.commit.id": "unknown", "git.build.time": "2026-01-17T12:49:12+0000", "build.version": "3.1.0", "build.time": "2026-01-17T12:48:59.753Z", "current.time": "2026-01-17 18:38:41" }Summary by CodeRabbit
New Features
Chores
✏️ Tip: You can customize this high-level summary in your review settings.