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>
This commit is contained in:
Ashutosh Gupta 2022-06-22 05:08:19 +01:00 committed by GitHub
parent ef36457b53
commit cbdabe9ec8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 2 deletions

View File

@ -88,8 +88,9 @@ public ProbeStatus ping(ComponentInstance instance) {
}
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 ProbeStatus ping(ComponentInstance instance) {
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));