Commit 05e88a0d authored by Grzegorz Bizon's avatar Grzegorz Bizon

Merge branch 'zj-prom-pipeline-count' into 'master'

Add prometheus metrics on pipeline creation

Closes #32624

See merge request !11975
parents acdd1bf7 ff1bc177
......@@ -57,6 +57,8 @@ module Ci
cancel_pending_pipelines if project.auto_cancel_pending_pipelines?
pipeline_created_counter.increment(source: source)
pipeline.tap(&:process!)
end
......@@ -131,5 +133,9 @@ module Ci
pipeline.drop if save
pipeline
end
def pipeline_created_counter
@pipeline_created_counter ||= Gitlab::Metrics.counter(:pipelines_created_count, "Pipelines created count")
end
end
end
---
title: Add prometheus metrics on pipeline creation
merge_request:
author:
......@@ -38,6 +38,14 @@ describe Ci::CreatePipelineService, :services do
expect(pipeline.builds.first).to be_kind_of(Ci::Build)
end
it 'increments the prometheus counter' do
expect(Gitlab::Metrics).to receive(:counter)
.with(:pipelines_created_count, "Pipelines created count")
.and_call_original
pipeline
end
context 'when merge requests already exist for this source branch' do
it 'updates head pipeline of each merge request' do
merge_request_1 = create(:merge_request, source_branch: 'master', target_branch: "branch_1", source_project: project)
......
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