Commit 0ee1bc8a authored by Sean McGivern's avatar Sean McGivern

Do not log explicit Gitlab::SidekiqStatus.set calls

We have a feature flag - log_implicit_sidekiq_status_calls - that will
log any calls to check the Sidekiq status of a job that had its status
set in Redis implicitly. By implicitly, we mean that the job class
itself did not opt-in to this with `sidekiq_options`, and that the
caller didn't use `with_status`. In the case where the status check was
requested up-front, we set a different value in Redis (2, rather than
the default of 1) in our Sidekiq client middleware.

There was a case I missed, however: not all job status values are
written by the client middleware! There are two cases where we call
`Gitlab::SidekiqStatus.set` explicitly, and those should also be treated
as having opted in for the purposes of logging. So here we set their
values to 2 as well.
parent b5848df6
......@@ -15,7 +15,7 @@ module ImportState
def refresh_jid_expiration
return unless jid
Gitlab::SidekiqStatus.set(jid, Gitlab::Import::StuckImportJob::IMPORT_JOBS_EXPIRATION)
Gitlab::SidekiqStatus.set(jid, Gitlab::Import::StuckImportJob::IMPORT_JOBS_EXPIRATION, value: 2)
end
def self.jid_by(project_id:, status:)
......
......@@ -13,7 +13,7 @@ module Gitlab
def self.set_jid(import_state)
jid = generate_jid(import_state)
Gitlab::SidekiqStatus.set(jid, Gitlab::Import::StuckImportJob::IMPORT_JOBS_EXPIRATION)
Gitlab::SidekiqStatus.set(jid, Gitlab::Import::StuckImportJob::IMPORT_JOBS_EXPIRATION, value: 2)
import_state.update_column(:jid, jid)
end
......
......@@ -8,7 +8,7 @@ RSpec.describe Gitlab::Import::SetAsyncJid do
it 'sets the JID in Redis' do
expect(Gitlab::SidekiqStatus)
.to receive(:set)
.with("async-import/project-import-state/#{project.id}", Gitlab::Import::StuckImportJob::IMPORT_JOBS_EXPIRATION)
.with("async-import/project-import-state/#{project.id}", Gitlab::Import::StuckImportJob::IMPORT_JOBS_EXPIRATION, value: 2)
.and_call_original
described_class.set_jid(project.import_state)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment