Commit fe62860e authored by Kamil Trzciński's avatar Kamil Trzciński

Merge branch 'metrics/gb/add-tmp-stage-creation-metrics' into 'master'

Add invalid builds counter metric to stage seeds class

See merge request gitlab-org/gitlab-ce!15764
parents 788f08b7 be12f3ed
...@@ -17,11 +17,27 @@ module Gitlab ...@@ -17,11 +17,27 @@ module Gitlab
end end
rescue ActiveRecord::RecordInvalid => e rescue ActiveRecord::RecordInvalid => e
error("Failed to persist the pipeline: #{e}") error("Failed to persist the pipeline: #{e}")
ensure
if pipeline.builds.where(stage_id: nil).any?
invalid_builds_counter.increment(node: hostname)
end
end end
def break? def break?
!pipeline.persisted? !pipeline.persisted?
end end
private
def invalid_builds_counter
@counter ||= Gitlab::Metrics
.counter(:gitlab_ci_invalid_builds_total,
'Invalid 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