From 794eb4831f24ba182e99796a9d2966694f23124e Mon Sep 17 00:00:00 2001
From: joegoldman2 <147369450+joegoldman2@users.noreply.github.com>
Date: Mon, 30 Sep 2024 17:35:16 +0000
Subject: [PATCH 1/4] [Exporter.Geneva] Remove .NET 6 target (#2117)
Co-authored-by: joegoldman2 <147369450+joegoldman@users.noreply.github.com>
---
.../CHANGELOG.md | 3 +++
.../CompatibilitySuppressions.xml | 19 +++++++++++++++++++
.../Internal/MsgPack/MsgPackExporter.cs | 4 ++--
.../Internal/MsgPack/MsgPackLogExporter.cs | 8 ++++----
.../Internal/MsgPack/MsgPackTraceExporter.cs | 10 +++++-----
.../Internal/Tld/UncheckedASCIIEncoding.cs | 4 ++--
.../Metrics/GenevaMetricExporter.cs | 2 +-
.../OpenTelemetry.Exporter.Geneva.csproj | 9 ++++-----
...penTelemetry.Exporter.Geneva.Stress.csproj | 6 +++---
...OpenTelemetry.Exporter.Geneva.Tests.csproj | 7 ++++---
10 files changed, 47 insertions(+), 25 deletions(-)
create mode 100644 src/OpenTelemetry.Exporter.Geneva/CompatibilitySuppressions.xml
diff --git a/src/OpenTelemetry.Exporter.Geneva/CHANGELOG.md b/src/OpenTelemetry.Exporter.Geneva/CHANGELOG.md
index 631613a201..47b1b1f495 100644
--- a/src/OpenTelemetry.Exporter.Geneva/CHANGELOG.md
+++ b/src/OpenTelemetry.Exporter.Geneva/CHANGELOG.md
@@ -2,6 +2,9 @@
## Unreleased
+* Drop support for .NET 6 as this target is no longer supported.
+ ([#2117](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/2117))
+
## 1.9.0
Released 2024-Jun-21
diff --git a/src/OpenTelemetry.Exporter.Geneva/CompatibilitySuppressions.xml b/src/OpenTelemetry.Exporter.Geneva/CompatibilitySuppressions.xml
new file mode 100644
index 0000000000..61ae99654f
--- /dev/null
+++ b/src/OpenTelemetry.Exporter.Geneva/CompatibilitySuppressions.xml
@@ -0,0 +1,19 @@
+
+
+
+
+ CP0008
+ T:OpenTelemetry.Exporter.Geneva.EventNameExportMode
+ lib/net6.0/OpenTelemetry.Exporter.Geneva.dll
+ lib/netstandard2.0/OpenTelemetry.Exporter.Geneva.dll
+ true
+
+
+ CP0008
+ T:OpenTelemetry.Exporter.Geneva.ExceptionStackExportMode
+ lib/net6.0/OpenTelemetry.Exporter.Geneva.dll
+ lib/netstandard2.0/OpenTelemetry.Exporter.Geneva.dll
+ true
+
+
diff --git a/src/OpenTelemetry.Exporter.Geneva/Internal/MsgPack/MsgPackExporter.cs b/src/OpenTelemetry.Exporter.Geneva/Internal/MsgPack/MsgPackExporter.cs
index c37581d5e3..3d7bb7def1 100644
--- a/src/OpenTelemetry.Exporter.Geneva/Internal/MsgPack/MsgPackExporter.cs
+++ b/src/OpenTelemetry.Exporter.Geneva/Internal/MsgPack/MsgPackExporter.cs
@@ -3,7 +3,7 @@
#nullable enable
-#if NET8_0_OR_GREATER
+#if NET
using System.Collections.Frozen;
#endif
@@ -33,7 +33,7 @@ internal abstract class MsgPackExporter
[Schema.V40.PartA.Extensions.Os.Ver] = "env_os_ver",
};
-#if NET8_0_OR_GREATER
+#if NET
internal static readonly IReadOnlyDictionary V40_PART_A_MAPPING = PART_A_MAPPING_DICTIONARY.ToFrozenDictionary();
#else
internal static readonly IReadOnlyDictionary V40_PART_A_MAPPING = PART_A_MAPPING_DICTIONARY;
diff --git a/src/OpenTelemetry.Exporter.Geneva/Internal/MsgPack/MsgPackLogExporter.cs b/src/OpenTelemetry.Exporter.Geneva/Internal/MsgPack/MsgPackLogExporter.cs
index 6e00b6a723..4371d7d373 100644
--- a/src/OpenTelemetry.Exporter.Geneva/Internal/MsgPack/MsgPackLogExporter.cs
+++ b/src/OpenTelemetry.Exporter.Geneva/Internal/MsgPack/MsgPackLogExporter.cs
@@ -3,7 +3,7 @@
#nullable enable
-#if NET8_0_OR_GREATER
+#if NET
using System.Collections.Frozen;
#endif
using System.Diagnostics;
@@ -33,7 +33,7 @@ internal sealed class MsgPackLogExporter : MsgPackExporter, IDisposable
private readonly bool shouldExportEventName;
private readonly TableNameSerializer tableNameSerializer;
-#if NET8_0_OR_GREATER
+#if NET
private readonly FrozenSet? customFields;
private readonly FrozenDictionary? prepopulatedFields;
#else
@@ -94,7 +94,7 @@ public MsgPackLogExporter(GenevaExporterOptions options)
this.prepopulatedFieldKeys.Add(kv.Key);
}
-#if NET8_0_OR_GREATER
+#if NET
this.prepopulatedFields = tempPrepopulatedFields.ToFrozenDictionary(StringComparer.Ordinal);
#else
this.prepopulatedFields = tempPrepopulatedFields;
@@ -110,7 +110,7 @@ public MsgPackLogExporter(GenevaExporterOptions options)
customFields.Add(name);
}
-#if NET8_0_OR_GREATER
+#if NET
this.customFields = customFields.ToFrozenSet(StringComparer.Ordinal);
#else
this.customFields = customFields;
diff --git a/src/OpenTelemetry.Exporter.Geneva/Internal/MsgPack/MsgPackTraceExporter.cs b/src/OpenTelemetry.Exporter.Geneva/Internal/MsgPack/MsgPackTraceExporter.cs
index 2778de0bfd..9c0d15beef 100644
--- a/src/OpenTelemetry.Exporter.Geneva/Internal/MsgPack/MsgPackTraceExporter.cs
+++ b/src/OpenTelemetry.Exporter.Geneva/Internal/MsgPack/MsgPackTraceExporter.cs
@@ -3,7 +3,7 @@
#nullable enable
-#if NET8_0_OR_GREATER
+#if NET
using System.Collections.Frozen;
#endif
using System.Diagnostics;
@@ -34,7 +34,7 @@ internal sealed class MsgPackTraceExporter : MsgPackExporter, IDisposable
["messaging.url"] = "messagingUrl",
};
-#if NET8_0_OR_GREATER
+#if NET
internal static readonly FrozenDictionary CS40_PART_B_MAPPING = CS40_PART_B_MAPPING_DICTIONARY.ToFrozenDictionary();
#else
internal static readonly Dictionary CS40_PART_B_MAPPING = CS40_PART_B_MAPPING_DICTIONARY;
@@ -42,7 +42,7 @@ internal sealed class MsgPackTraceExporter : MsgPackExporter, IDisposable
internal readonly ThreadLocal Buffer = new();
-#if NET8_0_OR_GREATER
+#if NET
internal readonly FrozenSet? CustomFields;
internal readonly FrozenSet? DedicatedFields;
@@ -123,7 +123,7 @@ public MsgPackTraceExporter(GenevaExporterOptions options)
dedicatedFields.Add(name);
}
-#if NET8_0_OR_GREATER
+#if NET
this.CustomFields = customFields.ToFrozenSet(StringComparer.Ordinal);
#else
this.CustomFields = customFields;
@@ -137,7 +137,7 @@ public MsgPackTraceExporter(GenevaExporterOptions options)
dedicatedFields.Add("otel.status_code");
dedicatedFields.Add("otel.status_description");
-#if NET8_0_OR_GREATER
+#if NET
this.DedicatedFields = dedicatedFields.ToFrozenSet(StringComparer.Ordinal);
#else
this.DedicatedFields = dedicatedFields;
diff --git a/src/OpenTelemetry.Exporter.Geneva/Internal/Tld/UncheckedASCIIEncoding.cs b/src/OpenTelemetry.Exporter.Geneva/Internal/Tld/UncheckedASCIIEncoding.cs
index aed31bd1b1..04085f22c2 100644
--- a/src/OpenTelemetry.Exporter.Geneva/Internal/Tld/UncheckedASCIIEncoding.cs
+++ b/src/OpenTelemetry.Exporter.Geneva/Internal/Tld/UncheckedASCIIEncoding.cs
@@ -83,7 +83,7 @@ public unsafe override int GetChars(byte[] bytes, int byteIndex, int byteCount,
public override unsafe int GetBytes(char* charPtr, int charCount, byte* bytePtr, int byteCount)
{
-#if NET8_0_OR_GREATER
+#if NET
ArgumentOutOfRangeException.ThrowIfLessThan(byteCount, charCount);
#else
if (byteCount < charCount)
@@ -102,7 +102,7 @@ public override unsafe int GetBytes(char* charPtr, int charCount, byte* bytePtr,
public override unsafe int GetChars(byte* bytePtr, int byteCount, char* charPtr, int charCount)
{
-#if NET8_0_OR_GREATER
+#if NET
ArgumentOutOfRangeException.ThrowIfLessThan(charCount, byteCount);
#else
if (charCount < byteCount)
diff --git a/src/OpenTelemetry.Exporter.Geneva/Metrics/GenevaMetricExporter.cs b/src/OpenTelemetry.Exporter.Geneva/Metrics/GenevaMetricExporter.cs
index 253fbd9a63..ade4ff8593 100644
--- a/src/OpenTelemetry.Exporter.Geneva/Metrics/GenevaMetricExporter.cs
+++ b/src/OpenTelemetry.Exporter.Geneva/Metrics/GenevaMetricExporter.cs
@@ -116,7 +116,7 @@ protected override void Dispose(bool disposing)
base.Dispose(disposing);
}
-#if NET8_0_OR_GREATER
+#if NET
[GeneratedRegex(DisableRegexPattern)]
private static partial Regex GetDisableRegexPattern();
#else
diff --git a/src/OpenTelemetry.Exporter.Geneva/OpenTelemetry.Exporter.Geneva.csproj b/src/OpenTelemetry.Exporter.Geneva/OpenTelemetry.Exporter.Geneva.csproj
index ca6ebaf6dc..bc27891120 100644
--- a/src/OpenTelemetry.Exporter.Geneva/OpenTelemetry.Exporter.Geneva.csproj
+++ b/src/OpenTelemetry.Exporter.Geneva/OpenTelemetry.Exporter.Geneva.csproj
@@ -3,14 +3,13 @@
+
+ net8.0;$(NetStandardMinimumSupportedVersion)
+ $(TargetFrameworks);net462
true
- An OpenTelemetry .NET exporter that exports to local ETW or UDS
- OpenTelemetry Authors
+ An OpenTelemetry .NET exporter that exports to local ETW or UDS.
$(NoWarn);SA1123;SA1310
-
- net8.0;net6.0;netstandard2.0
- $(TargetFrameworks);net462
Exporter.Geneva-
1.9.0
disable
diff --git a/test/OpenTelemetry.Exporter.Geneva.Stress/OpenTelemetry.Exporter.Geneva.Stress.csproj b/test/OpenTelemetry.Exporter.Geneva.Stress/OpenTelemetry.Exporter.Geneva.Stress.csproj
index 00273f8729..a9cd3cffcf 100644
--- a/test/OpenTelemetry.Exporter.Geneva.Stress/OpenTelemetry.Exporter.Geneva.Stress.csproj
+++ b/test/OpenTelemetry.Exporter.Geneva.Stress/OpenTelemetry.Exporter.Geneva.Stress.csproj
@@ -1,11 +1,11 @@
- Exe
- $(SupportedNetTargets)
+ net8.0
$(TargetFrameworks);net48;net472;net471;net47;net462
- $(NoWarn),SA1308,SA1201
+ Exe
+ $(NoWarn);SA1308;SA1201
disable
diff --git a/test/OpenTelemetry.Exporter.Geneva.Tests/OpenTelemetry.Exporter.Geneva.Tests.csproj b/test/OpenTelemetry.Exporter.Geneva.Tests/OpenTelemetry.Exporter.Geneva.Tests.csproj
index 040ef19fa6..8f3e724c44 100644
--- a/test/OpenTelemetry.Exporter.Geneva.Tests/OpenTelemetry.Exporter.Geneva.Tests.csproj
+++ b/test/OpenTelemetry.Exporter.Geneva.Tests/OpenTelemetry.Exporter.Geneva.Tests.csproj
@@ -1,12 +1,13 @@
+
- Unit test project for Geneva Exporters for OpenTelemetry
- $(SupportedNetTargets)
+ net8.0
$(TargetFrameworks);net48;net472;net471;net47;net462
- $(NoWarn),SA1311,SA1312,SA1313,SA1123,SA1202,OTEL1002
+ Unit test project for Geneva Exporters for OpenTelemetry.
+ $(NoWarn);SA1311;SA1312;SA1313;SA1123;SA1202;OTEL1002
disable
From 5559a6c8836f5f1bb7450af10ec61e0893f1347d Mon Sep 17 00:00:00 2001
From: Mikel Blanchard
Date: Mon, 30 Sep 2024 10:54:00 -0700
Subject: [PATCH 2/4] [geneva] Rename metric transports (#2119)
---
.../Metrics/OtlpProtobuf/OtlpProtobufMetricExporter.cs | 2 +-
.../Metrics/TlvMetricExporter.cs | 6 +++---
...aTransport.cs => MetricUnixDomainSocketDataTransport.cs} | 4 ++--
...ansport.cs => MetricWindowsEventTracingDataTransport.cs} | 6 +++---
.../GenevaMetricExporterTests.cs | 6 +++---
5 files changed, 12 insertions(+), 12 deletions(-)
rename src/OpenTelemetry.Exporter.Geneva/Metrics/Transport/{MetricUnixDataTransport.cs => MetricUnixDomainSocketDataTransport.cs} (89%)
rename src/OpenTelemetry.Exporter.Geneva/Metrics/Transport/{MetricEtwDataTransport.cs => MetricWindowsEventTracingDataTransport.cs} (92%)
diff --git a/src/OpenTelemetry.Exporter.Geneva/Metrics/OtlpProtobuf/OtlpProtobufMetricExporter.cs b/src/OpenTelemetry.Exporter.Geneva/Metrics/OtlpProtobuf/OtlpProtobufMetricExporter.cs
index b5836f3d99..a6bdffad6c 100644
--- a/src/OpenTelemetry.Exporter.Geneva/Metrics/OtlpProtobuf/OtlpProtobufMetricExporter.cs
+++ b/src/OpenTelemetry.Exporter.Geneva/Metrics/OtlpProtobuf/OtlpProtobufMetricExporter.cs
@@ -25,7 +25,7 @@ public OtlpProtobufMetricExporter(Func getResource, ConnectionStringBu
this.getResource = getResource;
- this.otlpProtobufSerializer = new OtlpProtobufSerializer(MetricEtwDataTransport.Instance, connectionStringBuilder, prepopulatedMetricDimensions);
+ this.otlpProtobufSerializer = new OtlpProtobufSerializer(MetricWindowsEventTracingDataTransport.Instance, connectionStringBuilder, prepopulatedMetricDimensions);
}
public ExportResult Export(in Batch batch)
diff --git a/src/OpenTelemetry.Exporter.Geneva/Metrics/TlvMetricExporter.cs b/src/OpenTelemetry.Exporter.Geneva/Metrics/TlvMetricExporter.cs
index 9ac707ab44..78fcd1cce8 100644
--- a/src/OpenTelemetry.Exporter.Geneva/Metrics/TlvMetricExporter.cs
+++ b/src/OpenTelemetry.Exporter.Geneva/Metrics/TlvMetricExporter.cs
@@ -43,12 +43,12 @@ internal TlvMetricExporter(ConnectionStringBuilder connectionStringBuilder, IRea
}
var unixDomainSocketPath = connectionStringBuilder.ParseUnixDomainSocketPath();
- this.metricDataTransport = new MetricUnixDataTransport(unixDomainSocketPath);
+ this.metricDataTransport = new MetricUnixDomainSocketDataTransport(unixDomainSocketPath);
break;
case TransportProtocol.Unspecified:
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
- this.metricDataTransport = MetricEtwDataTransport.Instance;
+ this.metricDataTransport = MetricWindowsEventTracingDataTransport.Instance;
break;
}
else
@@ -77,7 +77,7 @@ public void Dispose()
{
// The ETW data transport singleton on Windows should NOT be disposed.
// On Linux, Unix Domain Socket is used and should be disposed.
- if (this.metricDataTransport != MetricEtwDataTransport.Instance)
+ if (this.metricDataTransport != MetricWindowsEventTracingDataTransport.Instance)
{
this.metricDataTransport.Dispose();
}
diff --git a/src/OpenTelemetry.Exporter.Geneva/Metrics/Transport/MetricUnixDataTransport.cs b/src/OpenTelemetry.Exporter.Geneva/Metrics/Transport/MetricUnixDomainSocketDataTransport.cs
similarity index 89%
rename from src/OpenTelemetry.Exporter.Geneva/Metrics/Transport/MetricUnixDataTransport.cs
rename to src/OpenTelemetry.Exporter.Geneva/Metrics/Transport/MetricUnixDomainSocketDataTransport.cs
index c30fa6e401..4faa04560f 100644
--- a/src/OpenTelemetry.Exporter.Geneva/Metrics/Transport/MetricUnixDataTransport.cs
+++ b/src/OpenTelemetry.Exporter.Geneva/Metrics/Transport/MetricUnixDomainSocketDataTransport.cs
@@ -5,13 +5,13 @@
namespace OpenTelemetry.Exporter.Geneva;
-internal sealed class MetricUnixDataTransport : IMetricDataTransport
+internal sealed class MetricUnixDomainSocketDataTransport : IMetricDataTransport
{
private readonly int fixedPayloadLength;
private readonly UnixDomainSocketDataTransport udsDataTransport;
private bool isDisposed;
- public MetricUnixDataTransport(
+ public MetricUnixDomainSocketDataTransport(
string unixDomainSocketPath,
int timeoutMilliseconds = UnixDomainSocketDataTransport.DefaultTimeoutMilliseconds)
{
diff --git a/src/OpenTelemetry.Exporter.Geneva/Metrics/Transport/MetricEtwDataTransport.cs b/src/OpenTelemetry.Exporter.Geneva/Metrics/Transport/MetricWindowsEventTracingDataTransport.cs
similarity index 92%
rename from src/OpenTelemetry.Exporter.Geneva/Metrics/Transport/MetricEtwDataTransport.cs
rename to src/OpenTelemetry.Exporter.Geneva/Metrics/Transport/MetricWindowsEventTracingDataTransport.cs
index 3b3088a9a8..becbcf7ead 100644
--- a/src/OpenTelemetry.Exporter.Geneva/Metrics/Transport/MetricEtwDataTransport.cs
+++ b/src/OpenTelemetry.Exporter.Geneva/Metrics/Transport/MetricWindowsEventTracingDataTransport.cs
@@ -9,13 +9,13 @@
namespace OpenTelemetry.Exporter.Geneva;
[EventSource(Name = "OpenTelemetryGenevaMetricExporter", Guid = "{edc24920-e004-40f6-a8e1-0e6e48f39d84}")]
-internal sealed class MetricEtwDataTransport : EventSource, IMetricDataTransport
+internal sealed class MetricWindowsEventTracingDataTransport : EventSource, IMetricDataTransport
{
private const int OtlpProtobufMetricEventId = 81;
private readonly int fixedPayloadEndIndex;
private bool isDisposed;
- private MetricEtwDataTransport()
+ private MetricWindowsEventTracingDataTransport()
{
unsafe
{
@@ -23,7 +23,7 @@ private MetricEtwDataTransport()
}
}
- public static MetricEtwDataTransport Instance { get; private set; } = new();
+ public static MetricWindowsEventTracingDataTransport Instance { get; private set; } = new();
[NonEvent]
#if NET
diff --git a/test/OpenTelemetry.Exporter.Geneva.Tests/GenevaMetricExporterTests.cs b/test/OpenTelemetry.Exporter.Geneva.Tests/GenevaMetricExporterTests.cs
index aaf386a50c..98ae138cb7 100644
--- a/test/OpenTelemetry.Exporter.Geneva.Tests/GenevaMetricExporterTests.cs
+++ b/test/OpenTelemetry.Exporter.Geneva.Tests/GenevaMetricExporterTests.cs
@@ -249,11 +249,11 @@ public void MultipleCallsOnWindowsReusesSingletonEtwDataTransport()
{
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
- var singleton = MetricEtwDataTransport.Instance;
+ var singleton = MetricWindowsEventTracingDataTransport.Instance;
this.EmitMetrics("one");
- Assert.Equal(singleton, MetricEtwDataTransport.Instance);
+ Assert.Equal(singleton, MetricWindowsEventTracingDataTransport.Instance);
this.EmitMetrics("two");
- Assert.Equal(singleton, MetricEtwDataTransport.Instance);
+ Assert.Equal(singleton, MetricWindowsEventTracingDataTransport.Instance);
}
}
From 6026a05cf6e1198b94dfa2f92d852882b6fc94b7 Mon Sep 17 00:00:00 2001
From: joegoldman2 <147369450+joegoldman2@users.noreply.github.com>
Date: Mon, 30 Sep 2024 18:03:57 +0000
Subject: [PATCH 3/4] [Exporter.InfluxDB] Replace .NET 6 target with .NET 8
(#2116)
Co-authored-by: joegoldman2 <147369450+joegoldman@users.noreply.github.com>
Co-authored-by: Mikel Blanchard
---
src/OpenTelemetry.Exporter.InfluxDB/CHANGELOG.md | 3 +++
.../OpenTelemetry.Exporter.InfluxDB.csproj | 11 +++++------
.../OpenTelemetry.Exporter.InfluxDB.Tests.csproj | 4 ++--
3 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/src/OpenTelemetry.Exporter.InfluxDB/CHANGELOG.md b/src/OpenTelemetry.Exporter.InfluxDB/CHANGELOG.md
index 271706b380..aba0951e9c 100644
--- a/src/OpenTelemetry.Exporter.InfluxDB/CHANGELOG.md
+++ b/src/OpenTelemetry.Exporter.InfluxDB/CHANGELOG.md
@@ -10,6 +10,9 @@
in transitive dependencies.
([#2073](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/2073))
+* Drop support for .NET 6 as this target is no longer supported and add .NET 8 target.
+ ([#2116](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/2116))
+
## 1.0.0-alpha.3
Released 2023-Oct-13
diff --git a/src/OpenTelemetry.Exporter.InfluxDB/OpenTelemetry.Exporter.InfluxDB.csproj b/src/OpenTelemetry.Exporter.InfluxDB/OpenTelemetry.Exporter.InfluxDB.csproj
index 9da39c289a..5d6c507da1 100644
--- a/src/OpenTelemetry.Exporter.InfluxDB/OpenTelemetry.Exporter.InfluxDB.csproj
+++ b/src/OpenTelemetry.Exporter.InfluxDB/OpenTelemetry.Exporter.InfluxDB.csproj
@@ -1,16 +1,15 @@
- true
- An OpenTelemetry .NET exporter that exports to InfluxDB
- OpenTelemetry Authors
- $(NetMinimumSupportedVersion);$(NetStandardMinimumSupportedVersion)
+ net8.0;$(NetStandardMinimumSupportedVersion)
+ true
+ An OpenTelemetry .NET exporter that exports to InfluxDB.
Exporter.InfluxDB-
-
+
true
diff --git a/test/OpenTelemetry.Exporter.InfluxDB.Tests/OpenTelemetry.Exporter.InfluxDB.Tests.csproj b/test/OpenTelemetry.Exporter.InfluxDB.Tests/OpenTelemetry.Exporter.InfluxDB.Tests.csproj
index 155dd334f7..8c24d8c21e 100644
--- a/test/OpenTelemetry.Exporter.InfluxDB.Tests/OpenTelemetry.Exporter.InfluxDB.Tests.csproj
+++ b/test/OpenTelemetry.Exporter.InfluxDB.Tests/OpenTelemetry.Exporter.InfluxDB.Tests.csproj
@@ -1,10 +1,10 @@
- Unit test project for InfluxDB Exporter for OpenTelemetry.
- $(NetMinimumSupportedVersion)
+ net8.0
$(TargetFrameworks);net48;net472;net471;net47;net462
+ Unit test project for InfluxDB Exporter for OpenTelemetry.
From 1bdbf965fe13e1ace0d85331821b177f79e23705 Mon Sep 17 00:00:00 2001
From: Mikel Blanchard
Date: Mon, 30 Sep 2024 11:38:14 -0700
Subject: [PATCH 4/4] [repo] Tag component owners on issues (#2115)
---
.github/ISSUE_TEMPLATE/bug_report.yml | 1 +
.github/ISSUE_TEMPLATE/feature_request.yml | 1 +
.github/workflows/add-labels.yml | 1 +
build/scripts/add-labels.psm1 | 34 ++++++++++++-
build/scripts/build.psm1 | 59 ++++++++++++++++++++++
build/scripts/prepare-release.psm1 | 48 +++---------------
6 files changed, 102 insertions(+), 42 deletions(-)
diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml
index 849c72d016..c87b9935e8 100644
--- a/.github/ISSUE_TEMPLATE/bug_report.yml
+++ b/.github/ISSUE_TEMPLATE/bug_report.yml
@@ -1,4 +1,5 @@
name: Bug report
+title: "[bug] "
description: Create a report to help us improve
labels: ["bug"]
body:
diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml
index 0c0b930633..0443264723 100644
--- a/.github/ISSUE_TEMPLATE/feature_request.yml
+++ b/.github/ISSUE_TEMPLATE/feature_request.yml
@@ -1,4 +1,5 @@
name: Feature request
+title: "[feature request] "
description: Suggest an idea for this project
labels: ["enhancement"]
body:
diff --git a/.github/workflows/add-labels.yml b/.github/workflows/add-labels.yml
index 23137c1aa8..3ba9ad161c 100644
--- a/.github/workflows/add-labels.yml
+++ b/.github/workflows/add-labels.yml
@@ -27,6 +27,7 @@ jobs:
AddLabelsOnIssuesForComponentFoundInBody `
-issueNumber ${{ github.event.issue.number }} `
+ -issueLabels '${{ join(github.event.issue.labels.*.name, ', ') }}' `
-issueBody $env:ISSUE_BODY
env:
GH_TOKEN: ${{ github.token }}
diff --git a/build/scripts/add-labels.psm1 b/build/scripts/add-labels.psm1
index 39da844873..f219bcf09d 100644
--- a/build/scripts/add-labels.psm1
+++ b/build/scripts/add-labels.psm1
@@ -1,6 +1,9 @@
+Import-Module $PSScriptRoot\build.psm1
+
function AddLabelsOnIssuesForComponentFoundInBody {
param(
[Parameter(Mandatory=$true)][int]$issueNumber,
+ [Parameter(Mandatory=$true)][string]$issueLabels,
[Parameter(Mandatory=$true)][string]$issueBody
)
@@ -10,7 +13,36 @@ function AddLabelsOnIssuesForComponentFoundInBody {
Return
}
- gh issue edit $issueNumber --add-label $("comp:" + $match.Groups[1].Value.ToLower())
+ $component = $match.Groups[1].Value.Trim()
+
+ gh issue edit $issueNumber --add-label $("comp:" + $component.ToLower())
+
+ if ($issueLabels.Contains('bug') -or $issueLabels.Contains('enhancement'))
+ {
+ $componentOwners = $null
+
+ FindComponentOwners `
+ -component "OpenTelemetry.$component" `
+ -componentOwners ([ref]$componentOwners)
+
+ if ($componentOwners.Count -gt 0)
+ {
+ $componentOwnerApprovers = ''
+ foreach ($componentOwner in $componentOwners)
+ {
+ $componentOwnerApprovers += "@$componentOwner "
+ }
+
+ $body =
+@"
+Tagging component owner(s).
+
+$componentOwnerApprovers
+"@
+
+ gh issue comment $issueNumber --body $body
+ }
+ }
}
Export-ModuleMember -Function AddLabelsOnIssuesForComponentFoundInBody
diff --git a/build/scripts/build.psm1 b/build/scripts/build.psm1
index 619fc8be17..9b7d560b60 100644
--- a/build/scripts/build.psm1
+++ b/build/scripts/build.psm1
@@ -80,3 +80,62 @@ function ResolveProject {
}
Export-ModuleMember -Function ResolveProject
+
+function FindComponentOwners {
+ param(
+ [Parameter(Mandatory=$true)][string]$component,
+ [Parameter()][string]$issueNumber,
+ [Parameter()][ref]$componentOwners
+ )
+
+ $projectPath = "src/$component/$component.csproj"
+
+ if ((Test-Path -Path $projectPath) -eq $false)
+ {
+ if ([string]::IsNullOrEmpty($issueNumber) -eq $false)
+ {
+ gh issue comment $issueNumber `
+ --body "I couldn't find the project file for the requested component. Please create a new release request and select a valid component or edit the description and set a valid component."
+ }
+ Return
+ }
+
+ $projectContent = Get-Content -Path $projectPath
+
+ $match = [regex]::Match($projectContent, '(.*)<\/MinVerTagPrefix>')
+ if ($match.Success -eq $false)
+ {
+ if ([string]::IsNullOrEmpty($issueNumber) -eq $false)
+ {
+ gh issue comment $issueNumber `
+ --body "I couldn't find ``MinVerTagPrefix`` in the project file for the requested component. Please create a new release request and select a valid component or edit the description and set a valid component."
+ }
+ Return
+ }
+
+ $minVerTagPrefix = $match.Groups[1].Value
+
+ $projectDirs = Get-ChildItem -Path src/**/*.csproj | Select-String "$minVerTagPrefix" -List | Select Path | Split-Path -Parent
+
+ $componentOwnersContent = Get-Content '.github/component_owners.yml' -Raw
+
+ $componentOwners.Value = [System.Collections.Generic.HashSet[string]]::new([System.StringComparer]::OrdinalIgnoreCase)
+
+ foreach ($projectDir in $projectDirs)
+ {
+ $projectName = [System.IO.Path]::GetFileName($projectDir)
+
+ $match = [regex]::Match($componentOwnersContent, "src\/$projectName\/:([\w\W\s]*?)src")
+ if ($match.Success -eq $true)
+ {
+ $matches = [regex]::Matches($match.Groups[1].Value, "-\s*(.*)")
+ foreach ($match in $matches)
+ {
+ $owner = $match.Groups[1].Value
+ $_ = $componentOwners.Value.Add($owner.Trim())
+ }
+ }
+ }
+}
+
+Export-ModuleMember -Function FindComponentOwners
diff --git a/build/scripts/prepare-release.psm1 b/build/scripts/prepare-release.psm1
index 4ddde60b83..50b0f45cca 100644
--- a/build/scripts/prepare-release.psm1
+++ b/build/scripts/prepare-release.psm1
@@ -1,3 +1,5 @@
+Import-Module $PSScriptRoot\build.psm1
+
function CreatePullRequestToUpdateChangelogsAndPublicApis {
param(
[Parameter(Mandatory=$true)][string]$gitRepository,
@@ -354,48 +356,12 @@ function TagCodeOwnersOnOrRunWorkflowForRequestReleaseIssue {
Return
}
- $projectPath = "src/$component/$component.csproj"
-
- if ((Test-Path -Path $projectPath) -eq $false)
- {
- gh issue comment $issueNumber `
- --body "I couldn't find the project file for the requested component. Please create a new release request and select a valid component or edit the description and set a valid component."
- Return
- }
-
- $projectContent = Get-Content -Path $projectPath
-
- $match = [regex]::Match($projectContent, '(.*)<\/MinVerTagPrefix>')
- if ($match.Success -eq $false)
- {
- gh issue comment $issueNumber `
- --body "I couldn't find ``MinVerTagPrefix`` in the project file for the requested component. Please create a new release request and select a valid component or edit the description and set a valid component."
- Return
- }
-
- $minVerTagPrefix = $match.Groups[1].Value
-
- $projectDirs = Get-ChildItem -Path src/**/*.csproj | Select-String "$minVerTagPrefix" -List | Select Path | Split-Path -Parent
-
- $componentOwnersContent = Get-Content '.github/component_owners.yml' -Raw
-
- $componentOwners = [System.Collections.Generic.HashSet[string]]::new([System.StringComparer]::OrdinalIgnoreCase)
-
- foreach ($projectDir in $projectDirs)
- {
- $projectName = [System.IO.Path]::GetFileName($projectDir)
+ $componentOwners = $null
- $match = [regex]::Match($componentOwnersContent, "src\/$projectName\/:([\w\W\s]*?)src")
- if ($match.Success -eq $true)
- {
- $matches = [regex]::Matches($match.Groups[1].Value, "-\s*(.*)")
- foreach ($match in $matches)
- {
- $owner = $match.Groups[1].Value
- $_ = $componentOwners.Add($owner.Trim())
- }
- }
- }
+ FindComponentOwners `
+ -component $component `
+ -issueNumber $issueNumber `
+ -componentOwners ([ref]$componentOwners)
$requestedByUserPermission = gh api "repos/$gitRepository/collaborators/$requestedByUserName/permission" | ConvertFrom-Json