Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[geneva] Rename metric transports #2119

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading