Skip to content

Commit d44b06f

Browse files
committed
Fix perf issue resolving FQDN
1 parent 34f9a8e commit d44b06f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

core/src/main/java/com/microsoft/applicationinsights/common/CommonUtils.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,15 @@ public static boolean isNullOrEmpty(String string) {
3333
}
3434

3535
/**
36-
* Returns the hostname using {@link InetAddress#getCanonicalHostName()} on {@link InetAddress#getLocalHost()}.
36+
* Returns the hostname using {@link InetAddress#getHostName()} on {@link InetAddress#getLocalHost()}.
3737
* If an error is encountered, the error is logged and it returns null.
3838
*
3939
* @return the local hostname, or null
4040
*/
4141
public static String getHostName() {
4242
try {
4343
InetAddress addr = InetAddress.getLocalHost();
44-
return addr.getCanonicalHostName();
44+
return addr.getHostName();
4545
} catch (UnknownHostException ex) {
4646
InternalLogger.INSTANCE.warn("Error resolving hostname:%n%s", ExceptionUtils.getStackTrace(ex));
4747
return null;

0 commit comments

Comments
 (0)