db-scheduler icon indicating copy to clipboard operation
db-scheduler copied to clipboard

Feature: Encode task and instance-id in thread-name to help debugging

Open tomaszglinski opened this issue 7 years ago • 7 comments

Since I was also working on my own scheduler, I found that post with few quite good tips. http://www.nurkiewicz.com/2014/11/executorservice-10-tips-and-tricks.html

One of them was to name Threads so that later on undertanding the logs and debugging is much easier.

tomaszglinski avatar Mar 22 '18 11:03 tomaszglinski

Thanks for the tips!

Currently the schedulerName is set as a prefix to the threads. What additional data would you like in the thread-names? TaskInstance: <taskName>_<id> might be a good idea..

kagkarlsson avatar Mar 22 '18 14:03 kagkarlsson

Yes, that would be very good, but name and id should be then cleaned. Not sure how long should be the names, usually log files truncate it to quite short length.

2018-03-22 15:27 GMT+01:00 Gustav Karlsson [email protected]:

Thanks for the tips!

Currently the schedulerName is set as a prefix to the threads. What additional data would you like in the thread-names? TaskInstance: <taskName>_ might be a good idea..

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/kagkarlsson/db-scheduler/issues/23#issuecomment-375325337, or mute the thread https://github.com/notifications/unsubscribe-auth/AISmD6p9d3ifvSVgflSVJVPK3G79-piIks5tg7S3gaJpZM4S25xI .

tomaszglinski avatar Mar 22 '18 16:03 tomaszglinski

I have since renamed the scheduler threads, removing the SchedulerName as prefix, and hard-coded it to db-scheduler-. I suppose this should be added in the ExecuteTask class. Pull-requests are welcome :)

kagkarlsson avatar Apr 12 '18 19:04 kagkarlsson

Suggested thread-name format: db-scheduler-pool-1-thread-3_<task-name>_<instance-id>

kagkarlsson avatar Apr 12 '18 19:04 kagkarlsson

Do you need the "pool-1"? Do you use multiple task executions pools?

tomaszglinski avatar Apr 13 '18 09:04 tomaszglinski

Hmm, maybe you are right, it's unnecessary. Thread-names will be unique anyway. However I have 3 threadpools, so I have a different prefix for those.

What about: db-scheduler-execute-due_<task-name>_<instance-id>

What is max length of a thread-name? Should probably check and possibly truncate if necessary.

kagkarlsson avatar Apr 13 '18 10:04 kagkarlsson

From what I can tell there are no limits to the length or if it is its much greater than what we will need. See test and output at this commit in my fork.

https://github.com/zendern/db-scheduler/commit/b16f317be09f7278bc2695f09ffe50108506d44b

zendern avatar May 10 '21 13:05 zendern