Skip to content
代码片段 群组 项目
提交 4bd48925 编辑于 作者: Stan Hu's avatar Stan Hu
浏览文件

Merge branch 'ci-remove-includes-logging' into 'master'

Remove CI json.pipeline_includes_count logging

See merge request https://gitlab.com/gitlab-org/gitlab/-/merge_requests/130374



Merged-by: default avatarStan Hu <stanhu@gmail.com>
Approved-by: default avatarStan Hu <stanhu@gmail.com>
Approved-by: default avatarDoug Stull <dstull@gitlab.com>
Approved-by: default avatarSiddharth Dungarwal <sdungarwal@gitlab.com>
Co-authored-by: default avatarlma-git <lma@gitlab.com>
No related branches found
No related tags found
无相关合并请求
...@@ -154,13 +154,6 @@ def build_logger ...@@ -154,13 +154,6 @@ def build_logger
duration >= LOG_MAX_CREATION_THRESHOLD duration >= LOG_MAX_CREATION_THRESHOLD
end end
l.log_when do |observations|
pipeline_includes_count = observations['pipeline_includes_count']
next false unless pipeline_includes_count
pipeline_includes_count.to_i > Gitlab::Ci::Config::External::Context::TEMP_MAX_INCLUDES
end
end end
end end
end end
......
...@@ -9,8 +9,6 @@ class Context ...@@ -9,8 +9,6 @@ class Context
TimeoutError = Class.new(StandardError) TimeoutError = Class.new(StandardError)
TEMP_MAX_INCLUDES = 100 # For logging; to be removed in https://gitlab.com/gitlab-org/gitlab/-/issues/396776
include ::Gitlab::Utils::StrongMemoize include ::Gitlab::Utils::StrongMemoize
attr_reader :project, :sha, :user, :parent_pipeline, :variables, :pipeline_config attr_reader :project, :sha, :user, :parent_pipeline, :variables, :pipeline_config
......
...@@ -128,10 +128,6 @@ def observe_jobs_count_in_alive_pipelines ...@@ -128,10 +128,6 @@ def observe_jobs_count_in_alive_pipelines
.observe({ plan: project.actual_plan_name }, jobs_count) .observe({ plan: project.actual_plan_name }, jobs_count)
end end
def observe_pipeline_includes_count(pipeline)
logger.observe(:pipeline_includes_count, pipeline.config_metadata&.[](:includes)&.count, once: true)
end
def increment_pipeline_failure_reason_counter(reason) def increment_pipeline_failure_reason_counter(reason)
metrics.pipeline_failure_reason_counter metrics.pipeline_failure_reason_counter
.increment(reason: (reason || :unknown_failure).to_s) .increment(reason: (reason || :unknown_failure).to_s)
......
...@@ -30,7 +30,6 @@ def build! ...@@ -30,7 +30,6 @@ def build!
@command.observe_creation_duration(current_monotonic_time - @start) @command.observe_creation_duration(current_monotonic_time - @start)
@command.observe_pipeline_size(@pipeline) @command.observe_pipeline_size(@pipeline)
@command.observe_jobs_count_in_alive_pipelines @command.observe_jobs_count_in_alive_pipelines
@command.observe_pipeline_includes_count(@pipeline)
@pipeline @pipeline
end end
......
...@@ -139,74 +139,5 @@ ...@@ -139,74 +139,5 @@
expect(pipeline).to be_created_successfully expect(pipeline).to be_created_successfully
end end
end end
describe 'pipeline includes count' do
before do
stub_const('Gitlab::Ci::Config::External::Context::TEMP_MAX_INCLUDES', 2)
end
context 'when the includes count exceeds the maximum' do
before do
allow_next_instance_of(Ci::Pipeline) do |pipeline|
allow(pipeline).to receive(:config_metadata)
.and_return({ includes: [{ file: 1 }, { file: 2 }, { file: 3 }] })
end
end
it 'creates a log entry' do
expect(Gitlab::AppJsonLogger)
.to receive(:info)
.with(a_hash_including({ 'pipeline_includes_count' => 3 }))
.and_call_original
expect(pipeline).to be_created_successfully
end
end
context 'when the includes count does not exceed the maximum' do
before do
allow_next_instance_of(Ci::Pipeline) do |pipeline|
allow(pipeline).to receive(:config_metadata)
.and_return({ includes: [{ file: 1 }, { file: 2 }] })
end
end
it 'does not create a log entry but it collects the data' do
expect(Gitlab::AppJsonLogger).not_to receive(:info)
expect(pipeline).to be_created_successfully
expect(service.logger.observations_hash)
.to match(a_hash_including({ 'pipeline_includes_count' => 2 }))
end
end
context 'when the includes data is nil' do
before do
allow_next_instance_of(Ci::Pipeline) do |pipeline|
allow(pipeline).to receive(:config_metadata)
.and_return({})
end
end
it 'does not create a log entry' do
expect(Gitlab::AppJsonLogger).not_to receive(:info)
expect(pipeline).to be_created_successfully
end
end
context 'when the pipeline config_metadata is nil' do
before do
allow_next_instance_of(Ci::Pipeline) do |pipeline|
allow(pipeline).to receive(:config_metadata)
.and_return(nil)
end
end
it 'does not create a log entry but it collects the data' do
expect(Gitlab::AppJsonLogger).not_to receive(:info)
expect(pipeline).to be_created_successfully
end
end
end
end end
end end
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册