Skip to content
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

Send process name as process.executable.name (/proc/PID/comm) #298

Merged
merged 2 commits into from
Jan 9, 2025

Conversation

christos68k
Copy link
Member

@christos68k christos68k commented Jan 6, 2025

Summary

This PR adds support for sending process name as process.executable.name, abiding by current OTel semantics for that key. Instead of Name in /prod/PID/status as semconv dictates, I'm using /proc/PID/comm which contains the same value and is simpler to parse.

Regarding these semantics, I also started a discussion in semconv WG to improve clarity as process.executable.name is misleading/confusing/wrong depending on interpretation so we may end up changing the key in the future.

@christos68k christos68k requested review from a team as code owners January 6, 2025 20:37
@christos68k christos68k marked this pull request as draft January 6, 2025 20:37
@christos68k christos68k marked this pull request as ready for review January 7, 2025 22:02
@@ -641,6 +646,19 @@ func (pm *ProcessManager) CleanupPIDs() {
}
}

// NameForPID returns the process name for given PID.
Copy link
Member Author

@christos68k christos68k Jan 7, 2025

Choose a reason for hiding this comment

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

Depending on how we go about solving #278, we may move these (process name, executable path) somewhere else. For now, I left them as processInfo attributes.

@@ -48,7 +48,8 @@ type Frame struct {

type Trace struct {
Comm string
Executable string
ProcessName string
Copy link
Contributor

Choose a reason for hiding this comment

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

With this change there are two fields with roughly the same information. Comm originates from the eBPF space and is fetched with the helper bpf_get_current_comm() and ProcessName is fetched from procfs via /prod/%d/comm.
To some degree this is duplicate information - ignoring for the moment all the events that can change these values and cause differences in them.
Going forward, I think there should be either Comm or ProcessName but not both. If both fields should be kept, what is the point they bring in that makes them valuable?

Copy link
Member Author

@christos68k christos68k Jan 8, 2025

Choose a reason for hiding this comment

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

It's not the same information: Comm retrieved in the kernel is the thread name and /proc/PID/comm is the process name, they're sent to the backend under different keys.

The value they bring is more flexible aggregations: executable, process, thread. Why pick one or the other?

Copy link
Contributor

@florianl florianl Jan 9, 2025

Choose a reason for hiding this comment

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

Both values are kind of metadata to me and I'm wondering if there is something in OTel that enriches metadata based on a PID. The value from bpf_get_current_comm() might not be available to a OTel metadata enricher, but the rest should be. So overall, I'm thinking more about what components are the key functionality of profiling vs what enrichment can be added by other components.

Copy link
Member Author

Choose a reason for hiding this comment

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

The reason we want to do this particular enrichment here that depends on process lifetime is because we're in full control of the metadata (process name, executable name) that is thrown away on process exit and can guarantee their availability (after we fix #278).

@christos68k christos68k merged commit e113282 into main Jan 9, 2025
23 checks passed
@christos68k christos68k deleted the ck/process-name branch January 9, 2025 14:48
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.

3 participants