Fix health status checks falling under mettric flag (#5821)

This commit is contained in:
Anthony Stirling
2026-03-02 13:56:51 +00:00
committed by GitHub
parent 012bd1af92
commit abb8b1f721

View File

@@ -51,9 +51,19 @@ public class MetricsController {
description =
"This endpoint returns the status of the application and its version number.")
public ResponseEntity<?> getStatus() {
if (!metricsEnabled) {
return ResponseEntity.status(HttpStatus.FORBIDDEN).body("This endpoint is disabled.");
}
return getApplicationStatus();
}
@GetMapping("/health")
@Operation(
summary = "Application health check",
description =
"This endpoint returns the health status of the application and its version number. Mirrors /api/v1/info/status.")
public ResponseEntity<?> getHealth() {
return getApplicationStatus();
}
private ResponseEntity<?> getApplicationStatus() {
Map<String, String> status = new HashMap<>();
status.put("status", "UP");
String version = getClass().getPackage().getImplementationVersion();