Feature: Encode task and instance-id in thread-name to help debugging
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.
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..
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 .
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 :)
Suggested thread-name format: db-scheduler-pool-1-thread-3_<task-name>_<instance-id>
Do you need the "pool-1"? Do you use multiple task executions pools?
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.
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