[OTLP] Set TE header for gRPC calls (#6449)

This commit is contained in:
Martin Costello 2025-08-22 16:39:37 +01:00 committed by GitHub
parent 84b3ca4e11
commit 7a4643a829
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 0 deletions

View File

@ -19,6 +19,10 @@ Notes](../../RELEASENOTES.md).
Note that exporting `logrecord.event.id` is still behind that same feature Note that exporting `logrecord.event.id` is still behind that same feature
flag. ([#6306](https://github.com/open-telemetry/opentelemetry-dotnet/pull/6306)) flag. ([#6306](https://github.com/open-telemetry/opentelemetry-dotnet/pull/6306))
* gRPC calls to export traces, logs, and metrics using `OtlpExportProtocol.Grpc`
now set the `TE=trailers` HTTP request header to improve interoperability.
([#6449](https://github.com/open-telemetry/opentelemetry-dotnet/pull/6449))
## 1.12.0 ## 1.12.0
Released 2025-Apr-29 Released 2025-Apr-29

View File

@ -39,6 +39,11 @@ internal sealed class OtlpGrpcExportClient : OtlpExportClient
try try
{ {
using var httpRequest = this.CreateHttpRequest(buffer, contentLength); using var httpRequest = this.CreateHttpRequest(buffer, contentLength);
// TE is required by some servers, e.g. C Core.
// A missing TE header results in servers aborting the gRPC call.
httpRequest.Headers.TryAddWithoutValidation("TE", "trailers");
using var httpResponse = this.SendHttpRequest(httpRequest, cancellationToken); using var httpResponse = this.SendHttpRequest(httpRequest, cancellationToken);
httpResponse.EnsureSuccessStatusCode(); httpResponse.EnsureSuccessStatusCode();