aerogear / keycloak-metrics-spi

Adds a Metrics Endpoint to Keycloak
Apache License 2.0
530 stars 152 forks source link

Multiple KeyCloak clusters on the same Prometheus PushGateway : how to identify them and separate their indicators #100

Closed semangard closed 3 years ago

semangard commented 3 years ago

Description

We have 2 KeyCloak clusters running into the same Docker Swarn cluster. As recommanded we put in place the Prometheus Push Gateway.

How to get both views for JVM indicators :

Actual Behavior

If we do not set PROMETHEUS_GROUPING_KEY_INSTANCE then we are unable to get a view per cluster because the job's name is the same for the two clusters

If we set PROMETHEUS_GROUPING_KEY_INSTANCE=ENVVALUE:KEYCLOAK_CLUSTER_NAME then JVM metrics are not correctly taken into account into Prometheus and Grafana, e.g. the JVM memory is really much higher than the truth => back to the issue we tried to solve with using the Prometheus Push Gateway.

Currently we have: sum(jvm_memory_bytes_used{instance="$instance", area="heap"})*100/sum(jvm_memory_bytes_max{instance="$instance", area="heap"})

Expected Behavior

Be able to define our own custom PROMETHEUS_GROUPING_KEY_JOB in order to separate indicators of different clusters

Environment

semangard commented 3 years ago

Is it possible to merge https://github.com/aerogear/keycloak-metrics-spi/pull/102 please ?

pb82 commented 3 years ago

Closed with #102