Migrate to kokuwa parent

This commit is contained in:
Stephan Schnabel 2023-07-03 09:50:21 +02:00
parent 29b573f2f7
commit a3784fe1f5
Signed by: stephan.schnabel
GPG key ID: E07AF5BA239FE543
12 changed files with 193 additions and 414 deletions

View file

@ -41,12 +41,11 @@ public class MetricsStatsTask implements Provider, ScheduledTask {
try {
scrape(session);
} catch (org.hibernate.exception.SQLGrammarException e) {
log.infov("Metrics status task skipped, database not ready.");
return;
} catch (Exception e) {
if (e instanceof org.hibernate.exception.SQLGrammarException) {
log.infov("Metrics status task skipped, database not ready.");
} else {
log.errorv(e, "Failed to scrape stats.");
}
log.errorv(e, "Failed to scrape stats.");
return;
}
@ -67,6 +66,7 @@ public class MetricsStatsTask implements Provider, ScheduledTask {
private void scrape(KeycloakSession session) {
session.realms().getRealmsStream().forEach(realm -> {
log.tracev("Scrape for realm {0}.", realm.getName());
var tagRealm = Tag.of("realm", realm.getName());
gauge("keycloak_users", Set.of(tagRealm), session.users().getUsersCount(realm), true);
gauge("keycloak_clients", Set.of(tagRealm), session.clients().getClientsCount(realm), true);