Add option to replace model ids with model names, fix #3 (#6)

This commit is contained in:
Stephan Schnabel 2023-03-10 13:31:06 +01:00 committed by GitHub
parent 62bdac4717
commit db929056f3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 225 additions and 53 deletions

View file

@ -31,11 +31,12 @@ public class Prometheus {
.sum();
}
public int userEvent(EventType type, String realmName) {
public int userEvent(EventType type, String realmName, String clientId) {
return state.stream()
.filter(metric -> Objects.equals(metric.name(), "keycloak_event_user_total"))
.filter(metric -> Objects.equals(metric.tags().get("type"), type.toString()))
.filter(metric -> Objects.equals(metric.tags().get("realm"), realmName))
.filter(metric -> Objects.equals(metric.tags().get("client"), clientId))
.mapToInt(metric -> metric.value().intValue())
.sum();
}