Add required and recommended attributes - #4437
Open
LevelVoid wants to merge 13 commits into
Open
Conversation
dbarker
reviewed
Aug 18, 2026
dbarker
left a comment
Member
There was a problem hiding this comment.
Thanks for the PR! Please see feedback below.
…o with other minor changes
Author
|
@dbarker Thanks for the review and feedback! I've made the changes
|
dbarker
reviewed
Aug 18, 2026
There was a problem hiding this comment.
Pull request overview
Adds missing required/recommended Process Entity and Process Executable Entity semantic convention attributes to the Process Resource Detector, with supporting utilities, tests, and documentation updates.
Changes:
- Extends process detection to populate
process.creation.time,process.owner,process.executable.build_id.htlhash, andprocess.executable.name(when available). - Refactors executable discovery utility to return both path + basename, and adds utilities for creation time / owner / deterministic build ID.
- Adds unit + integration-style tests and updates the resource detector README and header docstrings accordingly.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| resource_detectors/test/process_detector_test.cc | Adds new utility tests and an integration test asserting expected resource attributes are present. |
| resource_detectors/src/process_detector.cc | Populates the new process attributes in Detect() using the new utility APIs. |
| resource_detectors/src/process_detector_utils.cc | Implements executable info, creation time, owner lookup, and htlhash build ID computation. |
| resource_detectors/README.md | Documents added attributes and platform limitations (notably macOS executable info). |
| resource_detectors/include/opentelemetry/resource_detectors/process_detector.h | Updates public detector documentation to describe newly populated attributes. |
| resource_detectors/include/opentelemetry/resource_detectors/detail/process_detector_utils.h | Declares new utility APIs (ExecutableInfo, creation time, owner, htlhash, SHA-256 helper). |
Suppressed comments (1)
resource_detectors/include/opentelemetry/resource_detectors/detail/process_detector_utils.h:81
- GetProcessOwner() has no pid parameter, but the doc comment includes an
@parampid entry. This is confusing for users of this header (even under detail/).
*
* @param pid Process ID.
*/
std::string GetProcessOwner();
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
6
to
21
| #include <fstream> | ||
| #include <string> | ||
| #include <vector> | ||
|
|
||
| #ifdef _MSC_VER | ||
| // clang-format off | ||
| # include <windows.h> | ||
| # include <psapi.h> | ||
| # include <shellapi.h> | ||
| # pragma comment(lib, "shell32.lib") | ||
| // clang-format on | ||
| #else | ||
| # include <sys/types.h> | ||
| # include <unistd.h> | ||
| # include <cstdio> | ||
| #endif |
Comment on lines
+34
to
37
| * Retrieves the absolute file system path and the base name of the process executable. | ||
| * Platform-specific behavior: | ||
| * - Windows: Uses OpenProcess() + GetProcessImageFileNameW(). | ||
| * - Linux/Unix: Reads the /proc/<pid>/exe symbolic link. |
Comment on lines
63
to
+68
| // Convert UTF-16 to UTF-8 | ||
| int size_needed = WideCharToMultiByte(CP_UTF8, 0, wbuffer, len, NULL, 0, NULL, NULL); | ||
| std::string utf8_path(size_needed, 0); | ||
| WideCharToMultiByte(CP_UTF8, 0, wbuffer, len, &utf8_path[0], size_needed, NULL, NULL); | ||
|
|
||
| return utf8_path; | ||
| info.path = utf8_path; |
Comment on lines
+548
to
+555
| std::ifstream f(exe_path, std::ios::binary | std::ios::ate); | ||
| if (!f.is_open()) | ||
| { | ||
| return std::string(); | ||
| } | ||
|
|
||
| auto file_size = static_cast<std::uint64_t>(f.tellg()); | ||
|
|
Comment on lines
+114
to
115
| std::string expected_path = opentelemetry::resource_detector::detail::GetExecutableInfo(pid).path; | ||
| EXPECT_EQ(path, expected_path); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #4436
Changes
process.creation.time,process.owner,process.executable.build_id.htlhashandprocess.executable.namewith declaration inresource_detectors/include/opentelemetry/resource_detectors/detail/process_detector_utils.hand implementation inresource_detectors/src/process_detector_utils.cc.resource_detectors/src/process_detector.cc.resource_detectors/test/process_detector_test.cc.Please provide a brief description of the changes here.
For significant contributions please make sure you have completed the following items:
CHANGELOG.mdupdated for non-trivial changes