Visitar URL original
fix(api): prevent recursive attribute value crashes by codedbyadiiii · Pull Request #5757 · open-telemetry/opentelemetry-python · GitHub
Skip to content

fix(api): prevent recursive attribute value crashes - #5757

Open
codedbyadiiii wants to merge 1 commit into
open-telemetry:mainfrom
codedbyadiiii:fix-issue-5564
Open

codedbyadiiii wants to merge 1 commit into
open-telemetry:mainfrom
codedbyadiiii:fix-issue-5564

Conversation

@codedbyadiiii

Copy link
Copy Markdown
Contributor

Description

Attribute values containing self-referential or excessively nested sequences and mappings could raise RecursionError during attribute cleaning.

This change limits recursive attribute processing to 20 levels. Values exceeding the limit are replaced with None and a warning is logged, while valid sibling attributes are preserved.

The fix also applies to metric attributes and adds regression tests for API attributes, spans, and resources.

Fixes #5564

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature
  • Breaking change

How Has This Been Tested?

  • API attribute tests
  • SDK span and resource tests
  • Ruff check and formatting
  • Regression coverage for cyclic and deeply nested values

@codedbyadiiii
codedbyadiiii requested a review from a team as a code owner October 7, 2026 15:41
@opentelemetry-pr-dashboard

opentelemetry-pr-dashboard Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

Pull request dashboard status

Waiting on reviewers · refreshed 2026-10-08 18:33 UTC

Review the latest changes.

Status above doesn't look right?
  • Just replied or pushed? Anything around or after the refresh time above may not be picked up yet — give it a few minutes.
  • Anything look wrong? Report it with what you expected; it helps us improve the dashboard.

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

Labels

None yet

Projects

Status: Ready for review

Development

Successfully merging this pull request may close these issues.

Self-referential attribute value crashes the instrumented application with RecursionError

1 participant