Skip to content

[CONFIGURATION] Add a resource detector extension example - #4423

Merged
dbarker merged 5 commits into
open-telemetry:mainfrom
mateenali66:feat/4419-detector-extension-example
Aug 13, 2026
Merged

[CONFIGURATION] Add a resource detector extension example#4423
dbarker merged 5 commits into
open-telemetry:mainfrom
mateenali66:feat/4419-detector-extension-example

Conversation

@mateenali66

Copy link
Copy Markdown
Member

Fixes #4419

Changes

Adds CustomResourceDetector and CustomResourceDetectorBuilder to examples/configuration, mirroring the other Custom* extension skeletons (comment property read from yaml, YOUR CODE HERE placeholder in Detect()). The builder registers under my_custom_detector via Registry::SetExtensionResourceDetectorBuilder, matching the entry that already exists in extensions.yaml, whose placeholder comment now points at the implementation.

As noted on the issue, the configured SDK will not build the detector until #4411 lands; this only provides the extension point wiring.

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: Mateen Anjum <mateenali66@gmail.com>
@mateenali66
mateenali66 requested a review from a team as a code owner August 13, 2026 07:57
@codecov

codecov Bot commented Aug 13, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.58%. Comparing base (cb17c27) to head (77de6a7).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #4423      +/-   ##
==========================================
- Coverage   82.59%   82.58%   -0.00%     
==========================================
  Files         511      511              
  Lines       20039    20039              
==========================================
- Hits        16550    16548       -2     
- Misses       3489     3491       +2     

see 1 file with indirect coverage changes

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

Signed-off-by: Mateen Anjum <mateenali66@gmail.com>

@dbarker dbarker left a comment

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.

Looks good. Thank you! Please see non blocking feedback below.

opentelemetry::sdk::resource::Resource CustomResourceDetector::Detect() noexcept
{
OTEL_INTERNAL_LOG_ERROR("CustomResourceDetector::Detect(): YOUR CODE HERE");
return ResourceDetector::Create({});

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.

Consider adding the parsed comment as an attribute value :)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

done in the latest commit, Detect() now returns the parsed comment as custom.comment.

mateenali66 and others added 3 commits August 13, 2026 10:13
… example

Signed-off-by: Mateen Anjum <mateenali66@gmail.com>
Signed-off-by: Mateen Anjum <mateenali66@gmail.com>
@dbarker
dbarker merged commit c35254a into open-telemetry:main Aug 13, 2026
73 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.

[CONFIGURATION] Resource detector extension example

3 participants