diff --git a/src/main/java/org/datadog/jmxfetch/Instance.java b/src/main/java/org/datadog/jmxfetch/Instance.java index fec90d75d..2ca6a1d66 100644 --- a/src/main/java/org/datadog/jmxfetch/Instance.java +++ b/src/main/java/org/datadog/jmxfetch/Instance.java @@ -16,7 +16,6 @@ import java.io.InputStream; import java.lang.management.ManagementFactory; import java.util.ArrayList; -import java.util.Arrays; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; @@ -39,44 +38,6 @@ @Slf4j public class Instance implements BeanTracker { - private static final List SIMPLE_TYPES = - Arrays.asList( - "long", - "java.lang.String", - "int", - "float", - "double", - "java.lang.Double", - "java.lang.Float", - "java.lang.Integer", - "java.lang.Long", - "java.util.concurrent.atomic.AtomicInteger", - "java.util.concurrent.atomic.AtomicLong", - "java.lang.Object", - "java.lang.Boolean", - "boolean", - "java.lang.Number", - //Workaround for jasperserver, which returns attribute types as `class ` - "class java.lang.String", - "class java.lang.Double", - "class java.lang.Float", - "class java.lang.Integer", - "class java.lang.Long", - "class java.util.concurrent.atomic.AtomicInteger", - "class java.util.concurrent.atomic.AtomicLong", - "class java.lang.Object", - "class java.lang.Boolean", - "class java.lang.Number"); - private static final List COMPOSED_TYPES = - Arrays.asList( - "javax.management.openmbean.CompositeData", - "java.util.HashMap", - "java.util.Map"); - private static final List MULTI_TYPES = - Arrays.asList( - "javax.management.openmbean.TabularData", - //Adding TabularDataSupport as it implements TabularData - "javax.management.openmbean.TabularDataSupport"); private static final int MAX_RETURNED_METRICS = 350; private static final int DEFAULT_REFRESH_BEANS_PERIOD = 600; public static final String PROCESS_NAME_REGEX = "process_name_regex"; @@ -647,7 +608,7 @@ private synchronized void addMatchingAttributesForBean( } JmxAttribute jmxAttribute; String attributeType = attributeInfo.getType(); - if (SIMPLE_TYPES.contains(attributeType)) { + if (JmxSimpleAttribute.matchAttributeType(attributeType)) { log.debug( ATTRIBUTE + beanName @@ -667,7 +628,7 @@ private synchronized void addMatchingAttributesForBean( cassandraAliasing, emptyDefaultHostname, normalizeBeanParamTags); - } else if (COMPOSED_TYPES.contains(attributeType)) { + } else if (JmxComplexAttribute.matchAttributeType(attributeType)) { log.debug( ATTRIBUTE + beanName @@ -686,7 +647,7 @@ private synchronized void addMatchingAttributesForBean( tags, emptyDefaultHostname, normalizeBeanParamTags); - } else if (MULTI_TYPES.contains(attributeType)) { + } else if (JmxTabularAttribute.matchAttributeType(attributeType)) { log.debug( ATTRIBUTE + beanName