Keep distro resource attributes under declarative configuration - #10
Draft
mmanciop wants to merge 1 commit into
Draft
Keep distro resource attributes under declarative configuration#10mmanciop wants to merge 1 commit into
mmanciop wants to merge 1 commit into
Conversation
mmanciop
force-pushed
the
fix/declarative-config-resource-attributes
branch
from
July 21, 2026 16:51
f83d2e1 to
6fc4bfd
Compare
mmanciop
marked this pull request as draft
July 21, 2026 16:54
mmanciop
force-pushed
the
fix/declarative-config-resource-attributes
branch
from
July 21, 2026 17:06
6fc4bfd to
d12519d
Compare
When OTEL_CONFIG_FILE is set, the declarative resource builder ignores OTEL_RESOURCE_ATTRIBUTES and OTEL_SERVICE_NAME, so the attributes the distro injects into the environment (telemetry.distro.*, k8s.pod.uid, and the fallback service.name) silently disappeared. Registering the dash0_* resource detectors (#11) is not enough on its own: declarative configuration only runs detectors listed in the config file, so users would have to edit their YAML to keep the attributes. Dash0Configurator now handles OTEL_CONFIG_FILE itself: it loads the config file, adds the missing dash0_* detectors to the parsed configuration, and hands it to configure_sdk, so the attributes survive without any config file changes. Detected attributes merge below explicit config attributes, so values declared in the file still win, and detectors already listed there are not added twice. The declarative machinery is resolved from both layouts, the file-configuration extra shipped inside SDK 1.43 and the standalone opentelemetry-configuration package of SDK 1.44+, and when neither is importable the configurator falls back to the base class, which reports its usual error. The SDK's file-configuration extra becomes a dev dependency so the unit tests exercise the declarative path; whether the declarative machinery becomes a runtime dependency is tracked in #5. Note that on the pinned SDK 1.43 the upstream loader rejects the spec's resource.detection/development config-file key (fixed upstream in 1.44), so the automatic injection is currently the only way resource detectors run under declarative configuration. Fixes #6
mmanciop
force-pushed
the
fix/declarative-config-resource-attributes
branch
from
July 22, 2026 07:24
d12519d to
2d56ef3
Compare
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.
Fixes #6
Problem
When
OTEL_CONFIG_FILEis set, the declarative resource builder ignoresOTEL_RESOURCE_ATTRIBUTESandOTEL_SERVICE_NAME, so the attributes the distro injects into the environment —telemetry.distro.name/telemetry.distro.version,k8s.pod.uid, and the fallbackservice.name— silently disappeared from the exported resource. The detectors from #11 are not enough on their own: declarative configuration only runs detectors listed in the config file, so users would have to edit their YAML to keep the attributes.Changes
Dash0Configuratornow handlesOTEL_CONFIG_FILEitself: it loads the config file, adds the missingdash0_*detectors to the parsed configuration, and hands it toconfigure_sdk— the attributes survive without any config-file changes.file-configurationextra inside SDK 1.43 and the standaloneopentelemetry-configurationpackage of SDK 1.44+. When neither is importable, the configurator falls back to the base class, which reports its usual error.opentelemetry-sdk[file-configuration]is added as a dev dependency so the unit tests exercise the declarative path; whether it becomes a runtime dependency is tracked in Declarative configuration (OTEL_CONFIG_FILE) fails out of the box: declarative-config dependencies are not installed #5.Note: on the pinned SDK 1.43 the upstream loader rejects the spec's
resource.detection/developmentconfig-file key (fixed upstream in 1.44), so the automatic injection is currently the only way resource detectors run under declarative configuration.