Commit 2e1522bc authored by Dmitry Gruzd's avatar Dmitry Gruzd

Merge branch '326791-logging-legacy-usages' into 'master'

Add logging for legacy usage of ProcessPipelineService#update_retried

See merge request gitlab-org/gitlab!60494
parents 67522028 a7a1d022
......@@ -48,7 +48,13 @@ module Ci
# This counter is temporary. It will be used to check whether if we still use this method or not
# after setting correct value of `GenericCommitStatus#retried`.
# More info: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/50465#note_491657115
metrics.legacy_update_jobs_counter.increment if updated_count > 0
if updated_count > 0
Gitlab::AppJsonLogger.info(event: 'update_retried_is_used',
project_id: pipeline.project.id,
pipeline_id: pipeline.id)
metrics.legacy_update_jobs_counter.increment
end
end
end
# rubocop: enable CodeReuse/ActiveRecord
......
......@@ -3,8 +3,7 @@
require 'spec_helper'
RSpec.describe Ci::ProcessPipelineService do
let(:user) { create(:user) }
let(:project) { create(:project) }
let_it_be(:project) { create(:project) }
let(:pipeline) do
create(:ci_empty_pipeline, ref: 'master', project: project)
......@@ -24,8 +23,6 @@ RSpec.describe Ci::ProcessPipelineService do
stub_ci_pipeline_to_return_yaml_file
stub_not_protect_default_branch
project.add_developer(user)
allow(subject).to receive(:metrics).and_return(metrics)
end
......@@ -69,6 +66,14 @@ RSpec.describe Ci::ProcessPipelineService do
subject.execute
end
it 'logs the project and pipeline id' do
expect(Gitlab::AppJsonLogger).to receive(:info).with(event: 'update_retried_is_used',
project_id: project.id,
pipeline_id: pipeline.id)
subject.execute
end
context 'when the previous build has already retried column true' do
before do
build_retried.update_columns(retried: true)
......
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