Commit be12f3ed authored by Grzegorz Bizon's avatar Grzegorz Bizon

Update pipeline create chain Prometheus metric

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