add uds support

This commit is contained in:
Arthur Bellal 2019-03-04 14:18:53 +01:00
parent 246bdfe081
commit 15df2cd8f4
1 changed files with 11 additions and 2 deletions

View File

@ -25,6 +25,8 @@ public class JMXFetch {
private static final int SLEEP_AFTER_JMXFETCH_EXITS = 5000;
private static final String UNIX_DOMAIN_SOCKET_PREFIX = "unix://";
public static final void run() {
run(Config.get());
}
@ -100,11 +102,18 @@ public class JMXFetch {
return "console";
}
final String host =
String host =
config.getJmxFetchStatsdHost() == null
? config.getAgentHost()
: config.getJmxFetchStatsdHost();
return "statsd:" + host + ":" + config.getJmxFetchStatsdPort();
int port = config.getJmxFetchStatsdPort();
if (host.startsWith(UNIX_DOMAIN_SOCKET_PREFIX)) {
host = host.substring(UNIX_DOMAIN_SOCKET_PREFIX.length());
// Port equal to zero tells the java dogstatsd client to use UDS
port = 0;
}
return "statsd:" + host + ":" + port;
}
private static List<String> getInternalMetricFiles() {