Commit bc1c330c authored by Sean McGivern's avatar Sean McGivern

Add sidekiq_job_completion_metric_initialize feature flag

This feature flag controls the initialisation of the
sidekiq_jobs_completion_seconds bucket when a Sidekiq server process
starts. By default it is on, but we can disable it (and restart Sidekiq)
if there is an issue.
parent d84fe983
---
name: sidekiq_job_completion_metric_initialize
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/64637
rollout_issue_url: https://gitlab.com/gitlab-com/gl-infra/scalability/-/issues/1133
milestone: '14.1'
type: development
group: team::Scalability
default_enabled: true
......@@ -35,6 +35,8 @@ module Gitlab
metrics[:sidekiq_concurrency].set({}, Sidekiq.options[:concurrency].to_i)
return unless ::Feature.enabled?(:sidekiq_job_completion_metric_initialize, default_enabled: :yaml)
::Gitlab::SidekiqConfig.current_worker_queue_mappings.each do |worker, queue|
worker_class = worker.safe_constantize
......
......@@ -58,6 +58,28 @@ RSpec.describe Gitlab::SidekiqMiddleware::ServerMetrics do
described_class.initialize_process_metrics
end
context 'when the sidekiq_job_completion_metric_initialize feature flag is disabled' do
before do
stub_feature_flags(sidekiq_job_completion_metric_initialize: false)
end
it 'sets the concurrency metric' do
expect(concurrency_metric).to receive(:set).with({}, Sidekiq.options[:concurrency].to_i)
described_class.initialize_process_metrics
end
it 'does not initialize sidekiq_jobs_completion_seconds' do
allow(Gitlab::SidekiqConfig)
.to receive(:current_worker_queue_mappings)
.and_return('MergeWorker' => 'merge', 'BuildFinishedWorker' => 'default')
expect(completion_seconds_metric).not_to receive(:get)
described_class.initialize_process_metrics
end
end
end
describe '#call' do
......
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