Skip to content
This repository was archived by the owner on Mar 3, 2023. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,11 @@ public PhysicalPlanHelper(PhysicalPlans.PhysicalPlan pplan, String instanceId) {
}

try {
this.hostname = InetAddress.getLocalHost().getHostName();
if (System.getenv("HOST") != null) {
this.hostname = System.getenv("HOST");
} else {
this.hostname = InetAddress.getLocalHost().getHostName();
}
} catch (UnknownHostException e) {
throw new RuntimeException("GetHostName failed");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,14 @@ public MetricsManagerClient(NIOLooper s, String metricsHost, int metricsPort,
addMetricsManagerClientTasksOnWakeUp();

try {
this.hostname = InetAddress.getLocalHost().getHostName();
if (System.getenv("HOST") != null) {
this.hostname = System.getenv("HOST");
} else {
this.hostname = InetAddress.getLocalHost().getHostName();
}
} catch (UnknownHostException e) {
throw new RuntimeException("GetHostName failed");
LOG.log(Level.SEVERE, "Unable to get local host name", e);
this.hostname = "localhost";
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import java.io.IOException;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.concurrent.TimeUnit;
import java.util.logging.Level;
import java.util.logging.Logger;
Expand Down Expand Up @@ -354,12 +355,24 @@ public static void main(String[] args) throws Exception {
.build());
LOG.info("Cli Config: " + config.toString());

String hostname;
try {
if (System.getenv("HOST") != null) {
hostname = System.getenv("HOST");
} else {
hostname = InetAddress.getLocalHost().getHostName();
}
} catch( UnknownHostException e) {
LOG.log(Level.SEVERE, "Unable to get local hostname", e);
hostname = "localhost";
}

// build metricsCache location
TopologyMaster.MetricsCacheLocation metricsCacheLocation =
TopologyMaster.MetricsCacheLocation.newBuilder()
.setTopologyName(topologyName)
.setTopologyId(topologyId)
.setHost(InetAddress.getLocalHost().getHostName())
.setHost(hostname)
.setControllerPort(-1) // not used for metricscache
.setMasterPort(masterPort)
.setStatsPort(statsPort)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,11 @@ public static boolean checkHttpResponseCode(HttpURLConnection connection, int ex
public static String getHostName() {
String hostName;
try {
hostName = InetAddress.getLocalHost().getHostName();
if (System.getenv("HOST") != null) {
hostName = System.getenv("HOST");
} else {
hostName = InetAddress.getLocalHost().getHostName();
}
} catch (UnknownHostException e) {
LOG.log(Level.SEVERE, "Unable to get local host name", e);
hostName = "localhost";
Expand Down