Skip to content
This repository was archived by the owner on Mar 4, 2025. It is now read-only.

Commit 7fa9a93

Browse files
authored
Fix host metadata kernel information (#2104)
1 parent d2e3813 commit 7fa9a93

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

tracer/src/Datadog.Trace/PlatformHelpers/HostMetadata.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ private static void TryGetKernelInformation(out string kernel, out string kernel
114114
var fullVersion = File.ReadAllText("/proc/version");
115115

116116
ParseKernel(fullVersion, out kernel, out kernelRelease, out kernelVersion);
117+
return;
117118
}
118119
}
119120
catch

tracer/test/Datadog.Trace.Tests/PlatformHelpers/HostMetadataTests.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,17 @@ public void CanParseMalformedKernels(
5050
version.Should().Be(expectedVersion);
5151
}
5252

53+
[Fact]
54+
public void CanRetrieveKernelInfo()
55+
{
56+
if (FrameworkDescription.Instance.OSPlatform == OSPlatform.Linux)
57+
{
58+
HostMetadata.Instance.KernelName.Should().NotBeNullOrEmpty();
59+
HostMetadata.Instance.KernelRelease.Should().NotBeNullOrEmpty();
60+
HostMetadata.Instance.KernelVersion.Should().NotBeNullOrEmpty();
61+
}
62+
}
63+
5364
public static class TestData
5465
{
5566
/// <summary>

0 commit comments

Comments
 (0)