Log duration of ProcessBookkeepingService#execute
What does this MR do?
At present there is no easy way to correlate the time taken to the number of records being processed. We can see log statements when it starts, when it ends as well as the corresponding sidekiq logs but the logs containing the counts don't contain the duration so it would be really tricky to use correlation_id to match things up and figure out the duration.
This will make it easy to plot the bulk_execution_duration
vs. records_count
in Kibana and therefore allow us to make some predictions about whether or not we can scale up the records_count
.
This related to a previous conversation in !28511 (comment 323151440) .
We'd probably like to add even more metadata to these log statements so we can understand DB time, CPU time etc but I wanted to make the smallest change first.
That being said I would love to know if there is a better way of orchestrating this method so that I can get a log statement with all the metadata I want. Particularly I just want a single log with the records_count
then all other instrumentation diagnostics we get from normal sidekiq logs (like db_duration and others). Perhaps there may be some way to do this if my class can somehow call out and inject extra metadata into the Gitlab::SidekiqLogging::StructuredLogger
but I couldn't find any way to do that looking at the code.
Screenshots
Does this MR meet the acceptance criteria?
Conformity
-
Changelog entry -
Documentation (if required) -
Code review guidelines -
Merge request performance guidelines -
Style guides -
Database guides -
Separation of EE specific content
Availability and Testing
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process. -
Tested in all supported browsers -
Informed Infrastructure department of a default or new setting change, if applicable per definition of done
Security
If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:
-
Label as security and @ mention @gitlab-com/gl-security/appsec
-
The MR includes necessary changes to maintain consistency between UI, API, email, or other methods -
Security reports checked/validated by a reviewer from the AppSec team