Eiichi Sato created IGNITE-13342:
------------------------------------

             Summary: DynamicMBean#getAttributes() should return a list of 
Attributes, not Objects
                 Key: IGNITE-13342
                 URL: https://issues.apache.org/jira/browse/IGNITE-13342
             Project: Ignite
          Issue Type: Improvement
    Affects Versions: 2.8.1
            Reporter: Eiichi Sato


Currently, calling #getAttributes() on MBeans such as 
`org.apache:clsLdr=18b4aac2,group=views,name="sql.queries"` returns an 
AttributeList directly containing raw attribute values, not 
javax.management.Attribute.
 
[https://github.com/apache/ignite/blob/77d21eaa367ea293233078e85ed0c967dc2b6ee7/modules/core/src/main/java/org/apache/ignite/spi/metric/jmx/ReadOnlyDynamicMBean.java#L66]

 

According to the javadoc of AttributeList, this is "highly discouraged".
 > For compatibility reasons, it is possible, though highly discouraged, to add 
 >objects to an {{AttributeList}} that are not instances of {{Attribute}}. 
 [https://docs.oracle.com/javase/8/docs/api/javax/management/AttributeList.html]

 

Also, this behavior seems to cause jmx_exporter to fail due to 
AttributeList#asList() throwing an IllegalArgumentException when non-Attribute 
element is found.
 [https://github.com/prometheus/jmx_exporter/issues/483]
 [https://github.com/prometheus/jmx_exporter/issues/501]

 

I wouldn't call this a bug, but it'd be better if Ignite can simply wrap raw 
attribute values by Attribute class. I'm going to write a patch and send a PR 
on GitHub.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to