fix(ResourceInfoFactory): Align ResourceInfoFactory detectors to otel specification#2006
Conversation
There was a problem hiding this comment.
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, andService. - Reordered env-configured detector composition so registry-requested detectors run before mandatory
Environment,Sdk, andService.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ 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
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 6 files with indirect coverage changes Continue to review full report in Codecov by Harness.
🚀 New features to boost your workflow:
|
…or-service-name-again Add regression coverage for `service.name` precedence over registry detectors
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
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_NAMEhas the highest priority. However, with current implementation, theservice.namedetected by theopen-telemetry/detector-azurewill replace theservice.namefromOTEL_SERVICE_NAMEwhich doesn't meet the specification.Fix
Corrected the ordering of the resource detectors in default and env-provided detectors.