ncabatoff / process-exporter

Prometheus exporter that mines /proc to report on selected processes
MIT License
1.67k stars 265 forks source link

tracker: fix ignoring with -children=false #297

Open hoffie opened 4 months ago

hoffie commented 4 months ago

The code path for -children=false failed to ignore unmatched processes as that logic was only triggered from checkAncestry(), which isn't called in that case.

Properly ignore all unmatched processes when using -children=false.

I've discovered this while tracking down performance problems and thought that -children=false should lead to better performance. However, it didn't, because process-exporter continuously kept gathering full metrics (status, io, tasks) from unrelated processes such as PID 1.

ncabatoff commented 4 months ago

Hi @hoffie,

Thanks for the PR! Any chance you'd like to write a test to validate the fix?