Skip to content

feat: make resource detector ordering deterministic#5120

Open
herin049 wants to merge 3 commits intoopen-telemetry:mainfrom
herin049:feat/update-detector-init-order
Open

feat: make resource detector ordering deterministic#5120
herin049 wants to merge 3 commits intoopen-telemetry:mainfrom
herin049:feat/update-detector-init-order

Conversation

@herin049
Copy link
Copy Markdown
Contributor

Description

Makes the ordering and merging of resource detector attributes deterministic, with the otel resource detector being last unless explicitly listed in OTEL_EXPERIMENTAL_RESOURCE_DETECTORS.

Fixes #5054

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

uv run tox -e py314-test-opentelemetry-sdk

Does This PR Require a Contrib Repo Change?

  • Yes. - Link to PR:
  • No.

Checklist:

  • Followed the style guidelines of this project
  • Changelogs have been updated
  • Unit tests have been added
  • Documentation has been updated

@herin049 herin049 requested a review from a team as a code owner April 17, 2026 04:49
Copy link
Copy Markdown
Contributor

@xrmx xrmx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

}
)
otel_experimental_resource_detectors: list[str] = [
d.strip()
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.

Don't want to sound like pylint but can we call this detector instead of d?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

Resource creation race condition with OTEL_RESOURCE_ATTRIBUTES env var

2 participants