Skip to content

Commit b9be07a

Browse files
[otlp] Remove the Google.Protobuf / Grpc packages, and replace the logs and metrics with the new implementation (#6005)
Co-authored-by: Mikel Blanchard <[email protected]>
1 parent 84e6afb commit b9be07a

File tree

73 files changed

+514
-3177
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+514
-3177
lines changed

.editorconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ dotnet_diagnostic.IDE0005.severity = warning
156156
# RS0041: Public members should not use oblivious types
157157
dotnet_diagnostic.RS0041.severity = suggestion
158158

159-
[obj/**.cs]
159+
[**/obj/**.cs]
160160
generated_code = true
161161

162162
[*.csproj]

OpenTelemetry.sln

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,11 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "scripts", "scripts", "{4498
345345
EndProject
346346
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "exemplars", "docs\metrics\exemplars\exemplars.csproj", "{79C12C80-B27B-41FB-AE79-A3BB74CFA782}"
347347
EndProject
348+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Proto", "Proto", "{02EA681E-C7D8-13C7-8484-4AC65E1B71E8}"
349+
ProjectSection(SolutionItems) = preProject
350+
src\Shared\Proto\README.md = src\Shared\Proto\README.md
351+
EndProjectSection
352+
EndProject
348353
Global
349354
GlobalSection(SolutionConfigurationPlatforms) = preSolution
350355
Debug|Any CPU = Debug|Any CPU
@@ -661,6 +666,7 @@ Global
661666
{993E65E5-E71B-40FD-871C-60A9EBD59724} = {A49299FB-C5CD-4E0E-B7E1-B7867BBD67CC}
662667
{44982E0D-C8C6-42DC-9F8F-714981F27CE6} = {7CB2F02E-03FA-4FFF-89A5-C51F107623FD}
663668
{79C12C80-B27B-41FB-AE79-A3BB74CFA782} = {3277B1C0-BDFE-4460-9B0D-D9A661FB48DB}
669+
{02EA681E-C7D8-13C7-8484-4AC65E1B71E8} = {A49299FB-C5CD-4E0E-B7E1-B7867BBD67CC}
664670
EndGlobalSection
665671
GlobalSection(ExtensibilityGlobals) = postSolution
666672
SolutionGuid = {55639B5C-0770-4A22-AB56-859604650521}

src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ExportClient/BaseOtlpGrpcExportClient.cs

Lines changed: 0 additions & 67 deletions
This file was deleted.

src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ExportClient/BaseOtlpHttpExportClient.cs

Lines changed: 0 additions & 110 deletions
This file was deleted.

src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ExportClient/IExportClient.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,17 @@
44
namespace OpenTelemetry.Exporter.OpenTelemetryProtocol.Implementation.ExportClient;
55

66
/// <summary>Export client interface.</summary>
7-
/// <typeparam name="TRequest">Type of export request.</typeparam>
8-
internal interface IExportClient<in TRequest>
7+
internal interface IExportClient
98
{
109
/// <summary>
1110
/// Method for sending export request to the server.
1211
/// </summary>
13-
/// <param name="request">The request to send to the server.</param>
12+
/// <param name="buffer">The request body to send to the server.</param>
13+
/// <param name="contentLength">length of the content.</param>
1414
/// <param name="deadlineUtc">The deadline time in utc for export request to finish.</param>
1515
/// <param name="cancellationToken">An optional token for canceling the call.</param>
1616
/// <returns><see cref="ExportClientResponse"/>.</returns>
17-
ExportClientResponse SendExportRequest(TRequest request, DateTime deadlineUtc, CancellationToken cancellationToken = default);
17+
ExportClientResponse SendExportRequest(byte[] buffer, int contentLength, DateTime deadlineUtc, CancellationToken cancellationToken = default);
1818

1919
/// <summary>
2020
/// Method for shutting down the export client.

src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ExportClient/IProtobufExportClient.cs

Lines changed: 0 additions & 30 deletions
This file was deleted.
Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@
99

1010
namespace OpenTelemetry.Exporter.OpenTelemetryProtocol.Implementation.ExportClient;
1111

12-
internal abstract class ProtobufOtlpExportClient : IProtobufExportClient
12+
internal abstract class OtlpExportClient : IExportClient
1313
{
1414
private static readonly Version Http2RequestVersion = new(2, 0);
1515

1616
#if NET
1717
private static readonly bool SynchronousSendSupportedByCurrentPlatform;
1818

19-
static ProtobufOtlpExportClient()
19+
static OtlpExportClient()
2020
{
2121
#if NET
2222
// See: https://github.com/dotnet/runtime/blob/280f2a0c60ce0378b8db49adc0eecc463d00fe5d/src/libraries/System.Net.Http/src/System/Net/Http/HttpClientHandler.AnyMobile.cs#L767
@@ -28,13 +28,24 @@ static ProtobufOtlpExportClient()
2828
}
2929
#endif
3030

31-
protected ProtobufOtlpExportClient(OtlpExporterOptions options, HttpClient httpClient, string signalPath)
31+
protected OtlpExportClient(OtlpExporterOptions options, HttpClient httpClient, string signalPath)
3232
{
3333
Guard.ThrowIfNull(options);
3434
Guard.ThrowIfNull(httpClient);
3535
Guard.ThrowIfNull(signalPath);
3636

37-
Uri exporterEndpoint = options.Endpoint.AppendPathIfNotPresent(signalPath);
37+
Uri exporterEndpoint;
38+
if (options.Protocol == OtlpExportProtocol.Grpc)
39+
{
40+
exporterEndpoint = options.Endpoint.AppendPathIfNotPresent(signalPath);
41+
}
42+
else
43+
{
44+
exporterEndpoint = options.AppendSignalPathToEndpoint
45+
? options.Endpoint.AppendPathIfNotPresent(signalPath)
46+
: options.Endpoint;
47+
}
48+
3849
this.Endpoint = new UriBuilder(exporterEndpoint).Uri;
3950
this.Headers = options.GetHeaders<Dictionary<string, string>>((d, k, v) => d.Add(k, v));
4051
this.HttpClient = httpClient;
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
namespace OpenTelemetry.Exporter.OpenTelemetryProtocol.Implementation.ExportClient;
1111

1212
/// <summary>Base class for sending OTLP export request over gRPC.</summary>
13-
internal sealed class ProtobufOtlpGrpcExportClient : ProtobufOtlpExportClient
13+
internal sealed class OtlpGrpcExportClient : OtlpExportClient
1414
{
1515
public const string GrpcStatusDetailsHeader = "grpc-status-details-bin";
1616
private static readonly ExportClientHttpResponse SuccessExportResponse = new(success: true, deadlineUtc: default, response: null, exception: null);
@@ -24,7 +24,7 @@ private static readonly ExportClientGrpcResponse DefaultExceptionExportClientGrp
2424
status: null,
2525
grpcStatusDetailsHeader: null);
2626

27-
public ProtobufOtlpGrpcExportClient(OtlpExporterOptions options, HttpClient httpClient, string signalPath)
27+
public OtlpGrpcExportClient(OtlpExporterOptions options, HttpClient httpClient, string signalPath)
2828
: base(options, httpClient, signalPath)
2929
{
3030
}

src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ExportClient/OtlpGrpcLogExportClient.cs

Lines changed: 0 additions & 45 deletions
This file was deleted.

0 commit comments

Comments
 (0)