3

I have added statistics-enabled="true" to the datasource of my standalone:

            <datasource jndi-name="java:jboss/datasources/RenavamDS"
                pool-name="RenavamDS" enabled="true" use-java-context="true" statistics-enabled="true">

But when I try to access http://localhost:9990/metrics I got the following internal error:

    ERROR [io.undertow.request]  (management I/O-1) UT005071: Undertow request failed HttpServerExchange{ GET /metrics}: java.lang.IllegalStateException: WFLYMETRICS0003: Unable to  read attribute second-level-cache-hit-count on [
    renavam-integrador-consulta_1  |     ("subsystem" => "jpa"),
    renavam-integrador-consulta_1  |     ("hibernate-persistence-unit" => "renavam-integrador-consulta.war#BaseCorrenteRenavamPersistenceUnit"),
    renavam-integrador-consulta_1  |     ("entity-cache" => "renavam.integrador.tabelas.domain.Especie")
    renavam-integrador-consulta_1  | ]: "WFLYCTL0158: Operation handler failed: java.lang.NullPointerException".

By googling (https://developer.jboss.org/thread/280621), I found out that disabling the second level cache of Hibernate eliminates the problem (at persistence.xml):

      <persistence-unit name="RenavamPersistenceUnit"
        transaction-type="JTA">
        <jta-data-source>java:jboss/datasources/RenavamDS</jta-data-source>
        <properties>
          <property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect" />
           <property name="hibernate.cache.use_second_level_cache" value="false"/> 
        </properties>
      </persistence-unit>

But it does not seems wise to disable the "second level cache" only to get some metrics.

Anyone knows how to properly enable the collection of metrics for the datasource in Wildfly 17? I'm specially interested in the metric wildfly_datasources_pool_available_count.

Thank you so much

0 Answers0