From 39ac5514b2d2be5153fcb0cffb8d2d2dfefb61bc Mon Sep 17 00:00:00 2001
From: joegoldman2 <147369450+joegoldman@users.noreply.github.com>
Date: Fri, 4 Oct 2024 09:34:45 +0000
Subject: [PATCH 1/3] [Resources.Container] Replace .NET 6 target with .NET 8
and add .NET Standard 2.0 target
---
build/Common.props | 1 -
.../ContainerDetector.cs | 4 ++++
.../OpenTelemetry.Resources.Container.csproj | 10 ++++++----
.../OpenTelemetry.Resources.Container.Tests.csproj | 8 ++------
4 files changed, 12 insertions(+), 11 deletions(-)
diff --git a/build/Common.props b/build/Common.props
index 66bb0baca7..9a5fbde756 100644
--- a/build/Common.props
+++ b/build/Common.props
@@ -7,7 +7,6 @@
$(DefineConstants);SIGNED
true
net462
- net6.0
netstandard2.0
true
latest-all
diff --git a/src/OpenTelemetry.Resources.Container/ContainerDetector.cs b/src/OpenTelemetry.Resources.Container/ContainerDetector.cs
index 624fa5e0e6..fcb8a65a96 100644
--- a/src/OpenTelemetry.Resources.Container/ContainerDetector.cs
+++ b/src/OpenTelemetry.Resources.Container/ContainerDetector.cs
@@ -152,7 +152,11 @@ private static string RemovePrefixAndSuffixIfNeeded(string input, int startIndex
{
containerId = GetIdFromLineV1(line);
}
+#if NET
else if (cgroupVersion == ParseMode.V2 && line.Contains(Hostname, StringComparison.Ordinal))
+#else
+ else if (cgroupVersion == ParseMode.V2 && line.Contains(Hostname))
+#endif
{
containerId = GetIdFromLineV2(line);
}
diff --git a/src/OpenTelemetry.Resources.Container/OpenTelemetry.Resources.Container.csproj b/src/OpenTelemetry.Resources.Container/OpenTelemetry.Resources.Container.csproj
index befa4a2439..ad9bec76ea 100644
--- a/src/OpenTelemetry.Resources.Container/OpenTelemetry.Resources.Container.csproj
+++ b/src/OpenTelemetry.Resources.Container/OpenTelemetry.Resources.Container.csproj
@@ -1,13 +1,14 @@
+
- $(NetMinimumSupportedVersion)
- OpenTelemetry Extensions - Container Resource Detector from Container environment.
+ net8.0;$(NetStandardMinimumSupportedVersion)
+ OpenTelemetry Resource Detectors for Container environment.
Resources.Container-
-
+
true
@@ -20,4 +21,5 @@
+
diff --git a/test/OpenTelemetry.Resources.Container.Tests/OpenTelemetry.Resources.Container.Tests.csproj b/test/OpenTelemetry.Resources.Container.Tests/OpenTelemetry.Resources.Container.Tests.csproj
index 5edbf2dfe3..7af24366c8 100644
--- a/test/OpenTelemetry.Resources.Container.Tests/OpenTelemetry.Resources.Container.Tests.csproj
+++ b/test/OpenTelemetry.Resources.Container.Tests/OpenTelemetry.Resources.Container.Tests.csproj
@@ -1,17 +1,13 @@
- Unit test project for Container Detector for OpenTelemetry
- $(SupportedNetTargets)
+ $(SupportedNetTargetsWithoutNet6)
+ Unit test project for Container Detector for OpenTelemetry.
-
-
-
-
From 7a9810b4cd6e9a3ac4173709f079665d1140abce Mon Sep 17 00:00:00 2001
From: joegoldman2 <147369450+joegoldman@users.noreply.github.com>
Date: Fri, 4 Oct 2024 09:37:31 +0000
Subject: [PATCH 2/3] Add changelog entry
---
src/OpenTelemetry.Resources.Container/CHANGELOG.md | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/OpenTelemetry.Resources.Container/CHANGELOG.md b/src/OpenTelemetry.Resources.Container/CHANGELOG.md
index c7a5c6be52..85c7614e00 100644
--- a/src/OpenTelemetry.Resources.Container/CHANGELOG.md
+++ b/src/OpenTelemetry.Resources.Container/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.
+ ([#2166](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/2166))
+
## 1.0.0-beta.9
Released 2024-Jun-18
From f3de11d25f737dcc56ed8f6573bd320e52a7b848 Mon Sep 17 00:00:00 2001
From: joegoldman2 <147369450+joegoldman@users.noreply.github.com>
Date: Fri, 4 Oct 2024 09:38:18 +0000
Subject: [PATCH 3/3] Remove trailing spaces
---
src/OpenTelemetry.Resources.Container/ContainerDetector.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/OpenTelemetry.Resources.Container/ContainerDetector.cs b/src/OpenTelemetry.Resources.Container/ContainerDetector.cs
index fcb8a65a96..8b00d6776a 100644
--- a/src/OpenTelemetry.Resources.Container/ContainerDetector.cs
+++ b/src/OpenTelemetry.Resources.Container/ContainerDetector.cs
@@ -156,7 +156,7 @@ private static string RemovePrefixAndSuffixIfNeeded(string input, int startIndex
else if (cgroupVersion == ParseMode.V2 && line.Contains(Hostname, StringComparison.Ordinal))
#else
else if (cgroupVersion == ParseMode.V2 && line.Contains(Hostname))
-#endif
+#endif
{
containerId = GetIdFromLineV2(line);
}