Skip to content

Protect scope-owned span attributes - #266

Merged
Radhika Gupta (rads-1996) merged 10 commits into
microsoft:mainfrom
nikhilNava:copilot/protected-extra-attributes
Sep 25, 2026
Merged

Radhika Gupta (rads-1996) merged 10 commits into
microsoft:mainfrom
nikhilNava:copilot/protected-extra-attributes

Conversation

@nikhilNava

@nikhilNava Nikhil Navakiran (nikhilNava) commented Sep 11, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • prevent record_attributes() from overwriting semantic attributes already set by a scope or propagated from baggage
  • preserve the first accepted value for duplicate custom keys, including across separate calls
  • support recording Span implementations without a public .attributes property
  • keep NonRecordingSpan and disabled telemetry paths safe

Python parity for microsoft/opentelemetry-distro-dotnet#107.

Validation

  • A365 tests: 633 passed, 15 skipped, 38 subtests passed
  • focused scope tests: 17 passed
  • Black, Pylint, and Mypy: passed

nikhilc-microsoft and others added 4 commits September 11, 2026 16:00
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions

github-actions Bot commented Sep 11, 2026 •

Copy link
Copy Markdown

Performance comparison

Threshold: regressions >15.0% on gating scenarios fail the build. Higher ops/s is better; positive Δ means the PR is slower.

Scenario Gating Baseline (ops/s) Candidate (ops/s) Δ % Status
azure_monitor_log yes 38,927.2 38,009.8 +2.41% ✅
azure_monitor_span yes 277,354.0 274,687.5 +0.97% ✅
otel_log no 46,613.5 46,399.4 +0.46% ✅
otel_span no 84,338.4 84,402.4 -0.08% ✅

nikhilc-microsoft and others added 3 commits September 11, 2026 18:02
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <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.

Copilot review overview

🔵 Needs a closer look

Unresolved moderate issues remain in attribute acceptance tracking and compatibility with recording Span implementations.

Review effort: Lite
Findings: None

What changed in this PR

Updates record_attributes() to preserve scope-owned attributes, handle duplicate keys safely, and support non-recording spans.

Changes:

  • Adds first-wins attribute filtering and iterable input support.
  • Adds regression tests for duplicate and non-recording spans.
  • Updates documentation and changelog.

Review findings: key tracking should reflect only accepted attributes, recording spans without .attributes need a fallback, and the docstring should document generic iterables.

File Description
tests/​a365/​test_opentelemetry_scope.py Tests attribute filtering and preservation.
tests/​a365/​test_nonrecording_span.py Tests safe non-recording behavior.
src/​microsoft/​opentelemetry/​a365/​core/​opentelemetry_scope.py Implements protected attribute recording.
CHANGELOG.md Documents the fix.
A365_DOCUMENTATION.md Documents record_attributes() behavior.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

nikhilc-microsoft and others added 3 commits September 25, 2026 12:47
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Comment thread CHANGELOG.md
@rads-1996
Radhika Gupta (rads-1996) merged commit 762c82c into microsoft:main Sep 25, 2026
12 checks passed
@nikhilNava
Nikhil Navakiran (nikhilNava) deleted the copilot/protected-extra-attributes branch September 25, 2026 19:34
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.

4 participants