Route Check health
This commit is contained in:
parent
24326b38a2
commit
f2a247792d
@ -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);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user