keycloak-metrics-spi icon indicating copy to clipboard operation
keycloak-metrics-spi copied to clipboard

Metrics from multiple realms are not showing up

Open TalhaNaeem101 opened this issue 1 year ago • 7 comments

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:

image

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.

TalhaNaeem101 avatar Jul 31 '23 17:07 TalhaNaeem101

Facing the same issue, need some help +1

ShadaabSikandar avatar Aug 04 '23 07:08 ShadaabSikandar

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.

image

rafaelgomez-facephi avatar Aug 08 '23 06:08 rafaelgomez-facephi

Thank you for your answer.

Yes, I have already tried with configuring this option, yet no luck.

image

TalhaNaeem101 avatar Aug 10 '23 14:08 TalhaNaeem101

@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.

adrianof22 avatar Aug 15 '23 19:08 adrianof22

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.

eneamarcantoni99 avatar Aug 31 '23 15:08 eneamarcantoni99

I've tried with: Keycloak: 22.0.1 Keycloak Metrics SPI: 4.0.0

But the issue persists.

eneamarcantoni99 avatar Sep 01 '23 08:09 eneamarcantoni99

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

rafaelgomez-facephi avatar Sep 01 '23 09:09 rafaelgomez-facephi