-
Notifications
You must be signed in to change notification settings - Fork 74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Log Sidekiq worker arguments #3386
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Its super great! I remember looking into this and seeing that a big monkey patch is required so I left it for later :)
Can we have a test case to make sure we don't break the log after sidekiq upgrade?
Here's an example test case for log messages:
https://github.com/3scale/porta/pull/3355/files#diff-e72e319062abc990bd308af9f5f03883c4ea52673979e0818fc8b1282d189493
Well, the thing is - we will for sure break it after sidekiq upgrade 🙃 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
I added a skeleton of a test. It only needs some logic to ignore uninteresting messages and validate the messages we care about. The thing is that I believe we need to handle ActiveJob workers better. Presently the log for such worker looks like this (I've got the string when running the skeleton test as an error, because this message string is unhandled)
I don't have time to work on this more this week as I will be out of office Thursday and Friday. So leaving it here for now. |
@akostadinov Thanks for looking at it! I've updated the test here: fedcd2b I guess that was your intention? I picked a different worker, because But here is the thing - these logs ( Also, the server middleware doesn't use |
@akostadinov what about that ActiveJob log?... I think it's OK. |
Some thoughts: First, I'm concerned about the logs size after this change, The This is before this PR:
And this is the same log after checking out this branch:
I think we should add a release note to warn customers that their logs are going to increase much faster. So they will need to update their log rotation policies and either provide more storage or keep the logs less time. On the other hand, if collectiveidea/audited#674 gets implemented, we'll have truncated logs that could not be useful. In fact I wonder if it's worth to log the parameters for Would it be hard to exclude some particular Workers from auditing arguments? |
I remember seeing in the past that wrapped jobs (active job workers) has a special logging not to be that ugly but maybe not everywhere. ok. Good point @jlledom , maybe we need to limit log message size. We can have audit messages to be huge. And in fact, if we log all parameters, then there is no point to actually put the audit in the audits table... |
Actually, we need to review the "Enqueue" logs as well. For example, here is what we get in the logs a lot:
Basically, printing out all of the Account class attributes 🙃 which, I think, is completely useless. |
Maybe another option is to log the stuff we specifically care about and divert to |
That's a great point @jlledom ! I think we can truncate the args array for all workers. Or as you say maybe exclude some workers. |
My vote is to custom log specific workers and |
This PR is stale because it has not received activity for more than 14 days. Remove stale label or comment or this will be closed in 7 days. |
Adds more logging to Sidekiq, printing the arguments passed to the worker's
perform
method.Compare before:
and after: