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

Trim or warn about process names longer than 15 characters #33

Closed
Impact123 opened this issue Jul 1, 2024 · 1 comment · Fixed by #35
Closed

Trim or warn about process names longer than 15 characters #33

Impact123 opened this issue Jul 1, 2024 · 1 comment · Fixed by #35

Comments

@Impact123
Copy link

I ran into this when trying to monitor VictoriaMetrics. See process name here: https://docs.victoriametrics.com/#production-build
fatrace --command=victoria-metrics-prod will result in no output.
It only works if you use the name victoria-metric. Too long names should either be trimmed or warned about. Maybe both.
fatrace on its own shows the name as victoria-metric but it's very unintuitive to have to keep the length in mind or check first.
Perhaps there is also a way to "just" make the full name work?

martinpitt added a commit that referenced this issue Jan 19, 2025
/proc/pid/comm is at most 15 characters (plus NUL), so specifying a
longer `--command` value will never match. Truncate it to the maximum
and warn about it.

Note that the manpage speaks about `TASK_COMM_LEN`, but that isn't
defined anywhere. So define it ourselves.

Fixes #33

[1] https://man7.org/linux/man-pages/man5/proc_pid_comm.5.html
@martinpitt
Copy link
Owner

Hello @Impact123 Yes, let's just make longer names work. With #35 the value will be truncated for comparison, and it will print out a warning. E. g. --command VeryLongTouchCommand will say

fatrace: --command truncated to 15 characters: VeryLongTouchCo

martinpitt added a commit that referenced this issue Jan 19, 2025
/proc/pid/comm is at most 15 characters (plus NUL), so specifying a
longer `--command` value will never match. Truncate it to the maximum
and warn about it.

Note that the manpage speaks about `TASK_COMM_LEN`, but that isn't
defined anywhere. So define it ourselves.

Fixes #33

[1] https://man7.org/linux/man-pages/man5/proc_pid_comm.5.html
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 a pull request may close this issue.

2 participants