Skip to content

[SDK] enable deriving from ResourceDetector to create a Resource #3247

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jan 16, 2025

Conversation

dbarker
Copy link
Contributor

@dbarker dbarker commented Jan 16, 2025

Allow derived classes from ResourceDetector to create a resource.

Fixes #3246

Changes

  • Makes ResourceDetector a friend of Resource (replacing OTELResourceDetector)
  • Adds a protected Create method to ResourceDetector that calls the constructor of Resource
  • Adds test case for a derived resource detector

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

Sorry, something went wrong.

…eate method
@dbarker dbarker requested a review from a team as a code owner January 16, 2025 16:25
Copy link

netlify bot commented Jan 16, 2025

Deploy Preview for opentelemetry-cpp-api-docs canceled.

Name Link
🔨 Latest commit 414b4e3
🔍 Latest deploy log https://app.netlify.com/sites/opentelemetry-cpp-api-docs/deploys/678937ccca94da00080a73ce

@dbarker dbarker changed the title make ResourceDetector a friend of Resource and provide a protected cr… [SDK] enable deriving from ResourceDetector to create a Resource Jan 16, 2025
Copy link
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.

LGTM, thanks for the fix.

@marcalff marcalff merged commit 02cda51 into open-telemetry:main Jan 16, 2025
56 checks passed
Copy link

codecov bot commented Jan 16, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 87.71%. Comparing base (465cb4a) to head (414b4e3).
Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3247      +/-   ##
==========================================
+ Coverage   87.71%   87.71%   +0.01%     
==========================================
  Files         198      198              
  Lines        6271     6273       +2     
==========================================
+ Hits         5500     5502       +2     
  Misses        771      771              
Files with missing lines Coverage Δ
sdk/include/opentelemetry/sdk/resource/resource.h 100.00% <ø> (ø)
...ude/opentelemetry/sdk/resource/resource_detector.h 100.00% <ø> (ø)
sdk/src/resource/resource_detector.cc 100.00% <100.00%> (ø)

malkia added a commit to malkia/opentelemetry-cpp that referenced this pull request Jan 16, 2025
[SDK] enable deriving from ResourceDetector to create a Resource (open-telemetry#3247)
@dbarker dbarker deleted the fix_resource_detector_access branch March 31, 2025 16:16
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.

Unable to derive from ResourceDetector and create a Resource
2 participants