private void initDiscordHealthChecks() {
healthCheckRegistry.register(MetricNames.HEALTH_DISCORD_WS, new HealthCheck() {
@Override
protected Result check() throws Exception {
Counter restartCounter = metricRegistry.counter(MetricNames.DISCORD_WS_RESTARTS);
Optional<Incident> incident = incidentService.getLastIncidentFromGroup(IncidentService.DISCORD_RESTART);
ZonedDateTime time = incident.isPresent() ? incident.get().getCreatedDate() : null;
String reason = incident.isPresent() ? incident.get().getName() : null;
long restarts = restartCounter.getCount();
if (restarts > 0) {
return Result.unhealthy(String.format("%d restart%s, last one on %s (%s)",
restarts, restarts == 1 ? "" : "s", time, reason));
} else {
return Result.healthy("OK");
}
}
});
}
MetricsService.java 文件源码
java
阅读 29
收藏 0
点赞 0
评论 0
项目:ugc-bot-redux
作者:
评论列表
文章目录