aerogear / keycloak-metrics-spi

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

Customize job name for multiple KeyCloak clusters on the same Prometheus PushGateway #102

Closed guerricmerleHUG closed 3 years ago

guerricmerleHUG commented 3 years ago

Motivation

https://github.com/aerogear/keycloak-metrics-spi/issues/100

What

This Pull Request introduces a new system environnment variable PROMETHEUS_GROUPING_KEY_JOB to override default "keycloak" job name.

Why

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

How

Add new system env PROMETHEUS_GROUPING_KEY_JOB

Verification Steps

Add the steps required to check this change. Following an example.

  1. Build the code
  2. Copy the artifact into $KC/standalone/deployments
  3. set system var env to PROMETHEUS_GROUPING_KEY_JOB=keycloak_cluster_A
  4. Make sure the metrics logger is turned on
  5. Play with Keycloak a bit
  6. Look at the following url: "$KC/auth/realms/master/metrics", job name is equals to keycloak_cluster_A

Checklist:

Progress

semangard commented 3 years ago

@pb82 : is-it possible to check this PR please ?

pb82 commented 3 years ago

Yep, seems like a small enough change. I'll try to get it in asap.