Compare commits

...

2 Commits

Author SHA1 Message Date
adesyawal
00f6f37d3e Merge branch 'ade/monitoring/check-health2' into prod/no-cron 2025-12-31 11:39:21 +07:00
adesyawal
f2a247792d Route Check health 2025-12-31 11:35:03 +07:00

View File

@ -5982,4 +5982,28 @@ public class SdmController extends LocaleController<AkunVO> {
}
}
@RequestMapping(value = "cek-health", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> cekHealth(HttpServletRequest request) {
long startTime = System.currentTimeMillis();
Map<String, Object> body = new HashMap<>();
String now = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
body.put("message", "ready");
body.put("time", now);
long latency = System.currentTimeMillis() - startTime;
Map<String, Object> response = new LinkedHashMap<>();
response.put("url", request.getRequestURL().toString());
response.put("status_code", HttpStatus.OK.value());
response.put("is_ok", true);
response.put("latency_ms", latency);
response.put("body", body);
response.put("checked_at", now);
return ResponseEntity.ok(response);
}
}