Skip to content

Match the host header case-insensitively in UpstreamGrpcSender - #8957

Open
thswlsqls wants to merge 1 commit into
open-telemetry:mainfrom
thswlsqls:fix/grpc-sender-host-header-case-insensitive
Open

thswlsqls wants to merge 1 commit into
open-telemetry:mainfrom
thswlsqls:fix/grpc-sender-host-header-case-insensitive

Conversation

@thswlsqls

Copy link
Copy Markdown
Contributor

Fixes #8956

Description

  • UpstreamGrpcSender.send() used headers.get("host") to find the authority override, so a header added as Host or HOST was sent as plain metadata and :authority stayed the endpoint address.
  • The check now uses equalsIgnoreCase("host") inside the existing header loop. Lowercase host behaves as before.
  • This matches the default OkHttp sender, which Allow overriding OTLP gRPC authority. #4514 aimed to mirror. HTTP field names are case-insensitive (RFC 9110 §5.1).

Testing done

  • Added AbstractGrpcTelemetryExporterTest#overrideHostMixedCase: overrideHost with addHeader("Host", "opentelemetry"). It runs for span, metric and log exporters on every gRPC sender suite.
  • Without the main change, ./gradlew :exporters:otlp:all:testGrpcNetty --tests '*overrideHostMixedCase*' fails 3/3 with expected: "opentelemetry" but was: "127.0.0.1:<port>".
  • With the change, all pass: testGrpcNetty, testGrpcNettyShaded, testGrpcOkhttp (198 tests each, 27 skipped), testOkHttpVersionLATEST (345 tests, 4 skipped).
  • :exporters:sender:grpc-managed-channel:check and :exporters:otlp:testing-internal:check pass. No public API change.

@opentelemetry-pr-dashboard

opentelemetry-pr-dashboard Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

Pull request dashboard status

Waiting on reviewers · refreshed 2026-10-18 13:28 UTC

Review the latest changes.

Non-blocking check failure: codecov/patch

Status above doesn't look right?
  • Just replied or pushed? Anything around or after the refresh time above may not be picked up yet — give it a few minutes.
  • Anything look wrong? Report it with what you expected; it helps us improve the dashboard.

@thswlsqls
thswlsqls marked this pull request as ready for review October 18, 2026 13:03
@thswlsqls
thswlsqls requested a review from a team as a code owner October 18, 2026 13:03
@codecov

codecov Bot commented Oct 18, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 50.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 90.41%. Comparing base (b32298a) to head (003cc16).

Files with missing lines Patch % Lines
...pc/managedchannel/internal/UpstreamGrpcSender.java 50.00% 0 Missing and 1 partial ⚠️

❌ Your patch check has failed because the patch coverage (50.00%) is below the target coverage (80.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff            @@
##               main    #8957   +/-   ##
=========================================
  Coverage     90.40%   90.41%           
  Complexity    10898    10898           
=========================================
  Files          1015     1015           
  Lines         29843    29842    -1     
  Branches       3896     3896           
=========================================
  Hits          26981    26981           
+ Misses         1910     1909    -1     
  Partials        952      952           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

UpstreamGrpcSender ignores a "Host" header when overriding the authority

1 participant