Skip to content

Commit

Permalink
[geneva] Rename metric transports (#2119)
Browse files Browse the repository at this point in the history
  • Loading branch information
CodeBlanch authored Sep 30, 2024
1 parent 794eb48 commit 5559a6c
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public OtlpProtobufMetricExporter(Func<Resource> 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<Metric> batch)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,21 @@
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
{
this.fixedPayloadEndIndex = sizeof(BinaryHeader);
}
}

public static MetricEtwDataTransport Instance { get; private set; } = new();
public static MetricWindowsEventTracingDataTransport Instance { get; private set; } = new();

[NonEvent]
#if NET
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down

0 comments on commit 5559a6c

Please sign in to comment.