Skip to content

Populate gRPC server.address and server.port from channel targets - #16161

Open
trask wants to merge 61 commits into
open-telemetry:mainfrom
trask:grpc-server-address
Open

trask wants to merge 61 commits into
open-telemetry:mainfrom
trask:grpc-server-address

Conversation

@trask

@trask trask commented Feb 12, 2026 •

Copy link
Copy Markdown
Member

Populate gRPC client server.address and server.port from configured channel targets rather than channel authority alone.

Library users can supply the target explicitly on all supported gRPC versions, without depending on gRPC's internal target-aware interception API:

GrpcTelemetry telemetry = GrpcTelemetry.create(openTelemetry);
String target = "dns:///orders.example.com:8443";
ManagedChannelBuilder<?> channelBuilder = ManagedChannelBuilder.forTarget(target);
channelBuilder.intercept(telemetry.createClientInterceptor(target));

The no-argument createClientInterceptor() continues to use channel authority. For custom name resolvers, use an explicit scheme://... target.

For automatic capture, use this experimental API instead of registering the interceptor directly:

Experimental.addClientInterceptor(telemetry, channelBuilder);

Experimental is in io.opentelemetry.instrumentation.grpc.v1_6.internal. Automatic capture depends on gRPC's internal API on 1.64.0 and newer, falling back to authority on older versions or unsupported builders. The Java agent uses this automatic path.

Remove GrpcRequest.getLogicalHost() and getLogicalPort() for 3.0. Use getServerAddress() and getServerPort() instead. getServerPort() returns null rather than -1 when the port is unavailable.

@lmolkova lmolkova left a comment •

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.

Looks great (assuming you're comfortable depending on '@internal public' API)

@trask
trask force-pushed the grpc-server-address branch from c45ee61 to ce22789 Compare February 13, 2026 04:14
@trask
trask marked this pull request as ready for review February 13, 2026 22:54
@trask
trask requested a review from a team as a code owner February 13, 2026 22:54
@trask
trask force-pushed the grpc-server-address branch from 9a1c3d7 to 2a0e0b9 Compare February 17, 2026 17:14
@trask
trask force-pushed the grpc-server-address branch 5 times, most recently from 0f60636 to dd4d89f Compare February 26, 2026 04:09
@trask
trask marked this pull request as draft February 26, 2026 04:28
@trask
trask force-pushed the grpc-server-address branch 6 times, most recently from d93c7e4 to e19f9d2 Compare March 1, 2026 02:27
@trask
trask force-pushed the grpc-server-address branch from e19f9d2 to 9ae10a5 Compare March 2, 2026 21:05
Copilot AI and others added 3 commits September 29, 2026 03:12
…conflict-fix-loop-worker-one-more-time

# Conflicts:
#	CHANGELOG.md

Co-authored-by: trask <218610+trask@users.noreply.github.com>
Co-authored-by: trask <218610+trask@users.noreply.github.com>
Co-authored-by: trask <218610+trask@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

Numeric opaque targets for custom resolver schemes are incorrectly emitted as host-and-port values.

Review effort: Balanced
Findings: 1 Medium severity

Open (1)
Resolved since last review (1)

Co-authored-by: trask <218610+trask@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

Raw hostname-and-port targets are misclassified as resolver schemes, producing incorrect server attributes.

Review effort: Balanced
Findings: 1 High severity

Open (1)
Resolved since last review (1)

Copilot AI and others added 2 commits September 29, 2026 04:12
Co-authored-by: trask <218610+trask@users.noreply.github.com>
Co-authored-by: trask <218610+trask@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

IPv6 Armeria targets and per-builder custom resolvers currently produce incorrect endpoint attributes.

Review effort: Balanced
Findings: 2 Medium severity

Open (2)
Resolved since last review (1)

Copilot AI and others added 4 commits September 29, 2026 04:41
Co-authored-by: trask <218610+trask@users.noreply.github.com>
Co-authored-by: trask <218610+trask@users.noreply.github.com>
Co-authored-by: trask <218610+trask@users.noreply.github.com>
Co-authored-by: trask <218610+trask@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🔵 Needs a closer look

The javaagent misclassifies raw targets for channels using per-builder custom resolvers.

Review effort: Balanced
Findings: None

Resolved since last review (2)
Previously missed (1)

In code that hasn't changed since last review

Medium severity Use the builder's resolver when parsing gRPC targets

instrumentation/​grpc-1.6/​javaagent/​src/​main/​java/​io/​opentelemetry/​javaagent/​instrumentation/​grpc/​v1_6/​GrpcClientBuilderBuildInstrumentation.java:50

[Javaagent] This passes the builder's raw target to a parser that consults only the global NameResolverRegistry, but gRPC supports a per-builder resolver via nameResolverFactory(...). For example, a builder whose custom resolver owns consul:1234 computes that custom target, while this path sees no global consul provider and emits server.address="consul" and server.port=1234 instead of preserving consul:1234 with no port. Install the target-aware interceptor factory on the builder (so gRPC supplies its computed target) or carry the builder's resolver selection into parsing; on older gRPC versions, authority fallback is safer than misclassifying the raw target.

Copilot AI and others added 2 commits September 29, 2026 05:02
Co-authored-by: trask <218610+trask@users.noreply.github.com>
Co-authored-by: trask <218610+trask@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟢 Approval recommended

Target parsing, compatibility fallbacks, API migration, and integration coverage are consistent and complete.

Review effort: Balanced
Findings: None

Copilot AI and others added 4 commits September 29, 2026 15:53
…conflict-fix-loop-worker-please-work

# Conflicts:
#	CHANGELOG.md

Co-authored-by: trask <218610+trask@users.noreply.github.com>
…conflict-fix-loop-worker-prompt-v4-4b5c6b4a-5e9a-45b1-97ee-b2be59084984

# Conflicts:
#	CHANGELOG.md

Co-authored-by: trask <218610+trask@users.noreply.github.com>
Preserve target-derived gRPC attributes while adopting the upstream RPC preview API and configuration migration. Keep the new gRPC getter deprecation in Unreleased without rewriting published release notes.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Preserve target-aware interceptor coverage while adopting the instance-scoped RPC semantic-convention test helpers from main.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

Reflective interception across supported gRPC versions and Armeria integration warrants final human compatibility review.

No open issues 🎉

Review effort: Balanced

trask and others added 2 commits October 21, 2026 17:57
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 5f70777f-8e6c-4bcb-aca4-1660735a7d6d
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 5f70777f-8e6c-4bcb-aca4-1660735a7d6d
@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Breaking Change Documentation Required

This PR has been labeled as a breaking change. Please ensure you provide the following information:

Migration Notes Required

Please add detailed migration notes to help users understand:

  • What is changing and why
  • How to update their code/configuration
  • Any alternative approaches if applicable
  • Code examples showing before/after usage

Checklist

  • Migration notes added to the PR description
  • Breaking change is documented in the "Unreleased" section of the Changelog, preferably as part of this PR.
  • Consider if this change requires a major version bump

Your migration notes will be included in the release notes to help users upgrade smoothly. The more detailed and helpful they are, the better the user experience will be.


This comment was automatically generated because the breaking change label was applied to this PR.

trask and others added 3 commits October 22, 2026 18:54
Preserve the gRPC request getter migration entry alongside the incoming span-suppression migration notice. Retain both sides of the instrumentation and build changes.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Retain the gRPC request getter migration alongside the incoming Netty and Java HTTP Client API migration notices. Preserve both sides' source and build changes unchanged.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Keep the gRPC request getter migration alongside the incoming RxJava API migration notice. Preserve target-address capture together with the incoming RPC histogram boundaries and assertions.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@trask

trask commented Oct 24, 2026

Copy link
Copy Markdown
Member Author

/dashboard route:reviewers

@opentelemetry-pr-dashboard

Copy link
Copy Markdown

@trask, your reviewer-routing request was recorded; this pull request has the approvals it needs and is now waiting on maintainers. The handoff remains active across pushes until newer actionable human feedback arrives. Top-level feedback through this request will not return; unresolved review threads remain open.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants