Skip to content

Copy service.name baggage onto all span attributes#258

Merged
nikhilNava merged 1 commit into
mainfrom
nikhilNava/copy-service-name-to-spans
Jun 9, 2026
Merged

Copy service.name baggage onto all span attributes#258
nikhilNava merged 1 commit into
mainfrom
nikhilNava/copy-service-name-to-spans

Conversation

@nikhilNava

Copy link
Copy Markdown
Contributor

Summary

The service.name baggage value, set via BaggageBuilder.OperationSource(...), was never copied onto span attributes because ServiceNameKey was missing from ActivityProcessor's AttributeKeys allow-list. As a result, OperationSource(...) had no effect on emitted telemetry.

Change

Added OpenTelemetryConstants.ServiceNameKey to the global AttributeKeys list in ActivityProcessor. CoalesceTag only applies the tag when the baggage value is non-empty, so it is copied to every span only when set.

Audit

Reviewed all baggage keys written by BaggageBuilder and TurnContextExtensions against the processor allow-lists. service.name was the only baggage attribute set but not copied to spans; all others were already covered (server.address/server.port remain scoped to invoke_agent spans intentionally).

Testing

  • dotnet build succeeds
  • All 331 Observability.Runtime tests pass

The service.name baggage value (set via BaggageBuilder.OperationSource) was never copied onto span attributes because it was missing from ActivityProcessor's allow-list. Add ServiceNameKey to AttributeKeys so it is applied to all spans when set.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@nikhilNava nikhilNava requested a review from a team as a code owner June 9, 2026 16:31
Copilot AI review requested due to automatic review settings June 9, 2026 16:31
@github-actions

github-actions Bot commented Jun 9, 2026

Copy link
Copy Markdown

⚠️ Deprecation Warning: The deny-licenses option is deprecated for possible removal in the next major release. For more information, see issue 997.

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

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.

Pull request overview

This PR ensures that the service.name value stored in OpenTelemetry baggage (via BaggageBuilder.OperationSource(...)) is propagated onto span attributes by adding OpenTelemetryConstants.ServiceNameKey to ActivityProcessor’s global AttributeKeys allow-list.

Changes:

  • Added OpenTelemetryConstants.ServiceNameKey to the ActivityProcessor attribute allow-list so it is coalesced onto every started span when present.

@nikhilNava nikhilNava enabled auto-merge (squash) June 9, 2026 17:37
@nikhilNava nikhilNava merged commit d4d1a52 into main Jun 9, 2026
8 checks passed
@nikhilNava nikhilNava deleted the nikhilNava/copy-service-name-to-spans branch June 9, 2026 18:30
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.

5 participants