Skip to content

Commit 163c57f

Browse files
authored
Merge pull request #1274 from microsoft/trask/fix-perf-issue
Fix perf issue resolving FQDN for localhost
2 parents 34f9a8e + d44b06f commit 163c57f

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)