Skip to content

Fix exporter metric server attributes for hosts java.net.URI cannot parse - #8941

Open
thswlsqls wants to merge 1 commit into
open-telemetry:mainfrom
thswlsqls:fix/exporter-metrics-server-attributes-rfc1123-host
Open

thswlsqls wants to merge 1 commit into
open-telemetry:mainfrom
thswlsqls:fix/exporter-metrics-server-attributes-rfc1123-host

Conversation

@thswlsqls

Copy link
Copy Markdown
Contributor

Related to #8745

Description

  • Since Accept RFC 1123 hostnames in EndpointUtil.validateEndpoint #8746, EndpointUtil.validateEndpoint accepts valid DNS names that java.net.URI does not parse as a host (JDK-8188305), such as http://otlp.1234-ns:4318.
  • For these endpoints ExporterInstrumentation.extractServerAttributes gets a null host and port -1, so with internal telemetry version LATEST the exporter metrics omit server.address and record server.port=80 instead of 4318.
  • The default OkHttp sender reparses the endpoint, so export still works; only these metric attributes are wrong.
  • When URI.getHost() is null, host and port are now read from URI.toURL(), like the fallback in EndpointUtil.hasHost. Scheme default ports are unchanged.
  • No overlap with Fail fast in JDK and grpc-java senders for hosts java.net.URI cannot parse #8856, which only changes the JDK and gRPC sender providers.

Testing done

  • Added ExporterInstrumentationTest#serverAttributesHostNotParsedByUri for http://otlp.1234-ns:4318/v1/traces (port 4318) and https://otlp.1234-ns/v1/traces (port 443).
  • Without the production change the new test fails (Expected attributes to have <2> entries but actually has <1>).
  • ./gradlew :exporters:common:check passed. No apidiff change (internal package).

@thswlsqls
thswlsqls marked this pull request as ready for review October 13, 2026 04:27
@thswlsqls
thswlsqls requested a review from a team as a code owner October 13, 2026 04:27
@opentelemetry-pr-dashboard

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

Copy link
Copy Markdown

Pull request dashboard status

Waiting on reviewers · refreshed 2026-10-13 04:54 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.

@codecov

codecov Bot commented Oct 13, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 75.00000% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.65%. Comparing base (387f5c5) to head (990b0ca).

Files with missing lines Patch % Lines
...rter/internal/metrics/ExporterInstrumentation.java 75.00% 1 Missing and 1 partial ⚠️

❌ Your patch check has failed because the patch coverage (75.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    #8941   +/-   ##
=========================================
  Coverage     90.65%   90.65%           
- Complexity    10887    10889    +2     
=========================================
  Files          1015     1015           
  Lines         29731    29738    +7     
  Branches       3876     3878    +2     
=========================================
+ Hits          26953    26960    +7     
- Misses         1860     1861    +1     
+ Partials        918      917    -1     

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

1 participant