Repository navigation
Honor exporter-protocol for OpenTelemetry OTLP exporters - #3879
ShryukGrandhi wants to merge 2 commits into
Conversation
Signed-off-by: ShryukGrandhi <85529990+ShryukGrandhi@users.noreply.github.com>
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
|
ShryukGrandhi please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.
Contributor License AgreementContribution License AgreementThis Contribution License Agreement (“Agreement”) is agreed to by the party signing below (“You”),
|
There was a problem hiding this comment.
🟡 Changes recommended
HTTP exports still need signal-specific endpoint handling, and the regression test can pass without verifying the intended trace.
2 open issues
What changed in this PR
This PR addresses #3759 by making DAB’s OpenTelemetry exporters honor the configured protocol instead of always using gRPC.
Changes:
- Apply
ExporterProtocolto logging, metrics, and tracing exporters, retaining gRPC as the default. - Add a local HTTP listener test intended to verify HTTP/protobuf trace export.
| File | Description |
|---|---|
src/Service/Startup.cs |
Uses the configured protocol for logging, metrics, and tracing. |
src/Service/Program.cs |
Uses the configured protocol in the logging factory. |
src/Service.Tests/Configuration/Telemetry/OpenTelemetryTests.cs |
Adds an HTTP/protobuf export regression test. |
Review effort: Balanced
| HttpListenerContext context = await requestTask; | ||
| Assert.AreEqual("application/x-protobuf", context.Request.ContentType); |
| configure.Endpoint = otlpEndpoint; | ||
| configure.Headers = runtimeConfig.Runtime.Telemetry.OpenTelemetry.Headers; | ||
| configure.Protocol = OtlpExportProtocol.Grpc; | ||
| configure.Protocol = runtimeConfig.Runtime.Telemetry.OpenTelemetry.ExporterProtocol ?? OtlpExportProtocol.Grpc; |
…port in test Signed-off-by: ShryukGrandhi <85529990+ShryukGrandhi@users.noreply.github.com>

Why make this change?
Fixes #3759
runtime.telemetry.open-telemetry.exporter-protocolcan be set togrpcorhttpprotobufin the config schema and through the CLI (--otel-protocol). The service ignored it: every OTLP exporter (logging inProgram.cs, and logging, metrics and tracing inStartup.cs) hard-codedOtlpExportProtocol.Grpc. That meanshttpprotobufnever worked, and collectors that only accept OTLP/HTTP got nothing.What is this change?
ExporterProtocol. If it isn't set, it still falls back toGrpc, so existing configs behave the same as before.How was this tested?
Added
TestOpenTelemetryExporterUsesHttpProtobufProtocoltoOpenTelemetryTests. The test starts a localHttpListeneras the OTLP endpoint, setsexporter-protocoltohttpprotobufand boots the service. It then emits a span on the DAB activity source and flushes the tracer provider, and asserts that the collector gets a request withContent-Type: application/x-protobuf. Without this change the test fails because no HTTP export arrives (the exporter speaks gRPC). With the change it passes. The existing OpenTelemetry tests still pass.Sample Request(s)