tracing: fix StartProxyForwardSpan dead code by adding serverAddress param#7536
Merged
Conversation
…helper in handler.go
Copilot
AI
changed the title
[WIP] Remove dead code for StartProxyForwardSpan helper
tracing: fix StartProxyForwardSpan dead code by adding serverAddress param
Jun 14, 2026
Collaborator
|
@copilot resolve the merge conflicts in this pull request |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR standardizes OpenTelemetry span creation for proxied backend forwarding by fixing the StartProxyForwardSpan helper to include the server.address attribute, then reusing the helper from the proxy handler to avoid duplicated/diverged span attribute sets.
Changes:
- Extend
tracing.StartProxyForwardSpanto acceptserverAddressand setsemconv.ServerAddressKey. - Replace the inline
"proxy.backend.forward"span creation in the proxy handler with the tracing helper (and remove the now-unusedotel/traceimport). - Update tracing helper tests to pass a server address and assert the
server.addressattribute is recorded.
Show a summary per file
| File | Description |
|---|---|
| internal/tracing/span_helpers.go | Adds serverAddress parameter and includes semconv.ServerAddressKey on the forward span. |
| internal/proxy/handler.go | Switches forward-span creation to tracing.StartProxyForwardSpan and drops the unused oteltrace import. |
| internal/tracing/span_helpers_test.go | Updates the helper call and asserts the new server.address span attribute. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 3/3 changed files
- Comments generated: 0
Contributor
Author
Conflicts are resolved in commit |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
StartProxyForwardSpanininternal/tracing/span_helpers.gowas dead code — it omittedsemconv.ServerAddressKey, causinginternal/proxy/handler.goto inline the span creation with a diverged attribute set instead of using the helper.Changes
internal/tracing/span_helpers.go— AddserverAddress stringparameter toStartProxyForwardSpan; includesemconv.ServerAddressKeyin span attributes to match the live inline versioninternal/proxy/handler.go— Replace inline"proxy.backend.forward"span creation withtracing.StartProxyForwardSpan; remove now-unusedoteltraceimportinternal/tracing/span_helpers_test.go— Update call site and add assertion forsemconv.ServerAddressKey