aerogear / keycloak-metrics-spi

Adds a Metrics Endpoint to Keycloak
Apache License 2.0
548 stars 156 forks source link

Missing or wrong labels for certain metrics #167

Open npriebe opened 1 year ago

npriebe commented 1 year ago

Description

Hi, I noticed that for certain metrics either labels are missing or the labels give wrong values.

The following metrics still need labels:

keycloak_logins, keycloak_failed_attempts, keycloak_client_logins, keycloak_failed_login_attempts:

With this metric, it was useful to have the username as a label for understanding where the request is being attempted.

keycloak_response_errors:

With this metric, the realm as a label is missing. Screenshot from 2023-06-05 13-44-38

The following metrics has wrong label values:

keycloak_failed_client_login_attempts:

Here has the label "client_id" wrong values. Screenshot from 2023-06-05 13-41-54 For the other metrics, the name of the client is set as client_id. Example: Screenshot from 2023-06-05 14-02-28

Expected Behavior

Metrics with the described labels.

Actual Behavior

Labels seem to be missing.

Environment

cebrat commented 1 year ago

Same for me, with the same spi and keycloak versions.

trixpan commented 1 year ago

@npriebe adding username to the metric would increase cardinality and afaik it is generally considered poor practice to do that in TSDBs

e.g.

https://grafana.com/blog/2022/02/15/what-are-cardinality-spikes-and-why-do-they-matter

souravs17031999 commented 1 year ago

@npriebe did you find any solution ? I find the values as wrong since in every metrics, it's showing me large values (for ex. keycloak_logins_created{realm="xyz",provider="keycloak",client_id="service",} 1.688189803383E9 which converts to 1688189803.383 when displayed in prometheus/grafana ) for all the clients which doesn't make any sense (considering the amount of requests stats)