diff --git a/agent/agent-tooling/src/main/java/com/microsoft/applicationinsights/agent/internal/init/PerformanceCounterInitializer.java b/agent/agent-tooling/src/main/java/com/microsoft/applicationinsights/agent/internal/init/PerformanceCounterInitializer.java index ff488d94aad..29687a07cfa 100644 --- a/agent/agent-tooling/src/main/java/com/microsoft/applicationinsights/agent/internal/init/PerformanceCounterInitializer.java +++ b/agent/agent-tooling/src/main/java/com/microsoft/applicationinsights/agent/internal/init/PerformanceCounterInitializer.java @@ -193,6 +193,10 @@ private static void calculateAndRecordValueForAttribute( JmxDataFetcher.fetch( objectName, jmxAttributeData.attribute); // should return the [val, ...] here + if (!result.isEmpty()) { + logger.info("Fetched JMX metrics: ", result); + } + logger.trace( "Size of the JmxDataFetcher.fetch result: {}, for objectName:{} and metricName:{}", result.size(), @@ -209,6 +213,7 @@ private static void calculateAndRecordValueForAttribute( value += Double.parseDouble(String.valueOf(obj)); } } catch (RuntimeException e) { + logger.warn("Unexpected value from JMX: " + result, e); ok = false; break; } diff --git a/agent/agent-tooling/src/main/java/com/microsoft/applicationinsights/agent/internal/perfcounter/AbstractJmxPerformanceCounter.java b/agent/agent-tooling/src/main/java/com/microsoft/applicationinsights/agent/internal/perfcounter/AbstractJmxPerformanceCounter.java index 0c1104ae17e..f02541a6591 100644 --- a/agent/agent-tooling/src/main/java/com/microsoft/applicationinsights/agent/internal/perfcounter/AbstractJmxPerformanceCounter.java +++ b/agent/agent-tooling/src/main/java/com/microsoft/applicationinsights/agent/internal/perfcounter/AbstractJmxPerformanceCounter.java @@ -35,6 +35,10 @@ public synchronized void report(TelemetryClient telemetryClient) { try { Map> result = JmxDataFetcher.fetch(objectName, attributes); + if (!result.isEmpty()) { + logger.info("Fetched JMX metrics: ", result); + } + for (Map.Entry> displayAndValues : result.entrySet()) { boolean ok = true; double value = 0.0; @@ -46,6 +50,7 @@ public synchronized void report(TelemetryClient telemetryClient) { value += Double.parseDouble(String.valueOf(obj)); } } catch (RuntimeException e) { + logger.warn("Unexpected value from JMX: " + displayAndValues, e); ok = false; break; }