[SDK] File configuration: declarative resource detection types#4148
Merged
marcalff merged 2 commits intoJun 13, 2026
Merged
Conversation
c31b9b6 to
7f06fd3
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4148 +/- ##
==========================================
+ Coverage 82.80% 82.83% +0.04%
==========================================
Files 399 406 +7
Lines 16845 16913 +68
==========================================
+ Hits 13946 14009 +63
- Misses 2899 2904 +5
🚀 New features to boost your workflow:
|
7f06fd3 to
04ea4c7
Compare
marcalff
reviewed
Jun 12, 2026
marcalff
left a comment
Member
There was a problem hiding this comment.
Thanks for the PR.
There are multiple competing PRs to implement this, so seeing duplicate efforts is a bit sad.
Still, this PR is the most convincing, and the most complete.
Please see renaming comments, and make sure CI is clean.
It should be ready to merge after the cleanup.
Add declarative configuration model for resource detection per file configuration spec: * ResourceDetectorConfiguration (abstract base + visitor) * ContainerResourceDetectorConfiguration * HostResourceDetectorConfiguration * ProcessResourceDetectorConfiguration * ServiceResourceDetectorConfiguration * ExtensionResourceDetectorConfiguration (for non-standard detector names, follows ExtensionSamplerConfiguration pattern) * ResourceDetectionConfiguration (wraps attributes IncludeExcludeConfiguration + vector of detector configs) ResourceConfiguration field renamed from "detectors" (old shape: include/exclude lists of detector names) to "detection" (new shape: typed detector list under detection/development YAML key). The parser dispatches on the single map key of each detector entry (container/host/process/service map to typed configs; any other name falls through to Extension*). Tests use the Accept(visitor) pattern so the suite compiles under -fno-rtti (Bazel nortti CI). The sdk_builder Resource path still emits the existing "resource detectors not supported" warning (open-telemetry#3548) since wiring detectors to actual ResourceDetector implementations is out of scope for this PR. Fixes open-telemetry#3916 Signed-off-by: thc1006 <84045975+thc1006@users.noreply.github.com>
04ea4c7 to
1ced912
Compare
marcalff
approved these changes
Jun 13, 2026
marcalff
left a comment
Member
There was a problem hiding this comment.
LGTM, thanks for the contribution.
This was referenced Jun 13, 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.
Fixes #3916.
Adds the declarative configuration model classes for resource detection per the
file configuration spec, so that the
detection/developmentblock underresourceparses into typed configs the SDK can dispatch on. SDK wiringto actual
ResourceDetectorimplementations is out of scope here and staysbehind the existing
resource detectors not supportedwarning (#3548).What changed
New header files under
sdk/include/opentelemetry/sdk/configuration/:resource_detector_configuration.h— abstract base withAccept(visitor) const = 0resource_detector_configuration_visitor.h— visitor with oneVisit*per leaf type (Container/Host/Process/Service/Extension)container_resource_detector_configuration.hhost_resource_detector_configuration.hprocess_resource_detector_configuration.hservice_resource_detector_configuration.hextension_resource_detector_configuration.h— fallback fornon-standard detector names, follows the existing
ExtensionSamplerConfigurationpattern (storesname, rawDocumentNode,depth)resource_detection_configuration.h— wraps optionalIncludeExcludeConfiguration attributesplus a vector of detector configsResourceConfiguration: field renamed fromdetectors(old shape:IncludeExcludeof detector name strings) todetection(
std::unique_ptr<ResourceDetectionConfiguration>) so the modelmatches the spec.
ConfigurationParser: parser methods for each new type. The detectordispatcher reads the single map key per list entry (e.g.
- container:) andfalls through to the Extension parser for any other name. The top-level
parser now looks up
detection/developmentinstead ofdetectors.SdkBuilder: updated reference to the renamed field; existing warningpreserved.
Tests
sdk/test/configuration/yaml_resource_test.ccrewritten for the new shape(17 cases total, all green). Type discrimination uses a
TestDetectorVisitorthat implements the visitor interface, so the suite compiles under
-fno-rtti(Bazel nortti CI).detection/development:blockattributes(included+excluded)The 5 old tests parsing the deprecated
detectors.included/excludedshapewere removed (no longer matches the spec and the field no longer exists).
Verification
Built with
WITH_CONFIGURATION=ON(Release, Ninja). All three YAML testbinaries pass with no regressions:
yaml_test: 50/50yaml_resource_test: 17/17yaml_propagator_test: 9/9Also built with
-DCMAKE_CXX_FLAGS=-fno-rtti(reproducing the Bazelnortti CI environment):
yaml_resource_test17/17.End-to-end load of
examples/configuration/kitchen-sink.yamlviaexample_yaml --yaml ... --testreportsMODEL PARSED, confirming thefull spec-shaped block (
detection/developmentwith nestedattributesand all 4 standard detectors) parses without error.