[keycloak-dev] Metrics Endpoint

Thomas Darimont thomas.darimont at googlemail.com
Thu Jan 25 18:07:34 EST 2018


A while ago I did a proposal for a dashboard page for the Keycloak admin
console that build on such metrics:
http://lists.jboss.org/pipermail/keycloak-dev/2016-May/007266.html

See also: https://issues.jboss.org/browse/KEYCLOAK-1840

Would be great to have such a metrics API that would also work in clustered
scenarios.

Cheers,
Thomas

2018-01-25 20:53 GMT+01:00 Stian Thorgersen <sthorger at redhat.com>:

> Would be good to have support for Prometheus. This is also information that
> would be good to display in the Keycloak admin console.
>
> I don't think using an event listener is the right approach though. One
> issue here is that this will only work for a single node and not in a
> cluster. The numbers should also be per-realm, not for all realms.
>
> A better option may be to add an MetricsSPI where the default provider
> would get the details from Keycloak itself. Useful details could be:
>
> * Number of active sessions - we can get this from counting number of open
> sessions (not sure if that will be a costly query to do as user sessions
> are stored in a distributed cache)
> * Number of failed logins - we can get this from events storage when
> enabled and it can be made configurable to only consider events for the
> last X days
> * Number of logins - same as above
>
> We could add a new endpoint /realms/<realm-name>/metrics/<provider>. That
> would allow adding whatever provider for the format you want (i.e.
> prometheus). I don't think this info should be available publicly though so
> it has to be protected somehow.
>
> I'm also not to keen on using io.prometheus.client library for this if that
> can be avoided. We don't like having to maintain additional libraries and
> prefer to use things that are already available in EAP/WilldFly.
>
> On 22 January 2018 at 13:45, Matthias Wessendorf <matzew at apache.org>
> wrote:
>
> > On Mon, Jan 22, 2018 at 12:45 PM, Peter Braun <pbraun at redhat.com> wrote:
> >
> > > Hey everybody,
> > >
> > > we (the AeroGear/Mobile team) have created a SPI that adds a metrics
> > > endpoint to KeyCloak[1]. It’s inspired by a similar project named
> > > keycloak-metrics-prometheus[2] but does not require an extra service.
> > > Metrics data is based on internal events and is exposed in Prometheus
> > > format.
> > >
> > > Just wanted to share this with you since there are a number of tickets
> in
> > > the KeyCloak JIRA about a such an endpoint. We’re happy about any
> > > suggestions/opinions. We’re also open to an upstream contribution if
> the
> > > opportunity arises and you are interested.
> > >
> >
> > +1 for having this directly in Keycloak :-)
> >
> >
> >
> > >
> > >
> > > Regards,
> > > Peter
> > >
> > > [1] https://github.com/aerogear/keycloak-metrics-spi <
> > > https://github.com/aerogear/keycloak-metrics-spi>
> > > [2] https://github.com/larscheid-schmitzhermes/keycloak-
> > > monitoring-prometheus <https://github.com/larscheid-
> > > schmitzhermes/keycloak-monitoring-prometheus>
> > > _______________________________________________
> > > keycloak-dev mailing list
> > > keycloak-dev at lists.jboss.org
> > > https://lists.jboss.org/mailman/listinfo/keycloak-dev
> >
> >
> >
> >
> > --
> > Matthias Wessendorf
> >
> > github: https://github.com/matzew
> > twitter: http://twitter.com/mwessendorf
> > _______________________________________________
> > keycloak-dev mailing list
> > keycloak-dev at lists.jboss.org
> > https://lists.jboss.org/mailman/listinfo/keycloak-dev
> >
> _______________________________________________
> keycloak-dev mailing list
> keycloak-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/keycloak-dev
>


More information about the keycloak-dev mailing list