You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ds...@apache.org on 2015/01/23 14:44:19 UTC

ambari git commit: AMBARI-9262 AMS: stack traces printed to ambari-server.log (dsen)

Repository: ambari
Updated Branches:
  refs/heads/trunk fddf04318 -> df5577536


AMBARI-9262 AMS: stack traces printed to ambari-server.log (dsen)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/df557753
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/df557753
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/df557753

Branch: refs/heads/trunk
Commit: df55775367338cf52f4b222b2a765208f65a1ec6
Parents: fddf043
Author: Dmytro Sen <ds...@apache.org>
Authored: Thu Jan 22 22:32:27 2015 +0200
Committer: Dmytro Sen <ds...@apache.org>
Committed: Fri Jan 23 15:43:42 2015 +0200

----------------------------------------------------------------------
 .../metrics/timeline/AMSPropertyProvider.java     | 17 +++++++++++++++--
 .../timeline/AMSReportPropertyProvider.java       | 18 +++++++++++++++---
 2 files changed, 30 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/df557753/ambari-server/src/main/java/org/apache/ambari/server/controller/metrics/timeline/AMSPropertyProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/metrics/timeline/AMSPropertyProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/metrics/timeline/AMSPropertyProvider.java
index a2c94f2..666af32 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/metrics/timeline/AMSPropertyProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/metrics/timeline/AMSPropertyProvider.java
@@ -38,6 +38,7 @@ import org.codehaus.jackson.xc.JaxbAnnotationIntrospector;
 import java.io.BufferedReader;
 import java.io.IOException;
 import java.io.InputStreamReader;
+import java.net.SocketTimeoutException;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.HashMap;
@@ -190,14 +191,26 @@ public abstract class AMSPropertyProvider extends MetricsPropertyProvider {
             }
 
           } catch (IOException io) {
-            LOG.warn("Error getting timeline metrics.", io);
+            String errorMsg = "Error getting timeline metrics.";
+            if (LOG.isDebugEnabled()) {
+              LOG.error(errorMsg, io);
+            } else {
+              if (io instanceof SocketTimeoutException) {
+                errorMsg += " Can not connect to collector, socket error.";
+              }
+              LOG.error(errorMsg);
+            }
           } finally {
             if (reader != null) {
               try {
                 reader.close();
               } catch (IOException e) {
                 if (LOG.isWarnEnabled()) {
-                  LOG.warn("Unable to close http input steam : spec=" + spec, e);
+                  if (LOG.isDebugEnabled()) {
+                    LOG.warn("Unable to close http input stream : spec=" + spec, e);
+                  } else {
+                    LOG.warn("Unable to close http input stream : spec=" + spec);
+                  }
                 }
               }
             }

http://git-wip-us.apache.org/repos/asf/ambari/blob/df557753/ambari-server/src/main/java/org/apache/ambari/server/controller/metrics/timeline/AMSReportPropertyProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/metrics/timeline/AMSReportPropertyProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/metrics/timeline/AMSReportPropertyProvider.java
index 1ee3637..9752398 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/metrics/timeline/AMSReportPropertyProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/metrics/timeline/AMSReportPropertyProvider.java
@@ -40,12 +40,12 @@ import org.codehaus.jackson.xc.JaxbAnnotationIntrospector;
 import java.io.BufferedReader;
 import java.io.IOException;
 import java.io.InputStreamReader;
+import java.net.SocketTimeoutException;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Map;
 import java.util.Set;
 
-import static org.apache.ambari.server.controller.metrics.MetricsServiceProvider.MetricsService.GANGLIA;
 import static org.apache.ambari.server.controller.metrics.MetricsServiceProvider.MetricsService.TIMELINE_METRICS;
 
 public class AMSReportPropertyProvider extends MetricsReportPropertyProvider {
@@ -173,14 +173,26 @@ public class AMSReportPropertyProvider extends MetricsReportPropertyProvider {
         }
 
       } catch (IOException io) {
-        LOG.warn("Error getting timeline metrics.", io);
+        String errorMsg = "Error getting timeline metrics.";
+        if (LOG.isDebugEnabled()) {
+          LOG.error(errorMsg, io);
+        } else {
+          if (io instanceof SocketTimeoutException) {
+            errorMsg += " Can not connect to collector, socket error.";
+          }
+          LOG.error(errorMsg);
+        }
       } finally {
         if (reader != null) {
           try {
             reader.close();
           } catch (IOException e) {
             if (LOG.isWarnEnabled()) {
-              LOG.warn("Unable to close http input steam : spec=" + spec, e);
+              if (LOG.isDebugEnabled()) {
+                LOG.warn("Unable to close http input steam : spec=" + spec, e);
+              } else {
+                LOG.warn("Unable to close http input steam : spec=" + spec);
+              }
             }
           }
         }