-
Notifications
You must be signed in to change notification settings - Fork 500
[resource_detectors] implementation of process resource detector as per semconv #3591
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
[resource_detectors] implementation of process resource detector as per semconv #3591
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 #3591 +/- ##
=======================================
Coverage 90.03% 90.03%
=======================================
Files 220 220
Lines 7069 7069
=======================================
Hits 6364 6364
Misses 705 705 🚀 New features to boost your workflow:
|
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 process resource detector for OpenTelemetry that extracts process-related attributes according to semantic conventions. It adds functionality to detect process ID, executable path, and command line information for the current process.
- Adds ProcessResourceDetector class that implements the ResourceDetector interface
- Implements utility functions for cross-platform process information extraction (Windows/Unix)
- Provides comprehensive test coverage for the new functionality
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 7 comments.
Show a summary per file
File | Description |
---|---|
resource_detectors/include/opentelemetry/resource_detectors/process_detector.h | Defines the ProcessResourceDetector class interface |
resource_detectors/include/opentelemetry/resource_detectors/process_detector_utils.h | Declares utility functions for process information extraction |
resource_detectors/process_detector.cc | Implements the main ProcessResourceDetector functionality |
resource_detectors/process_detector_utils.cc | Implements cross-platform process information extraction utilities |
resource_detectors/test/process_detector_test.cc | Adds unit tests for the process detector utilities |
resource_detectors/test/CMakeLists.txt | Updates test build configuration to include new test file |
resource_detectors/test/BUILD | Updates Bazel build configuration for tests |
resource_detectors/CMakeLists.txt | Updates library build configuration to include new source files |
resource_detectors/BUILD | Updates Bazel build configuration for the library |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
resource_detectors/include/opentelemetry/resource_detectors/process_detector_utils.h
Outdated
Show resolved
Hide resolved
resource_detectors/include/opentelemetry/resource_detectors/process_detector_utils.h
Outdated
Show resolved
Hide resolved
resource_detectors/include/opentelemetry/resource_detectors/process_detector_utils.h
Outdated
Show resolved
Hide resolved
resource_detectors/include/opentelemetry/resource_detectors/process_detector_utils.h
Outdated
Show resolved
Hide resolved
The tests on the latest commit fail because psapi.h is included first and then windows.h, but if we try to include windows.h first and then include psapi.h then it would fail the format test. What can be done for this any suggestions ? |
What is the format error? You switch off the clang/iwyu check for that portion of the include, depending on the error you are getting. |
If I run format of ci then I'm getting this error
So if I include psapi.h first and then windows.h, the windows.h header redefines some macros present in psapi.h, that is why windows.h should be included first, but doing so gives the above format error. But now I got how to disable the format error for this part of code. Thanks 👍🏻 ! |
Thanks for the PR! Please see comments above. |
For the tests added now and resource detectors tests in general we need to enable the tests |
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!
resource_detectors/include/opentelemetry/resource_detectors/detail/process_detector_utils.h
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.
PR looks good, just requesting change for this - as it can lead to crash.
Fixes # (issue)
Changes
Implements process detector currently for attributes - [process.pid, process.executable.path, process.command], the next pull request will implement more of the process attributes. Added tests.
reference - https://github.com/open-telemetry/semantic-conventions/blob/main/docs/resource/process.md#selecting-process-attributes
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