[prev in list] [next in list] [prev in thread] [next in thread] 

List:       rhq-commits
Subject:    [rhq] Branch 'release/jon3.0.x' - modules/core
From:       ips () fedoraproject ! org (ips)
Date:       2012-01-31 19:48:54
Message-ID: 20120131194854.585421262 () lists ! fedorahosted ! org
[Download RAW message or body]

 modules/core/plugin-container/src/main/java/org/rhq/core/pc/measurement/MeasurementSenderRunner.java \
|   27 ++++++++--  1 file changed, 23 insertions(+), 4 deletions(-)

New commits:
commit 72bb3d37c84b3af4250c5daee87438be9d9fbb26
Author: Ian Springer <ian.springer at redhat.com>
Date:   Fri Nov 11 10:57:33 2011 -0500

    log message reporting invalid numeric metrics at DEBUG, rather than WARN,
    to avoid flooding the agent log with repetitive messages
    (cherry picked from commit 542a30ca6d0eaebbee5365c756955255ba367e4e)

diff --git a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/measurement/MeasurementSenderRunner.java \
b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/measurement/MeasurementSenderRunner.java
 index 5cee6a6..a9136d1 100644
--- a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/measurement/MeasurementSenderRunner.java
                
+++ b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/measurement/MeasurementSenderRunner.java
 @@ -90,15 +90,34 @@ public class MeasurementSenderRunner implements \
                Callable<MeasurementReport>, Run
         Iterator<MeasurementDataNumeric> iter = report.getNumericData().iterator();
         while (iter.hasNext()) {
             MeasurementDataNumeric numeric = iter.next();
-            Double v = numeric.getValue();
-            if (v == null || v.isInfinite() || v.isNaN()) {
-                LOG.warn("Numeric " + numeric.getName() + " with id " + \
                numeric.getScheduleId()
-                    + " is invalid, value was '" + v + "'");
+            Double value = numeric.getValue();
+            if (value == null || value.isInfinite() || value.isNaN()) {
+                if (LOG.isDebugEnabled()) {
+                    String stringValue = getStringValue(value);
+                    LOG.debug("Numeric metric [" + numeric.getName() + "] with \
schedule id [" + numeric.getScheduleId() +                        + "] is invalid - \
value is [" + stringValue + "]."); +                }
                 iter.remove();
             }
         }
     }
 
+    private String getStringValue(Double value) {
+        String stringValue;
+        if (value == null) {
+            stringValue = "null";
+        } else if (value.isNaN()) {
+            stringValue = "Double.NaN";
+        } else if (value == Double.POSITIVE_INFINITY) {
+            stringValue = "Double.POSITIVE_INFINITY";
+        } else if (value == Double.NEGATIVE_INFINITY) {
+            stringValue = "Double.NEGATIVE_INFINITY";
+        } else {
+            stringValue = value.toString();
+        }
+        return stringValue;
+    }
+
     public void run() {
         try {
             call();


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic