-
Notifications
You must be signed in to change notification settings - Fork 494
[SDK] Implementation of container resource as per semconv #3572
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
[SDK] Implementation of container resource as per semconv #3572
Conversation
|
✅ Deploy Preview for opentelemetry-cpp-api-docs canceled.
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3572 +/- ##
==========================================
+ Coverage 90.03% 90.08% +0.06%
==========================================
Files 220 222 +2
Lines 7069 7115 +46
==========================================
+ Hits 6364 6409 +45
- Misses 705 706 +1
🚀 New features to boost your workflow:
|
…hilbhatia08/opentelemetry-cpp into implement_resource_detectors
Thanks for the PR @nikhilbhatia08! I think we just need to hash out how best to include these "built-in" detectors in the repo/build systems since many will bring platform dependencies. I've posted my proposal to the initial issue thread. |
hello changes some changes
…hilbhatia08/opentelemetry-cpp into implement_resource_detectors
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR implements a container resource detector that extracts container IDs from cgroup information to comply with OpenTelemetry semantic conventions. The implementation focuses specifically on detecting the container.id
attribute by parsing /proc/self/cgroup
files.
- Adds a new
ContainerResourceDetector
class that reads container ID from cgroup files - Implements helper functions for parsing container IDs from cgroup file lines using regex
- Adds comprehensive test coverage for container ID extraction logic
Reviewed Changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
resource_detectors/include/opentelemetry/resource_detectors/container_resource_detector.h | Header file defining the ContainerResourceDetector class and helper functions |
resource_detectors/container_detector.cc | Implementation of the ContainerResourceDetector::Detect() method |
resource_detectors/container.cc | Implementation of container ID extraction logic from cgroup files |
resource_detectors/CMakeLists.txt | CMake configuration for the new resource_detectors library |
resource_detectors/BUILD | Bazel build configuration for the resource_detectors library |
sdk/test/resource/resource_test.cc | Test cases for container ID extraction functionality |
sdk/test/resource/CMakeLists.txt | Updated test dependencies to include resource_detectors |
sdk/test/resource/BUILD | Updated Bazel test dependencies |
sdk/src/resource/resource_detector.cc | Refactored environment variable constants to use constexpr |
CMakeLists.txt | Added resource_detectors subdirectory to build |
resource_detectors/include/opentelemetry/resource_detectors/container_resource_detector.h
Outdated
Show resolved
Hide resolved
resource_detectors/include/opentelemetry/resource_detectors/container_resource_detector.h
Outdated
Show resolved
Hide resolved
resource_detectors/include/opentelemetry/resource_detectors/container_resource_detector.h
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, once preview flag is added and approved by @dbarker. Thanks @nikhilbhatia08 for contribution, nice work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Thanks for the PR. Congrats on your first contribution! Looking forward to the next one :)
Thank you so much, @dbarker, @lalitb, and @rafaelroquetto, for helping me with my first contribution! Really appreciate it :) Looking forward to contributing more. |
Fixes # (issue)
Partially fixes #3548
Changes
Added container resource detector only for collecting info about
container.id
from/proc/self/cgroup
and added test coverage to it, but could not add test coverage toDetect()
of ContainerResourcePlease 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