src/main/java/org/jmxtrans/agent/graphite/GraphiteMetricMessageBuilder.java
private static String buildMetricPathPrefix(String configuredMetricPathPrefix) {
        if (configuredMetricPathPrefix != null) {
            return configuredMetricPathPrefix;
        }
        String hostname;
        try {
            hostname = InetAddress.getLocalHost().getHostName().replaceAll("\\.", "_");
        } catch (UnknownHostException e) {
            hostname = "#unknown#";
        }
        return String.format(DEFAULT_METRIC_PATH_PREFIX_FORMAT, hostname);
    }
private static String buildMetricPathPrefix(String configuredMetricPathPrefix) {
        if (configuredMetricPathPrefix != null) {
            return configuredMetricPathPrefix;
        }
        String hostname;
        try {
            hostname = InetAddress.getLocalHost().getHostName().replaceAll("\\.", "_");
        } catch (UnknownHostException e) {
            hostname = "#unknown#";
        }
        return String.format(DEFAULT_METRIC_PATH_PREFIX_FORMAT, hostname);
    }
private static String buildMetricPathPrefix ( String configuredMetricPathPrefix ) { if ( configuredMetricPathPrefix != null ) { return configuredMetricPathPrefix ; } String hostname ; try { hostname = InetAddress . getLocalHost ( ) . getHostName ( ) . replaceAll ( "\\." , "_" ) ; } catch ( UnknownHostException e ) { hostname = "#unknown#" ; } return String . format ( DEFAULT_METRIC_PATH_PREFIX_FORMAT , hostname ) ; }
{@link java.net.InetAddress#getLocalHost()} may not be known at JVM startup when the process is launched as a Linux service.
{