diff --git a/src/OpenTelemetry.Resources.Host/CHANGELOG.md b/src/OpenTelemetry.Resources.Host/CHANGELOG.md index a497691784..a07b292e58 100644 --- a/src/OpenTelemetry.Resources.Host/CHANGELOG.md +++ b/src/OpenTelemetry.Resources.Host/CHANGELOG.md @@ -2,6 +2,10 @@ ## Unreleased +* Drop support for .NET 6 as this target is no longer supported + and add .NET 8/.NET Standard 2.0 targets. + ([#2168](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/2168)) + ## 0.1.0-beta.3 Released 2024-Aug-30 diff --git a/src/OpenTelemetry.Resources.Host/HostDetector.cs b/src/OpenTelemetry.Resources.Host/HostDetector.cs index 83ff701f53..a52e527e5a 100644 --- a/src/OpenTelemetry.Resources.Host/HostDetector.cs +++ b/src/OpenTelemetry.Resources.Host/HostDetector.cs @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 using System.Diagnostics; -#if NET +#if !NETFRAMEWORK using System.Runtime.InteropServices; #endif using System.Text; @@ -18,7 +18,7 @@ internal sealed class HostDetector : IResourceDetector { private const string ETCMACHINEID = "/etc/machine-id"; private const string ETCVARDBUSMACHINEID = "/var/lib/dbus/machine-id"; -#if NET +#if !NETFRAMEWORK private readonly Func isOsPlatform; #endif private readonly Func> getFilePaths; @@ -30,7 +30,7 @@ internal sealed class HostDetector : IResourceDetector /// public HostDetector() : this( -#if NET +#if !NETFRAMEWORK RuntimeInformation.IsOSPlatform, #endif GetFilePaths, @@ -39,7 +39,7 @@ public HostDetector() { } -#if NET +#if !NETFRAMEWORK public HostDetector( Func> getFilePaths, Func getMacOsMachineId, @@ -54,21 +54,21 @@ public HostDetector( #endif internal HostDetector( -#if NET +#if !NETFRAMEWORK Func isOsPlatform, #endif Func> getFilePaths, Func getMacOsMachineId, Func getWindowsMachineId) { -#if NET +#if !NETFRAMEWORK Guard.ThrowIfNull(isOsPlatform); #endif Guard.ThrowIfNull(getFilePaths); Guard.ThrowIfNull(getMacOsMachineId); Guard.ThrowIfNull(getWindowsMachineId); -#if NET +#if !NETFRAMEWORK this.isOsPlatform = isOsPlatform; #endif this.getFilePaths = getFilePaths; @@ -117,10 +117,10 @@ public Resource Detect() foreach (var line in lines) { -#if NETFRAMEWORK - if (line.IndexOf("IOPlatformUUID", StringComparison.OrdinalIgnoreCase) >= 0) -#else +#if NET if (line.Contains("IOPlatformUUID", StringComparison.OrdinalIgnoreCase)) +#else + if (line.IndexOf("IOPlatformUUID", StringComparison.OrdinalIgnoreCase) >= 0) #endif { var parts = line.Split('"'); diff --git a/src/OpenTelemetry.Resources.Host/OpenTelemetry.Resources.Host.csproj b/src/OpenTelemetry.Resources.Host/OpenTelemetry.Resources.Host.csproj index becdd8962b..319966e6a3 100644 --- a/src/OpenTelemetry.Resources.Host/OpenTelemetry.Resources.Host.csproj +++ b/src/OpenTelemetry.Resources.Host/OpenTelemetry.Resources.Host.csproj @@ -1,24 +1,27 @@ + - net6.0 + net8.0;$(NetStandardMinimumSupportedVersion) $(TargetFrameworks);$(NetFrameworkMinimumSupportedVersion) - OpenTelemetry Extensions - Host Resource Detector. + OpenTelemetry Resource Detectors for Host. Resources.Host- - + true + + diff --git a/test/OpenTelemetry.Resources.Host.Tests/OpenTelemetry.Resources.Host.Tests.csproj b/test/OpenTelemetry.Resources.Host.Tests/OpenTelemetry.Resources.Host.Tests.csproj index 6675698cc8..257601185e 100644 --- a/test/OpenTelemetry.Resources.Host.Tests/OpenTelemetry.Resources.Host.Tests.csproj +++ b/test/OpenTelemetry.Resources.Host.Tests/OpenTelemetry.Resources.Host.Tests.csproj @@ -1,10 +1,10 @@ - Unit test project for Host Detector for OpenTelemetry - $(SupportedNetTargets) + $(SupportedNetTargetsWithoutNet6) $(TargetFrameworks);$(NetFrameworkMinimumSupportedVersion) + Unit test project for Host Detector for OpenTelemetry.