Name all daemons
What does this MR do?
It was previously difficult to see what's running in a process
in e.g. pstree
, since all threads spawned from a Daemon
are unnamed and appear as dameon.rb:23
. I therefore added
a thread_name
method that has a sane default (snake case class name)
and can be overridden if desired.
Here is how pstree -apgt
now looks like for sidekiq:
│ │ ├─runsv,28330,28330 rails-background-jobs
│ │ │ ├─bundle,8223,8223 ...
│ │ │ │ ├─{base_reliable_*},8452,8223
│ │ │ │ ├─{connection_poo*},8393,8223
│ │ │ │ ├─{connection_poo*},8453,8223
│ │ │ │ ├─{connection_poo*},8455,8223
│ │ │ │ ├─{connection_poo*},8456,8223
│ │ │ │ ├─{influx_sampler},8458,8223
│ │ │ │ ├─{memory_killer},8544,8223
│ │ │ │ ├─{memory_killer},8703,8223
│ │ │ │ ├─{popen.rb:41},8704,8223
│ │ │ │ ├─{popen.rb:42},8705,8223
│ │ │ │ ├─{remote_reporte*},8457,8223
│ │ │ │ ├─{ruby_sampler},8450,8223
│ │ │ │ ├─{util.rb:23},8538,8223
│ │ │ │ ├─{util.rb:23},8545,8223
│ │ │ │ ├─{util.rb:23},8546,8223
│ │ │ │ ├─{util.rb:23},8547,8223
│ │ │ │ ├─{util.rb:23},8548,8223
│ │ │ │ ├─{util.rb:23},8549,8223
│ │ │ │ ├─{util.rb:23},8550,8223
i.e. the MemoryKiller
, RubySampler
and InfluxSampler
threads now properly identify themselves. Additionally we could append the TID as well?
Closes #35413 (closed)
Does this MR meet the acceptance criteria?
Conformity
Edited by 🤖 GitLab Bot 🤖