[keycloak-dev] NPE in keycloak logs in MetricsEventListener

David Martin davmarti at redhat.com
Tue Feb 13 05:05:16 EST 2018


On 12 February 2018 at 18:28, Peter Braun <pbraun at redhat.com> wrote:
> Hi David, Hi Jose,
>
> we’ve also seen this today when debugging Keycloak with Jose. Looks like we
> need to add null checks to
> https://github.com/aerogear/keycloak-metrics-spi/blob/mobile-metrics/src/main/java/org/jboss/aerogear/keycloak/metrics/PrometheusExporter.java#L97
> and
> https://github.com/aerogear/keycloak-metrics-spi/blob/mobile-metrics/src/main/java/org/jboss/aerogear/keycloak/metrics/PrometheusExporter.java#L107
>
> Jose found another issue: For the metrics to work we need to add the
> metrics-listener to every Realm we are interested in (metrics wise). That
> happens automatically for the Project realm. But if the user creates a new
> Realm in Keycloak or through a custom config file then this listener is not
> added. To enable metrics the user would have to add the listener manually in
> the Keycloak Admin Panel.
>
> @David: do you think this is an issue? It means additional config steps for
> custom Realms that need to be documented.

It sounds like there should at least be some documentation to cover
this scenario.
e.g.
How to gather metrics for a custom realm.

Having metrics gathered for the all realms automatically may be desirable.
However, I wouldn't say its high priority given that the mobile use
case with Sync & Keycloak leverages the 'namespace' realm

>
> I think it’s possible to add the metrics-listener to every realm
> automatically by configuring it in standalone.xml:
> http://www.keycloak.org/docs/3.3/server_installation/topics/config-subsystem/configure-spi-providers.html
>
> Especially by running a CLI command to add a SPI to the config:
> http://www.keycloak.org/docs/3.3/server_installation/topics/config-subsystem/cli-recipes.html
>
> Will look into this with Jose.
>
>
> Regards,
> Peter
>
>
> Am 12.02.2018 um 18:23 schrieb David Martin <davmarti at redhat.com>:
>
> @Jose, @Peter,
> sharing this on the lists in case anyone else comes across it (I came
> across it while chatting with Jose on IRC).
> I also see successful events being logged in keycloak and getting
> through to prometheus & the grafana dashboard.
>
> 17:12:49,764 ERROR [org.keycloak.events.EventBuilder] (default
> task-75) Failed to send type to
> org.jboss.aerogear.keycloak.metrics.MetricsEventListener at 535339d3:
> java.lang.NullPointerException
>
> Full logs & stack
> https://gist.github.com/david-martin/430709202e4064fe49e6df139380bd2d
>
> Images being used:
> aerogearcatalog/keycloak-apb
> latest              0a791099254b        4 days ago          669MB
> jboss/keycloak-openshift
> 3.4.3.Final         a032ac87a920        5 weeks ago         844MB
> aerogearcatalog/metrics-apb
> latest              058e78efe352        4 days ago          669MB
>
>
> --
> David Martin
> Red Hat Mobile
> Twitter: @irldavem
> IRC: @irldavem (#aerogear)
>
>



-- 
David Martin
Red Hat Mobile
Twitter: @irldavem
IRC: @irldavem (#aerogear)



More information about the keycloak-dev mailing list