Browse Source

YARN-9971.YARN Native Service HttpProbe logs THIS_HOST in error messages (#4436)

* YARN-9971.YARN Native Service HttpProbe logs THIS_HOST in error messages

Co-authored-by: Ashutosh Gupta <ashugpt@amazon.com>
Ashutosh Gupta 3 năm trước cách đây
mục cha
commit
cbdabe9ec8

+ 4 - 2
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/monitor/probe/HttpProbe.java

@@ -88,8 +88,9 @@ public class HttpProbe extends DefaultProbe {
     }
     String ip = instance.getContainerStatus().getIPs().get(0);
     HttpURLConnection connection = null;
+    String hostString = urlString.replace(HOST_TOKEN, ip);
     try {
-      URL url = new URL(urlString.replace(HOST_TOKEN, ip));
+      URL url = new URL(hostString);
       connection = getConnection(url, this.timeout);
       int rc = connection.getResponseCode();
       if (rc < min || rc > max) {
@@ -101,7 +102,8 @@ public class HttpProbe extends DefaultProbe {
         status.succeed(this);
       }
     } catch (Throwable e) {
-      String error = "Probe " + urlString + " failed for IP " + ip + ": " + e;
+      String error =
+          "Probe " + hostString + " failed for IP " + ip + ": " + e;
       log.info(error, e);
       status.fail(this,
           new IOException(error, e));