Visitar URL original
Fail fast in JDK and grpc-java senders for hosts java.net.URI cannot parse by hitkall · Pull Request #8856 · open-telemetry/opentelemetry-java · GitHub
Skip to content

Fail fast in JDK and grpc-java senders for hosts java.net.URI cannot parse - #8856

Open
hitkall wants to merge 4 commits into
open-telemetry:mainfrom
hitkall:fix/sender-unparseable-host-fail-fast
Open

hitkall wants to merge 4 commits into
open-telemetry:mainfrom
hitkall:fix/sender-unparseable-host-fail-fast

Conversation

@hitkall

@hitkall hitkall commented Sep 24, 2026

Copy link
Copy Markdown

Resolves #8745, following the approach agreed in #8745 (comment).

Since #8746, EndpointUtil accepts valid RFC 1123 hosts that java.net.URI can't parse, such as otlp.1234-k8s-namespace (JDK-8188305). The default OkHttp senders handle these, but two senders can't:

Both providers now throw an IllegalArgumentException when the sender is created. The message names the endpoint and suggests the OkHttp sender or a fully qualified host name. The gRPC check applies only when no ManagedChannel is set explicitly, because an explicit channel doesn't use the endpoint.

Tests

  • JdkHttpSenderProviderTest: throws for unparseable hosts, and succeeds for localhost and a *.svc.cluster.local name.
  • UpstreamGrpcSenderProviderTest: the fallback channel throws, and an explicitly set channel still succeeds.

🤖 Generated with Claude Code

…parse

JdkHttpSender and UpstreamGrpcSenderProvider's fallback channel rely on
java.net.URI to parse the endpoint host, which returns null for valid DNS
names whose last label starts with a digit (JDK-8188305). EndpointUtil
accepts these since open-telemetry#8746, so they previously failed with an opaque
error on first export or a NullPointerException. Throw a clear error at
sender construction instead.

Part of open-telemetry#8745
@opentelemetry-pr-dashboard

opentelemetry-pr-dashboard Bot commented Sep 24, 2026 •

Copy link
Copy Markdown

Pull request dashboard status

Waiting on the author · refreshed 2026-11-13 06:54 UTC

Two things need attention:

  • Required checks are failing — investigate the failures.
  • 1 review item — respond to each (e.g. link a commit, explain why not, ask a follow-up):
    • Inline threads: 1
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.
  • Should this be with reviewers? Comment /dashboard route:reviewers to route it to them.
  • Anything wrong — including the routing? Report it with what you expected; it helps us improve the dashboard.

@codecov

codecov Bot commented Sep 24, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.44%. Comparing base (f73e837) to head (e283b88).
⚠️ Report is 115 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #8856      +/-   ##
============================================
- Coverage     91.44%   90.44%   -1.01%     
- Complexity    10667    11173     +506     
============================================
  Files          1007     1032      +25     
  Lines         28686    30455    +1769     
  Branches       3676     3975     +299     
============================================
+ Hits          26233    27545    +1312     
- Misses         1657     1935     +278     
- Partials        796      975     +179     

☔ 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.

Comment on lines +70 to +72
// grpc-java parses host names with java.net.URI, which returns null for some valid DNS names
// (JDK-8188305) that EndpointUtil accepts, so fail with a clear message.
if (endpoint.getHost() == null) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: since you filed grpc/grpc-java#13075 upstream, consider referencing it in this comment (alongside JDK-8188305) so a future maintainer knows this check can be relaxed once grpc-java fixes host validation on their side.

@opentelemetry-pr-dashboard

Copy link
Copy Markdown

Hi @hitkall — just a friendly reminder that this pull request is waiting on you. The dashboard status comment has the open items and is kept current.

  • Replying is enough to hand it off — answer, explain why no change is needed, or ask a follow-up. The dashboard routes it onward once nothing on the list is waiting on you.
  • To hand it back for any other reason, including the dashboard getting this wrong, comment /dashboard route:reviewers.

@jack-berg jack-berg added the needs author feedback Waiting for additional feedback from the author label Nov 2, 2026
@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

This PR has been labeled as stale due to lack of activity and needing author feedback. It will be automatically closed if there is no further activity over the next 7 days.

@github-actions github-actions Bot added the Stale label Nov 9, 2026

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

needs author feedback Waiting for additional feedback from the author Stale

Projects

None yet

Development

Successfully merging this pull request may close these issues.

EndpointUtil.validateEndpoint not handling all valid DNS host names

2 participants