Add throttle option for logging#14
Conversation
| LOGGING_TOPIC = 'flexbe/log' | ||
|
|
||
| # max number of items in last logged dict (used for log_throttle) | ||
| MAX_LAST_LOGGED_SIZE = 1024 |
There was a problem hiding this comment.
Any good idea on how to make that size configurable?
| Logger.log(text, severity) | ||
| Logger._last_logged.update({log_id: rospy.Time.now()}) | ||
|
|
||
| if len(Logger._last_logged) > Logger.MAX_LAST_LOGGED_SIZE: |
There was a problem hiding this comment.
Once we hit limit this will process every message following.
Should we consider throwing away the oldest half of messages, otherwise i fear this limit will become a limiting factor given need to sort and pop when adding a single new message.
There was a problem hiding this comment.
You're right, although this would only occur under the circumstance that we have more than 1024 log_throttles and it would only happen when a changing message is logged.
But I agree, that we don't want to have that overhead. I'll change the clearing to a percentage to the MAX_LAST_LOGGED_SIZE 👍
|
@dcconner anything else you need here? |
|
Just time. Traveling now over break, but I hope to get some time after new years |
|
@dcconner sorry to bother you, but I just realised, that the PR is still open :) |
|
" some time after new years" is a broad statement ;-) Unfortunately I have not had time to test this myself as I'm teaching a new course. Our semester ends in early May, and I do intend to devote time in May to getting code ready for an Iron update and new release. So, if I haven't merged this by the end of May then you should yell at me. |
|
@HannesBachter Do you have a simple test behavior for this change? |
|
incorporated into humble, iron, rolling, and ros2-devel branches |
adds the option to use
Logger.log*_throttle(same as team-vigir/flexbe_behavior_engine#166)