From cbdabe9ec80ec82ba1ca9e537611e27567b80dc9 Mon Sep 17 00:00:00 2001 From: Ashutosh Gupta Date: Wed, 22 Jun 2022 05:08:19 +0100 Subject: [PATCH] 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 --- .../apache/hadoop/yarn/service/monitor/probe/HttpProbe.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/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 b/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 index 492a11b2c67..40a87937629 100644 --- a/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 +++ b/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));