Skip to content

Commit

Permalink
Re-land changes from #481
Browse files Browse the repository at this point in the history
  • Loading branch information
scottopell committed Dec 27, 2023
1 parent 781db37 commit 905532a
Showing 1 changed file with 3 additions and 42 deletions.
45 changes: 3 additions & 42 deletions src/main/java/org/datadog/jmxfetch/Instance.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -39,44 +38,6 @@

@Slf4j
public class Instance implements BeanTracker {
private static final List<String> 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 <type>`
"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<String> COMPOSED_TYPES =
Arrays.asList(
"javax.management.openmbean.CompositeData",
"java.util.HashMap",
"java.util.Map");
private static final List<String> 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";
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 905532a

Please sign in to comment.