Keycloak metrics to support total number of user per Realm

Wants provide a snapshot of “total users” (and per Realm) in keycloak at any given point of time thru /auth/realms/master/metrics end point. This will be scraped by Prometheus and will be shown in Grafana.

We are already using aerogear/keycloak-metric-spi which does not have the above said metrics. Most probably I need to enhance the current keycloak-metric-spi to implement this

Anyone has already implemented this? I would like to get some help on implementation tips like what API to use for getting total# of users per Realm.

Thanks,