Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
None
-
None
-
None
Description
Error:
java.lang.StringIndexOutOfBoundsException: String index out of range: -2 at java.lang.String.substring(String.java:1931) at org.apache.ignite.spi.metric.jmx.MetricRegistryMBean.lambda$getMBeanInfo$0(MetricRegistryMBean.java:105) at java.util.Iterator.forEachRemaining(Iterator.java:116) at org.apache.ignite.spi.metric.jmx.MetricRegistryMBean.getMBeanInfo(MetricRegistryMBean.java:85) at org.apache.ignite.spi.metric.jmx.MetricRegistryMBean.getAttribute(MetricRegistryMBean.java:58) at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.getAttribute(DefaultMBeanServerInterceptor.java:647) at com.sun.jmx.mbeanserver.JmxMBeanServer.getAttribute(JmxMBeanServer.java:678) at javax.management.MBeanServerInvocationHandler.invoke(MBeanServerInvocationHandler.java:273) at com.sun.proxy.$Proxy32.getMBeanInfo(Unknown Source) at org.apache.ignite.internal.metric.JmxExporterSpiTest.test(JmxExporterSpiTest.java:146) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.apache.ignite.testframework.junits.GridAbstractTest$7.run(GridAbstractTest.java:2391) at java.lang.Thread.run(Thread.java:748)
Reproducer:
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); JmxMetricExporterSpi jmxSpi = new JmxMetricExporterSpi(); cfg.setMetricExporterSpi(jmxSpi); return cfg; } /** */ @Test public void test() throws Exception { IgniteEx srv = startGrid(); DynamicMBean mBean = metricRegistry(srv.name(), "io", "discovery"); mBean.getMBeanInfo(); }
The main reason: JMX exporter assumes that each metric must starts with the name of the registry it belongs to (see MetricRegistryMBean#getMBeanInfo), but discovery metrics do not obey this naming convection (see TcpDiscoveryStatistics/ZookeeperDiscoveryStatistics).
Attachments
Issue Links
- is fixed by
-
IGNITE-14428 Formalize the names of the metrics included in the metric registry.
- Resolved
- links to