Update pipeline create chain Prometheus metric

This commit is contained in:
Grzegorz Bizon 2017-12-07 10:27:07 +01:00
parent 5ccced6312
commit be12f3ed24
1 changed files with 3 additions and 4 deletions

View File

@ -18,9 +18,7 @@ module Gitlab
rescue ActiveRecord::RecordInvalid => e
error("Failed to persist the pipeline: #{e}")
ensure
pipeline.builds.find_each do |build|
next if build.stage_id.present?
if pipeline.builds.where(stage_id: nil).any?
invalid_builds_counter.increment(node: hostname)
end
end
@ -33,7 +31,8 @@ module Gitlab
def invalid_builds_counter
@counter ||= Gitlab::Metrics
.counter(:invalid_builds_counter, 'Invalid builds counter')
.counter(:gitlab_ci_invalid_builds_total,
'Invalid builds without stage assigned counter')
end
def hostname