Skip to content

fix(ResourceInfoFactory): Align ResourceInfoFactory detectors to otel specification#2006

Merged
bobstrecansky merged 12 commits into
open-telemetry:mainfrom
jerrytfleung:resource_detectors_ordering
Jul 13, 2026
Merged

fix(ResourceInfoFactory): Align ResourceInfoFactory detectors to otel specification#2006
bobstrecansky merged 12 commits into
open-telemetry:mainfrom
jerrytfleung:resource_detectors_ordering

Conversation

@jerrytfleung

Copy link
Copy Markdown
Contributor

Problem

From https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/resource/sdk.md#specifying-resource-information-via-an-environment-variable, user provided resource information has higher priority and OTEL_SERVICE_NAME has the highest priority. However, with current implementation, the service.name detected by the open-telemetry/detector-azure will replace the service.name from OTEL_SERVICE_NAME which doesn't meet the specification.

Fix

Corrected the ordering of the resource detectors in default and env-provided detectors.

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.

Pull request overview

This PR aligns ResourceInfoFactory’s detector merge order with the OpenTelemetry resource specification so that user-provided resource info (and specifically OTEL_SERVICE_NAME) takes precedence over vendor/registry-provided detectors (e.g., Azure).

Changes:

  • Reordered default (“all detectors”) composition so registry detectors run before Environment, Sdk, and Service.
  • Reordered env-configured detector composition so registry-requested detectors run before mandatory Environment, Sdk, and Service.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/SDK/Resource/ResourceInfoFactory.php Outdated
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
@codecov

codecov Bot commented Jul 9, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 68.05%. Comparing base (697aefd) to head (2e882d5).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##               main    #2006      +/-   ##
============================================
+ Coverage     68.00%   68.05%   +0.04%     
  Complexity     3078     3078              
============================================
  Files           459      459              
  Lines          9023     9024       +1     
============================================
+ Hits           6136     6141       +5     
+ Misses         2887     2883       -4     
Flag Coverage Δ
8.1 67.73% <100.00%> (-0.02%) ⬇️
8.2 67.97% <100.00%> (+0.06%) ⬆️
8.3 67.95% <100.00%> (+0.04%) ⬆️
8.4 67.96% <100.00%> (+0.06%) ⬆️
8.5 67.93% <100.00%> (-0.04%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/SDK/Resource/ResourceInfoFactory.php 97.91% <100.00%> (+0.04%) ⬆️

... and 6 files with indirect coverage changes


Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 697aefd...2e882d5. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.

Comment thread src/SDK/Resource/ResourceInfoFactory.php
Copilot AI and others added 2 commits July 9, 2026 21:17
…or-service-name-again

Add regression coverage for `service.name` precedence over registry detectors

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.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

Comment thread tests/Unit/SDK/Resource/ResourceInfoFactoryTest.php Outdated

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.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

Comment thread tests/Unit/SDK/Resource/ResourceInfoFactoryTest.php
Co-authored-by: Copilot Autofix powered by AI <[email protected]>

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.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

Comment thread tests/Unit/SDK/Resource/ResourceInfoFactoryTest.php
Co-authored-by: Copilot Autofix powered by AI <[email protected]>

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.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

Comment thread tests/Unit/SDK/Resource/ResourceInfoFactoryTest.php
jerrytfleung and others added 2 commits July 10, 2026 08:51

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.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

@bobstrecansky
bobstrecansky merged commit f45aa11 into open-telemetry:main Jul 13, 2026
12 checks passed
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