Skip to content

[CONFIGURATION] File configuration - resource detectors#4113

Open
rishitha957 wants to merge 2 commits into
open-telemetry:mainfrom
rishitha957:container-resource-detector
Open

[CONFIGURATION] File configuration - resource detectors#4113
rishitha957 wants to merge 2 commits into
open-telemetry:mainfrom
rishitha957:container-resource-detector

Conversation

@rishitha957
Copy link
Copy Markdown
Contributor

@rishitha957 rishitha957 commented Jun 1, 2026

Fixes #3916

Changes

Please provide a brief description of the changes here.

For significant contributions please make sure you have completed the following items:

  • CHANGELOG.md updated for non-trivial changes
  • Unit tests have been added
  • Changes in public API reviewed

Signed-off-by: Rishitha Kalicheti <rkalicheti1@bloomberg.net>
@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 1, 2026

Codecov Report

❌ Patch coverage is 5.26316% with 36 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.77%. Comparing base (d2f09f1) to head (d905dfa).

Files with missing lines Patch % Lines
sdk/src/configuration/configuration_parser.cc 6.25% 30 Missing ⚠️
...ration/container_resource_detector_configuration.h 0.00% 2 Missing ⚠️
...ration/extension_resource_detector_configuration.h 0.00% 2 Missing ⚠️
...dk/configuration/resource_detector_configuration.h 0.00% 2 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #4113      +/-   ##
==========================================
- Coverage   81.95%   81.77%   -0.18%     
==========================================
  Files         385      388       +3     
  Lines       16067    16105      +38     
==========================================
+ Hits        13166    13168       +2     
- Misses       2901     2937      +36     
Files with missing lines Coverage Δ
...ration/container_resource_detector_configuration.h 0.00% <0.00%> (ø)
...ration/extension_resource_detector_configuration.h 0.00% <0.00%> (ø)
...dk/configuration/resource_detector_configuration.h 0.00% <0.00%> (ø)
sdk/src/configuration/configuration_parser.cc 74.51% <6.25%> (-1.63%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@marcalff marcalff changed the title adding file config - resource detectors [CONFIGURATION] File configuration - resource detectors Jun 5, 2026
Copy link
Copy Markdown
Member

@marcalff marcalff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the draft.

This looks good so far and has a very good structure.

Please add unit tests for resource detection, it will help to make progress.

public:
std::unique_ptr<AttributesConfiguration> attributes;
std::unique_ptr<IncludeExcludeConfiguration> detectors;
std::unique_ptr<ResourceDetectionConfiguration> detection;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New member detection looks ok.

Please remove the existing member detectors, it was misplaced and does not comply with the yaml schema.

Comment on lines +2566 to +2581
for (auto it = node->begin_properties(); it != node->end_properties(); ++it)
{
std::string name = it.Name();

if (name == "container")
{
return std::make_unique<ContainerResourceDetectorConfiguration>();
}
else
{
auto extension = std::make_unique<ExtensionResourceDetectorConfiguration>();
extension->name = name;
extension->node = it.Value();
return extension;
}
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is weird to have a for loop and return from the middle of it.

Please check for example ConfigurationParser::ParseLogRecordProcessorConfiguration() for the pattern.

@marcalff
Copy link
Copy Markdown
Member

marcalff commented Jun 5, 2026

Current IWYU failure in CI:

Warning: include-what-you-use reported diagnostics:

/home/runner/work/opentelemetry-cpp/opentelemetry-cpp/sdk/src/configuration/sdk_builder.cc should add these lines:

/home/runner/work/opentelemetry-cpp/opentelemetry-cpp/sdk/src/configuration/sdk_builder.cc should remove these lines:
- #include "opentelemetry/sdk/configuration/container_resource_detector_configuration.h"  // lines 112-112

@marcalff
Copy link
Copy Markdown
Member

marcalff commented Jun 5, 2026

@rishitha957

Thanks for the PR.

Setting as ready for review, please check my comments.

@marcalff marcalff marked this pull request as ready for review June 5, 2026 22:34
@marcalff marcalff requested a review from a team as a code owner June 5, 2026 22:34
@marcalff marcalff self-assigned this Jun 5, 2026
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.

[CONFIGURATION] File configuration - resource detectors

2 participants