Skip to content

Add __getattr__ to _ReplaySafeSpan for SDK attribute delegation#1392

Merged
tconley1428 merged 1 commit intomainfrom
replay-safe-span-getattr
Mar 25, 2026
Merged

Add __getattr__ to _ReplaySafeSpan for SDK attribute delegation#1392
tconley1428 merged 1 commit intomainfrom
replay-safe-span-getattr

Conversation

@tconley1428
Copy link
Contributor

Summary

  • Adds __getattr__ to _ReplaySafeSpan so that SDK-specific span attributes (.name, .kind, .resource, .attributes, etc.) are delegated to the underlying span. Instrumentation libraries like opentelemetry-instrumentation-asgi access these directly.
  • Removes dead self._status assignment in set_status (was written but never read).
  • Adds unit test verifying delegation of non-ABC attributes and proper AttributeError for missing ones.

Test plan

  • New test_replay_safe_span_delegates_extra_attributes test passes
  • Test verified to fail without the __getattr__ change
  • pyright and ruff pass clean

🤖 Generated with Claude Code

Instrumentation libraries like opentelemetry-instrumentation-asgi access
attributes beyond the Span ABC (e.g. .name, .kind, .resource, .attributes)
directly on spans. _ReplaySafeSpan now forwards these via __getattr__ to
the wrapped span. Also removes dead self._status assignment in set_status.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@tconley1428 tconley1428 requested a review from a team as a code owner March 25, 2026 16:56
@tconley1428 tconley1428 merged commit e9ac9a3 into main Mar 25, 2026
37 of 42 checks passed
@tconley1428 tconley1428 deleted the replay-safe-span-getattr branch March 25, 2026 19:00
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.

2 participants