[opentelemetry-sdk] Fix overwriting of the service.instance.id which has been populated through the resource detectors - #5660
Merged
Conversation
Pull request dashboard statusMerged · refreshed 2026-09-23 15:41 UTC Status above doesn't look right?
|
rads-1996
force-pushed
the
fix-detector-logic
branch
from
September 14, 2026 22:29
cc9853d to
c408da2
Compare
rads-1996
marked this pull request as ready for review
September 14, 2026 22:36
herin049
reviewed
Sep 14, 2026
Shriprasad-P
left a comment
Contributor
There was a problem hiding this comment.
Thanks for the PR. Approach looks sensible — please confirm edge cases and failure paths are covered by tests.
rads-1996
force-pushed
the
fix-detector-logic
branch
2 times, most recently
from
September 17, 2026 16:49
e9e6ae6 to
fb426c2
Compare
rads-1996
force-pushed
the
fix-detector-logic
branch
from
September 18, 2026 22:45
dcbf560 to
c31187b
Compare
Contributor
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Explicit detector ordering and fork-time resource refresh can still overwrite configured IDs, and direct user/environment precedence lacks coverage.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 2
Open (3)
What changed in this PR
This PR adjusts resource detector ordering to prevent generated service.instance.id values from overriding configured detector values.
Changes:
- Prepends the service-instance detector.
- Adds detector regression tests.
- Adds a changelog entry.
| File | Description |
|---|---|
opentelemetry-sdk/src/opentelemetry/sdk/resources/__init__.py |
Changes detector ordering. |
opentelemetry-sdk/tests/resources/test_resources.py |
Adds service-instance regression tests. |
.changelog/5660.fixed |
Documents the fix. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
…from the user provided values from the resource detectors
rads-1996
force-pushed
the
fix-detector-logic
branch
from
September 21, 2026 15:59
29d6592 to
d1c2dc2
Compare
herin049
approved these changes
Sep 21, 2026
lzchen
approved these changes
Sep 22, 2026
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Sep 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Description
Prevent
ServiceInstanceIdResourceDetectorfrom overwriting an existingservice.instance.idset by another resource detector(ex. Azure) or user configuration. Add regression coverage for detector-, initial-resource-, and environment-provided IDs, while retaining UUID generation when no ID is present.Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
Does This PR Require a Contrib Repo Change?
Checklist: