Skip to content

update resource detectors to align with spec changes#1573

Merged
brettmc merged 3 commits intoopen-telemetry:mainfrom
brettmc:mandatory-detector
May 1, 2025
Merged

update resource detectors to align with spec changes#1573
brettmc merged 3 commits intoopen-telemetry:mainfrom
brettmc:mandatory-detector

Conversation

@brettmc
Copy link
Contributor

@brettmc brettmc commented Apr 30, 2025

PR open-telemetry/opentelemetry-specification#4461 clarifies that some attributes (service.name, telemetry.*) are mandatory. It also reserves a couple of well-known detectors names (container, host, process, service) and the attributes they should populate. Consolidate some of our resource detectors into the built-in ones:

  • process-runtime into process, and deprecate
  • os into host, and deprecate
  • sdk-provided into sdk, and deprecate
  • service.name attribute from environment into service detector

Add "mandatory attributes", which is currently service.name, and initially set this to "unknown_service:php" similar to Java's implementation. Ensure that the composite detector starts with mandatory attributes.

Ensure that "sdk" and "service" detectors are always included from ResourceInfoFactory.

The deprecated detectors are still available, but do not do anything.

PR open-telemetry/opentelemetry-specification#4461 clarifies that some
attributes (service.name, telemetry.*) are mandatory. It also reserves a couple of well-known
detectors names (container, host, process, service) and the attributes they should populate.
Consolidate some of our resource detectors into the built-in ones:
- process-runtime into process, and deprecate
- os into host, and deprecate
- sdk-provided into sdk, and deprecate
- service.name attribute from environment into service detector

Add "mandatory attributes", which is currently service.name, and initially set this to "unknown_service:php"
similar to Java's implementation. Ensure that the composite detector starts with mandatory attributes.

Ensure that "sdk" and "service" detectors are always included from ResourceInfoFactory.

The deprecated detectors are still available, but do not do anything.
@brettmc brettmc requested a review from a team as a code owner April 30, 2025 05:42
@brettmc brettmc mentioned this pull request Apr 30, 2025
@codecov
Copy link

codecov bot commented Apr 30, 2025

Codecov Report

Attention: Patch coverage is 90.32258% with 3 lines in your changes missing coverage. Please review.

Project coverage is 70.75%. Comparing base (64821d8) to head (3d48940).
Report is 5 commits behind head on main.

Files with missing lines Patch % Lines
src/SDK/Resource/Detectors/OperatingSystem.php 0.00% 1 Missing ⚠️
src/SDK/Resource/Detectors/ProcessRuntime.php 0.00% 1 Missing ⚠️
src/SDK/Resource/Detectors/SdkProvided.php 0.00% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##               main    #1573      +/-   ##
============================================
- Coverage     70.87%   70.75%   -0.12%     
+ Complexity     2766     2755      -11     
============================================
  Files           408      407       -1     
  Lines          8356     8319      -37     
============================================
- Hits           5922     5886      -36     
+ Misses         2434     2433       -1     
Flag Coverage Δ
8.1 70.48% <90.32%> (-0.12%) ⬇️
8.2 70.68% <90.32%> (-0.03%) ⬇️
8.3 70.68% <90.32%> (+<0.01%) ⬆️
8.4 70.62% <90.32%> (-0.12%) ⬇️

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

Files with missing lines Coverage Δ
src/SDK/Resource/Detectors/Composer.php 87.50% <ø> (ø)
src/SDK/Resource/Detectors/Composite.php 100.00% <100.00%> (ø)
src/SDK/Resource/Detectors/Environment.php 100.00% <ø> (ø)
src/SDK/Resource/Detectors/Host.php 75.47% <100.00%> (+2.00%) ⬆️
src/SDK/Resource/Detectors/Process.php 100.00% <100.00%> (ø)
src/SDK/Resource/Detectors/Sdk.php 94.11% <ø> (ø)
src/SDK/Resource/Detectors/Service.php 100.00% <100.00%> (ø)
src/SDK/Resource/ResourceInfoFactory.php 97.50% <100.00%> (-0.18%) ⬇️
src/SDK/Resource/Detectors/OperatingSystem.php 0.00% <0.00%> (-100.00%) ⬇️
src/SDK/Resource/Detectors/ProcessRuntime.php 0.00% <0.00%> (-100.00%) ⬇️
... and 1 more

... and 13 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

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

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

@brettmc brettmc merged commit ab05329 into open-telemetry:main May 1, 2025
11 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.

3 participants