From 5e7c50d06d4764fb689e40aabdf2face48ff5e27 Mon Sep 17 00:00:00 2001
From: joegoldman2 <147369450+joegoldman2@users.noreply.github.com>
Date: Fri, 4 Oct 2024 10:56:24 +0000
Subject: [PATCH] [Resources.OperatingSystem] Replace .NET 6 target with .NET 8
and add .NET Standard 2.0 target (#2169)
---
.../CHANGELOG.md | 4 ++++
...Telemetry.Resources.OperatingSystem.csproj | 9 ++++----
.../OperatingSystemDetector.cs | 21 ++++++++++---------
...try.Resources.OperatingSystem.Tests.csproj | 4 ++--
4 files changed, 22 insertions(+), 16 deletions(-)
diff --git a/src/OpenTelemetry.Resources.OperatingSystem/CHANGELOG.md b/src/OpenTelemetry.Resources.OperatingSystem/CHANGELOG.md
index f9f0cdd59d..4775cc550e 100644
--- a/src/OpenTelemetry.Resources.OperatingSystem/CHANGELOG.md
+++ b/src/OpenTelemetry.Resources.OperatingSystem/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.
+ ([#2169](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/2169))
+
## 0.1.0-alpha.4
Released 2024-Sep-09
diff --git a/src/OpenTelemetry.Resources.OperatingSystem/OpenTelemetry.Resources.OperatingSystem.csproj b/src/OpenTelemetry.Resources.OperatingSystem/OpenTelemetry.Resources.OperatingSystem.csproj
index 95c55dec8b..63b085d0c5 100644
--- a/src/OpenTelemetry.Resources.OperatingSystem/OpenTelemetry.Resources.OperatingSystem.csproj
+++ b/src/OpenTelemetry.Resources.OperatingSystem/OpenTelemetry.Resources.OperatingSystem.csproj
@@ -2,20 +2,21 @@
- net6.0
+ net8.0;$(NetStandardMinimumSupportedVersion)
$(TargetFrameworks);$(NetFrameworkMinimumSupportedVersion)
- OpenTelemetry Extensions - Operating System Resource Detector for .NET
+ OpenTelemetry Resource Detectors for Operating System.
Resources.OperatingSystem-
-
+
true
+
diff --git a/src/OpenTelemetry.Resources.OperatingSystem/OperatingSystemDetector.cs b/src/OpenTelemetry.Resources.OperatingSystem/OperatingSystemDetector.cs
index f25ac54f06..1e018c25fd 100644
--- a/src/OpenTelemetry.Resources.OperatingSystem/OperatingSystemDetector.cs
+++ b/src/OpenTelemetry.Resources.OperatingSystem/OperatingSystemDetector.cs
@@ -1,11 +1,12 @@
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0
-#if NET
+#if !NETFRAMEWORK
using System.Runtime.InteropServices;
+#endif
+#if NET
using System.Xml.Linq;
#endif
-
using static OpenTelemetry.Resources.OperatingSystem.OperatingSystemSemanticConventions;
namespace OpenTelemetry.Resources.OperatingSystem;
@@ -18,16 +19,16 @@ internal sealed class OperatingSystemDetector : IResourceDetector
private const string RegistryKey = @"SOFTWARE\Microsoft\Windows NT\CurrentVersion";
private const string KernelOsRelease = "/proc/sys/kernel/osrelease";
private static readonly string[] DefaultEtcOsReleasePaths =
- [
- "/etc/os-release",
- "/usr/lib/os-release"
- ];
+ [
+ "/etc/os-release",
+ "/usr/lib/os-release"
+ ];
private static readonly string[] DefaultPlistFilePaths =
- [
- "/System/Library/CoreServices/SystemVersion.plist",
- "/System/Library/CoreServices/ServerVersion.plist"
- ];
+ [
+ "/System/Library/CoreServices/SystemVersion.plist",
+ "/System/Library/CoreServices/ServerVersion.plist"
+ ];
private readonly string? osType;
private readonly string? registryKey;
diff --git a/test/OpenTelemetry.Resources.OperatingSystem.Tests/OpenTelemetry.Resources.OperatingSystem.Tests.csproj b/test/OpenTelemetry.Resources.OperatingSystem.Tests/OpenTelemetry.Resources.OperatingSystem.Tests.csproj
index 2648338374..b31c404002 100644
--- a/test/OpenTelemetry.Resources.OperatingSystem.Tests/OpenTelemetry.Resources.OperatingSystem.Tests.csproj
+++ b/test/OpenTelemetry.Resources.OperatingSystem.Tests/OpenTelemetry.Resources.OperatingSystem.Tests.csproj
@@ -1,10 +1,10 @@
- Unit test project for Operating System Detector for OpenTelemetry
- $(SupportedNetTargets)
+ $(SupportedNetTargetsWithoutNet6)
$(TargetFrameworks);$(NetFrameworkMinimumSupportedVersion)
+ Unit test project for Operating System Detector for OpenTelemetry.