Skip to content

Reorder Sidekiq client middleware

Bob Van Landuyt requested to merge bvl-reorder-sidekiq-client-middleware into master

What does this MR do?

The new order is as follows:

  1. ::Gitlab::SidekiqMiddleware::WorkerContext::Client: Context for batch jobs
  2. ::Labkit::Middleware::Sidekiq::Client: Serialize the context into the job hash
  3. ::Gitlab::SidekiqMiddleware::DuplicateJobs::Client: Drop the job if needed
  4. ::Gitlab::SidekiqStatus::ClientMiddleware: Keep track of the status of the job
  5. ::Gitlab::SidekiqMiddleware::AdminMode::Client: Run the job with elevated permissions or not
  6. ::Gitlab::SidekiqMiddleware::ClientMetrics: Count the enqueued job

This makes sure we add the logging information in the beginning of the chain, as it could be needed for log messages coming form the other middlewares.

Next we're doing deduplication, so we can skip any other work that might not be needed.

The last step are the metrics, which counts enqueued jobs, this makes sure that if anything happens in the chain, we don't count an enqueued job. If that middleware is before the deduplication, count jobs that might be dropped as enqueued.

gitlab-com/gl-infra/scalability#268 (closed)

Screenshots

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Edited by Bob Van Landuyt

Merge request reports