Commit 382a1ef4 authored by Grzegorz Bizon's avatar Grzegorz Bizon

Add invalid builds counter metric to stage seeds class

parent 0131c97c
...@@ -39,6 +39,10 @@ module Gitlab ...@@ -39,6 +39,10 @@ module Gitlab
pipeline.stages.create!(stage).tap do |stage| pipeline.stages.create!(stage).tap do |stage|
builds_attributes = builds.map do |attributes| builds_attributes = builds.map do |attributes|
attributes.merge(stage_id: stage.id) attributes.merge(stage_id: stage.id)
if attributes.fetch(:stage_id).nil?
invalid_builds_counter.increment(node: hostname)
end
end end
pipeline.builds.create!(builds_attributes).each do |build| pipeline.builds.create!(builds_attributes).each do |build|
...@@ -52,6 +56,15 @@ module Gitlab ...@@ -52,6 +56,15 @@ module Gitlab
def protected_ref? def protected_ref?
@protected_ref ||= project.protected_for?(pipeline.ref) @protected_ref ||= project.protected_for?(pipeline.ref)
end end
def invalid_builds_counter
@counter ||= Gitlab::Metrics.counter(:invalid_builds_counter,
'Builds without stage assigned counter')
end
def hostname
@hostname ||= Socket.gethostname
end
end end
end end
end end
......
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