keycloak-metrics-spi
keycloak-metrics-spi copied to clipboard
Metrics from multiple realms are not showing up
Description
The metrics are not showing up for all realms, it only shows for the master realm. While in the docs it is mentioned that It will return data for all realms, no matter which realm you use in the URL, But IT DOES NOT WORK FOR ME.
Expected Behavior
Metrics of all realms are to be exported in Prometheus and shown in grafana dashboard, the realm dashboard should be showing all the created realms.
Actual Behavior
I am seeing the metrcis of only one realm, i.e. master realm. While I have 4 more realms , but their metrics are not showing up. And the dropdown option for the realms does nott work in Grafana. Here is the screenshot for grafana dashboard, it only shows master realm, even if I use another realm name in endpoint:
And the endpoint I have used is: <url>/auth/realms/master/metrics
Environment
keycloak-metrics-spi version: 2.5.3 Keycoak version: 15.0.2 quay.io/keycloak/keycloak:15.0.2 Prometheus version: quay.io/prometheus-operator/prometheus-operator:v0.62.0 Grafana version: 6.48
Dockerfile for metrics-spi Setup:
# Build Stage
FROM maven:3.8.4-openjdk-17-slim AS build
COPY ./keycloak-metrics-spi /app
WORKDIR /app
RUN mvn clean package -DskipTests -Dkeycloak.version=15.0.2
# Final Stage
FROM quay.io/keycloak/keycloak:15.0.2
USER root
RUN mkdir -p /opt/jboss/keycloak/standalone/deployments/
COPY --from=build /app/target/keycloak-metrics-spi-2.5.3-SNAPSHOT.jar /opt/jboss/keycloak/standalone/deployments/
RUN touch /opt/jboss/keycloak/standalone/deployments/keycloak-metrics-spi-2.5.3.jar.dodeploy
RUN chown -R jboss: /opt/jboss/keycloak/standalone/deployments
EXPOSE 8080
USER jboss
CMD ["-b", "0.0.0.0", "-Dkeycloak.profile.feature.metrics=enabled"]
Please help/support in acheiving this milestone, I need to monitor all the realms which are being created programmatically.
Facing the same issue, need some help +1
Hi, can you confirm that you have added the "metrics listener" listener to realm events?. We had a similar problem and that was the solution.
Thank you for your answer.
Yes, I have already tried with configuring this option, yet no luck.
@TalhaNaeem101 Had you setting up the listener in all of your realms? You need to setup each realm that you want to collect metric with the listener, at least was what I did.
I've the same issue with: Keycloak: 21.1.2 Keycloak Metrics SPI: 3.0.0 Prometheus: 2.45.0 Grafana: 10.0.2
Someone has solved the issue? I've already enabled "metrics-listener" for all of my realms.
I've tried with: Keycloak: 22.0.1 Keycloak Metrics SPI: 4.0.0
But the issue persists.
It works for me with the following versions: keycloak: 20.0.5 keycloak Metrics SPI: 3.0.0 Prometheus: 2.46.0 Grafana: 10.0.3