Migrate to kokuwa parent
This commit is contained in:
parent
29b573f2f7
commit
a3784fe1f5
12 changed files with 193 additions and 414 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue