Provide metrics for user/client/session counts #16
Labels
No labels
bug
dependencies
documentation
duplicate
enhancement
github_actions
good first issue
help wanted
invalid
java
question
wontfix
renovate
renovate/manager
cargo
renovate/manager
dockerfile
renovate/manager
git-submodules
renovate/manager
gomod
renovate/manager
kustomize
renovate/manager
kustomize
renovate/manager
maven
renovate/manager
maven
renovate/manager
npm
renovate/manager
pip_requirements
renovate/manager
regex
renovate/manager
renovate-config-presets
renovate/manager
woodpecker
renovate/type
bump
renovate/type
digest
renovate/type
lockFileMaintenance
renovate/type
major
renovate/type
minor
renovate/type
patch
renovate/type
pin
renovate/type
pinDigest
renovate/type
replacement
renovate/type
rollback
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Reference: kokuwaio/keycloak-event-metrics#16
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
First of all, a thousand thank yous for writing this. Was hoping for someone to replace the aerogear metrics lib with something elegant, and this is it!
Curious if you'd consider adding gauges for stats like number of users, number of sessions (per client), etc.? I can do a PoC if it's something you'd be interested in.
Thank you.
Regarding your request for number of users/sessions - can you explain how to measure them?
Number of user sessions this would be
keycloak_event_user_total{type="LOGIN"} - keycloak_event_user_total{type="LOGOUT"}
. Or do i miss something?I made an example here where you can see the changes: https://github.com/kokuwaio/keycloak-event-metrics/compare/main...xgp:keycloak-event-metrics:xgp/gauges?expand=1
They are not metrics you can derive from events, but from the session. For the example, I put them on a timer, but you could also use Gauges that have a function that looks at the stats when observed.
Ok, got it. Let me think about this. Right now i would change something:
KC_METRICS_EVENT_REPLACE_IDS
), maybeKC_METRICS_DATA_COUNT
?KC_METRICS_DATA_COUNT_INTERVAL
?com.google.common
I'll pick up your branch and will work on this next week.
Thx for the request!
Great. Thanks for the feedback. I updated the branch to include
KC_METRICS_DATA_COUNT
andKC_METRICS_DATA_COUNT_INTERVAL
. I also extracted out the configuration into a separate class to make it easier to add new params in the future. https://github.com/kokuwaio/keycloak-event-metrics/compare/main...xgp:keycloak-event-metrics:xgp/gauges?expand=1The google guava library is a Keycloak dependency (https://github.com/keycloak/keycloak/blob/main/pom.xml#L670), so this would not be pulling in an additional transitive dependency. I use it in all of my extensions. As long as it's marked
provided
in the pom, it doesn't produce problems.Great rule! I will take a pass at updating and creating new tests this weekend.
Just an update that I spent quite a bit of time wrestling with the tests, but I wasn't able to get them working or understand your testing setup. My apologies, but there's just too much for me in there that I'm not familiar with. Apologies for taking your time.
Please check release 1.0.0
@sschnabe Very cool. I'm glad you were able to incorporate some of those metrics.
In case you want to have the Gauges calculated when they are called, rather than using a timer task, I found that you can create a Gauge that is lazy evaluated. I made an example here: https://github.com/xgp/keycloak-event-metrics/blob/xgp/gauges/src/main/java/io/kokuwa/keycloak/metrics/RealmGauges.java#L33