This repository has been archived by the owner on Apr 18, 2024. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
In Keycloak 19 the 'realm' in the metrics contain a UUID instead of the Realm name.
Apparently Keycloak changed the value of
event.getRealmId()
from a Realm name to a real Realm id.What
This change will fix this by looking up the Realm by Id via a RealmProvider so the metrics will still contain a Realm name.
Upgraded Keycloak dependency to 19.0.1 to also verify this library is not using any deprecated sources.
Removed the
MetricsEventListenerSpi
since this seems to be an old way of adding a listener and is not needed anymore for v19 Quarkus Keycloak.Why
To have readable realm names in the metrics and on the Keycloak dashboard.
How
Realm name is looked up by using a RealmProvider which is accessible from the KeycloakSession when the MetricsEventListenerFactory is created.
Verification Steps
curl -vk https://<keycloak-url>:<port>/auth/realms/master/metrics | grep -v '^#' | grep login
and check metrics output.The metrics should still contain the realm name like
Checklist:
Progress