Commit bca40262 authored by Lemon's avatar Lemon Committed by 吴晟 Wu Sheng

Get more specific OS name (#54)

parent 405ccacc
......@@ -30,6 +30,7 @@ using SkyWalking.Context;
using SkyWalking.Dictionarys;
using SkyWalking.Logging;
using SkyWalking.NetworkProtocol;
using SkyWalking.Utils;
namespace SkyWalking.Remote
{
......@@ -121,7 +122,7 @@ namespace SkyWalking.Remote
var osInfo = new OSInfo
{
Hostname = hostName,
OsName = Environment.OSVersion.ToString(),
OsName = PlatformInformation.GetOSName(),
ProcessNo = Process.GetCurrentProcess().Id
};
......
using System.Runtime.InteropServices;
namespace SkyWalking.Utils
{
internal static class PlatformInformation
{
private const string OSX = "Mac OS X";
private const string LINUX = "Linux";
private const string WINDOWS = "Windows";
public static string GetOSName()
{
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
return WINDOWS;
}
if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
{
return LINUX;
}
if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
{
return OSX;
}
return "Unknow";
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment