Closed CathalOConnorRH closed 3 years ago
/lgtm
@pb82 Would like to take a look as well?
LGTM
@CathalOConnorRH if it is absolutely required to add those labels to the histogram, can we make that opt-in behind a flag?
@pb82 I've updated the ResourceExtractor
to include a URI_METRICS_ENABLED
boolean and a check for /token URI.
an example of the metrics output is attached
Let me know what you think
Hey @pb82 Have you had any thoughts on the above changes ?
thanks @CathalOConnorRH I'll give it a final try and then merge
@pb82 did you find time to try it out? Just curious about the status. Thanks!
@pb82 I've implemented the detailed output and removed the uri when it's not enabled.
Some sample output of each of the three scenarios are attached.
Let me know what you think
URIEnabledURIDetailed.txt
URIDisabled.txt
URIEnabled.txt
@pb82 We need this change in MAS SSO soon, to build some metrics - dashboards and also to investigate and get precise information regarding our load (which end points are used most). Can you take a look and close this at the earliest?
Motivation
https://issues.redhat.com/browse/MGDSTRM-3724 https://issues.redhat.com/browse/MGDSTRM-4318
What
Add status code and uri to the keycloak_request_duration_bucket metric
Why
This will allow filtering on specific statuses Currently no status are returned in the metric
keycloak_request_duration_bucket{method="POST",resource="realms,realms/master/protocol/openid-connect",le="50.0",} 0.0 keycloak_request_duration_bucket{method="POST",resource="realms,realms/master/protocol/openid-connect",le="100.0",} 0.0 keycloak_request_duration_bucket{method="POST",resource="realms,realms/master/protocol/openid-connect",le="250.0",} 0.0 keycloak_request_duration_bucket{method="POST",resource="realms,realms/master/protocol/openid-connect",le="500.0",} 0.0 keycloak_request_duration_bucket{method="POST",resource="realms,realms/master/protocol/openid-connect",le="1000.0",} 1.0 keycloak_request_duration_bucket{method="POST",resource="realms,realms/master/protocol/openid-connect",le="2000.0",} 1.0 keycloak_request_duration_bucket{method="POST",resource="realms,realms/master/protocol/openid-connect",le="10000.0",} 1.0 keycloak_request_duration_bucket{method="POST",resource="realms,realms/master/protocol/openid-connect",le="30000.0",} 1.0 keycloak_request_duration_bucket{method="POST",resource="realms,realms/master/protocol/openid-connect",le="+Inf",} 1.0 keycloak_request_duration_count{method="POST",resource="realms,realms/master/protocol/openid-connect",} 1.0 keycloak_request_duration_sum{method="POST",resource="realms,realms/master/protocol/openid-connect",} 625.0
How
added status code and uri to the to the bucket output.
Verification Steps
Option 1
Option 2
update keycloak cr to use the jar built and released from my fork
https://github.com/CathalOConnorRH/keycloak-metrics-spi/releases/tag/v2.4.1-beta
Metrics should look similar to
keycloak_request_duration_bucket{code="200",method="POST",resource="realms,realms/master/protocol/openid-connect",uri="realms/master/protocol/openid-connect/token",le="50.0",} 0.0 keycloak_request_duration_bucket{code="200",method="POST",resource="realms,realms/master/protocol/openid-connect",uri="realms/master/protocol/openid-connect/token",le="100.0",} 0.0 keycloak_request_duration_bucket{code="200",method="POST",resource="realms,realms/master/protocol/openid-connect",uri="realms/master/protocol/openid-connect/token",le="250.0",} 1.0 keycloak_request_duration_bucket{code="200",method="POST",resource="realms,realms/master/protocol/openid-connect",uri="realms/master/protocol/openid-connect/token",le="500.0",} 1.0 keycloak_request_duration_bucket{code="200",method="POST",resource="realms,realms/master/protocol/openid-connect",uri="realms/master/protocol/openid-connect/token",le="1000.0",} 1.0 keycloak_request_duration_bucket{code="200",method="POST",resource="realms,realms/master/protocol/openid-connect",uri="realms/master/protocol/openid-connect/token",le="2000.0",} 1.0 keycloak_request_duration_bucket{code="200",method="POST",resource="realms,realms/master/protocol/openid-connect",uri="realms/master/protocol/openid-connect/token",le="10000.0",} 1.0 keycloak_request_duration_bucket{code="200",method="POST",resource="realms,realms/master/protocol/openid-connect",uri="realms/master/protocol/openid-connect/token",le="30000.0",} 1.0 keycloak_request_duration_bucket{code="200",method="POST",resource="realms,realms/master/protocol/openid-connect",uri="realms/master/protocol/openid-connect/token",le="+Inf",} 1.0 keycloak_request_duration_count{code="200",method="POST",resource="realms,realms/master/protocol/openid-connect",uri="realms/master/protocol/openid-connect/token",} 1.0
Checklist:
Progress
Additional Notes
PS.: Add images and/or .gifs to illustrate what was changed if this pull request modifies the appearance/output of something presented to the users.