keycloak-metrics-spi: Seems incompatible with Keycloak 21
Description
After having migrated to Keycloak 21 (Quarkus) I get “Internal Server Error” whenever I try to login. The logs show messages like these:
ERROR [io.quarkus.vertx.http.runtime.QuarkusErrorHandler] (executor-thread-7) HTTP Request to /auth/realms/jake/metrics failed, error id: fdebc248-5921-4c51-8db2-2bcbcff3607e-57: org.jboss.resteasy.spi.UnhandledException: java.lang.IllegalArgumentException: Failed to register Collector of type Counter: keycloak_login_attempts_total is already in use by another Collector of type Counter
Keycloak 21 changed metrics implementation from SmallRye to Micrometer, maybe this clashes with this project somehow?
Steps to reproduce
- Install and enable keycloak-metrics-spi v2.5.3 on Keycloak 20
- Migrate to Keycloak 21
- Attempt to login to the admin console
About this issue
- Original URL
- State: closed
- Created a year ago
- Reactions: 20
- Comments: 17 (4 by maintainers)
Commits related to this issue
- closes #155 _total may not be used as a counter name see naming conventions https://prometheus.io/docs/instrumenting/writing_exporters/#naming — committed to ghenadiibatalski/keycloak-metrics-spi by ghenadiibatalski a year ago
- closes #155 make compatible with keycloak >= 21.0.0 see naming conventions https://prometheus.io/docs/instrumenting/writing_exporters/#naming — committed to ghenadiibatalski/keycloak-metrics-spi by ghenadiibatalski a year ago
- closes #155 make compatible with keycloak >= 21.0.0 see naming conventions https://prometheus.io/docs/instrumenting/writing_exporters/#naming — committed to ghenadiibatalski/keycloak-metrics-spi by ghenadiibatalski a year ago
- closes #155 make compatible with keycloak >= 21.0.0 see naming conventions https://prometheus.io/docs/instrumenting/writing_exporters/#naming — committed to ghenadiibatalski/keycloak-metrics-spi by ghenadiibatalski a year ago
- keycloak: temporarily disable keycloak-metrics-spi It's incompatible with Keycloak 21. Re-enabling of metrics is tracked in #499. [1] https://github.com/aerogear/keycloak-metrics-spi/issues/155 — committed to archlinux/infrastructure by foutrelis a year ago
- Merge pull request #157 from ghenadiibatalski/master closes #155 make compatible with keycloak >= 21.0.0 — committed to aerogear/keycloak-metrics-spi by pb82 a year ago
IHMO this repository is abandoned.
We relied on this implementation, but decided to rewrite it for Keycloak 21: kokuwaio/keycloak-event-metrics This implementation adds event metrics to Micrometer from Quarkus at
/metrics
.Differences:
/metrics
Feel free to provide feedback.
@ghenadiibatalski has submitted a fix and I’ve verified it with KC 19, 20 and 21. I want to get it merged and released as soon as possible.
It appears that key cloak now natively incudes a /metrics endpoint in prometheus format with Keycloak 21 so it may be that this project is no longer needed for Keycloak 21+: https://www.keycloak.org/2023/02/keycloak-2100-released.html
Yes 🤦 Sorry, I forgot that, too used to gradle. Will send a PR.
@logopk i only needed to remove
_total
from the metric name. as i understand,_total
is a reserved suffix now. The keycloak 21 ships the prometheus 0.16.0 so i updated the PR to keycloak 21 I don’t know, if it could be backported for both versions. But the previous build is good enough for older Keycloak and the new one is compatible from 21 upwards.