mirror of
https://github.com/arsvendg/Stirling-PDF.git
synced 2026-07-14 10:34:06 +02:00
Fix health status checks falling under mettric flag (#5821)
This commit is contained in:
+13
-3
@@ -51,9 +51,19 @@ public class MetricsController {
|
|||||||
description =
|
description =
|
||||||
"This endpoint returns the status of the application and its version number.")
|
"This endpoint returns the status of the application and its version number.")
|
||||||
public ResponseEntity<?> getStatus() {
|
public ResponseEntity<?> getStatus() {
|
||||||
if (!metricsEnabled) {
|
return getApplicationStatus();
|
||||||
return ResponseEntity.status(HttpStatus.FORBIDDEN).body("This endpoint is disabled.");
|
}
|
||||||
}
|
|
||||||
|
@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<>();
|
Map<String, String> status = new HashMap<>();
|
||||||
status.put("status", "UP");
|
status.put("status", "UP");
|
||||||
String version = getClass().getPackage().getImplementationVersion();
|
String version = getClass().getPackage().getImplementationVersion();
|
||||||
|
|||||||
Reference in New Issue
Block a user