From 5559a6c8836f5f1bb7450af10ec61e0893f1347d Mon Sep 17 00:00:00 2001 From: Mikel Blanchard Date: Mon, 30 Sep 2024 10:54:00 -0700 Subject: [PATCH] [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); } }