Uploaded image for project: 'Infinispan'
  1. Infinispan
  2. ISPN-15278

crossSiteReplicationTimes is incorrectly marked as attribute

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not a Bug
    • Icon: Major Major
    • None
    • 13.0.20.Final
    • Cross-Site Replication
    • None
    • Hide

      1. Start an application with Infinispan Embedded Cache in Jetty (or other application container), with the jmx_exporter_javaagent.

      java -javaagent:./jmx_prometheus_javaagent-0.20.0.jar=12345:config.yml -jar $JETTY_HOME/start.jar

      config.yml:

      rules:
        - pattern: ".*" 

      2. Wait for the application and the cache to start.
      3. Get http://localhost:12345/metrics (in browser or with curl)
      4. The exception and stacktrace should appear in the Jetty-output.

      Show
      1. Start an application with Infinispan Embedded Cache in Jetty (or other application container), with the jmx_exporter_javaagent. java -javaagent:./jmx_prometheus_javaagent-0.20.0.jar=12345:config.yml -jar $JETTY_HOME/start.jar config.yml: rules: - pattern: ".*" 2. Wait for the application and the cache to start. 3. Get http://localhost:12345/metrics (in browser or with curl) 4. The exception and stacktrace should appear in the Jetty-output.

      Problem description

      I am using the jmx_prometheus_javaagent to export all my jmx-metrics to prometheus. But when I have an Embedded Infinispan Cache in my application, the following exception occurs:

      prometheus-http-1-1 28-10-2023 11:35:18.175 org.infinispan.jmx.ResourceDMBean.java:322 - Exception while reading value of attribute crossSiteReplicationTimes
      java.lang.NullPointerException: null
              at org.infinispan.jmx.ResourceDMBean$InvokableSetterBasedMBeanAttributeInfo.invoke(ResourceDMBean.java:428)
              at org.infinispan.jmx.ResourceDMBean.getNamedAttribute(ResourceDMBean.java:317)
              at org.infinispan.jmx.ResourceDMBean.getAttribute(ResourceDMBean.java:199)
              at java.management/com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.getAttribute(DefaultMBeanServerInterceptor.java:641)
              at java.management/com.sun.jmx.mbeanserver.JmxMBeanServer.getAttribute(JmxMBeanServer.java:678)
              at io.prometheus.jmx.JmxScraper.processAttributesOneByOne(JmxScraper.java:261)
              at io.prometheus.jmx.JmxScraper.scrapeBean(JmxScraper.java:211)
              at io.prometheus.jmx.JmxScraper.doScrape(JmxScraper.java:149)
              at io.prometheus.jmx.JmxCollector.collect(JmxCollector.java:771)
              at io.prometheus.jmx.shaded.io.prometheus.client.Collector.collect(Collector.java:45)
              at io.prometheus.jmx.shaded.io.prometheus.client.CollectorRegistry$MetricFamilySamplesEnumeration.findNextElement(CollectorRegistry.java:204)
              at io.prometheus.jmx.shaded.io.prometheus.client.CollectorRegistry$MetricFamilySamplesEnumeration.nextElement(CollectorRegistry.java:219)
              at io.prometheus.jmx.shaded.io.prometheus.client.CollectorRegistry$MetricFamilySamplesEnumeration.nextElement(CollectorRegistry.java:152)
              at io.prometheus.jmx.shaded.io.prometheus.client.exporter.common.TextFormat.write004(TextFormat.java:71)
              at io.prometheus.jmx.shaded.io.prometheus.client.exporter.common.TextFormat.writeFormat(TextFormat.java:53)
              at io.prometheus.jmx.shaded.io.prometheus.client.exporter.HTTPServer$HTTPMetricHandler.handle(HTTPServer.java:100)
              at jdk.httpserver/com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:77)
              at jdk.httpserver/sun.net.httpserver.AuthFilter.doFilter(AuthFilter.java:82)
              at jdk.httpserver/com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:80)
              at jdk.httpserver/sun.net.httpserver.ServerImpl$Exchange$LinkHandler.handle(ServerImpl.java:848)
              at jdk.httpserver/com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:77)
              at jdk.httpserver/sun.net.httpserver.ServerImpl$Exchange.run(ServerImpl.java:817)
              at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
              at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
              at java.base/java.lang.Thread.run(Thread.java:829)
       

      The same for:

      • org.infinispan.interceptors.impl.CacheMgmtInterceptor#setHitTimes
      • org.infinispan.interceptors.impl.CacheMgmtInterceptor#setMissTimes
      • org.infinispan.interceptors.impl.CacheMgmtInterceptor#setStoreTimes
      • org.infinispan.interceptors.impl.CacheMgmtInterceptor#setRemoveTimes
      • org.infinispan.remoting.rpc.RpcManagerImpl#isStatisticsEnabled
        Something seems to be causing 'wrong number of arguments'.

      Problem cause

      At RpcManagerImpl#setCrossSiteReplicationTimes(RpcManagerImpl.java:614)  the method is annotated with '@ManagedAttribute' meaning that the method can be called to get a certain attribute. From the ManagedAttribute-annotations, the class CorePackageImpl.java is generated that in some way registers the attributes that can be obtained from the RpcManagerImpl. This causes the prometheus/jmx_exporter (via Infinispan ResourceDMBean) to retrieve the attribute. As it does not exist, it fails.

      Problem solution

      Maybe should the '@ManagedAttribute'-annotation be changed to a  '@ManagedOperation'-annotation??

              pruivo@redhat.com Pedro Ruivo
              michahagg Micha Hagg (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: