Commit 4b53ae67 authored by David Wilkins's avatar David Wilkins Committed by Stan Hu

Fix duplicated prometheus messages

- Issue 34887 details prometheus metrics being duplicated once
  with one line having a 0 count and the other having a valid count

- Update lib/gitlab/metrics/requests_rack_middleware.rb to add
  .to_i to the status value.

- Add changelog for
  https://gitlab.com/gitlab-org/gitlab/merge_requests/19327
parent 6a337153
---
title: Fix Prometheus duplicate metrics
merge_request: 19327
author:
type: fixed
...@@ -35,7 +35,7 @@ module Gitlab ...@@ -35,7 +35,7 @@ module Gitlab
def self.initialize_http_request_duration_seconds def self.initialize_http_request_duration_seconds
HTTP_METHODS.each do |method, statuses| HTTP_METHODS.each do |method, statuses|
statuses.each do |status| statuses.each do |status|
http_request_duration_seconds.get({ method: method, status: status }) http_request_duration_seconds.get({ method: method, status: status.to_i })
end end
end end
end end
......
...@@ -69,7 +69,7 @@ describe Gitlab::Metrics::RequestsRackMiddleware do ...@@ -69,7 +69,7 @@ describe Gitlab::Metrics::RequestsRackMiddleware do
expected_labels = [] expected_labels = []
described_class::HTTP_METHODS.each do |method, statuses| described_class::HTTP_METHODS.each do |method, statuses|
statuses.each do |status| statuses.each do |status|
expected_labels << { method: method, status: status } expected_labels << { method: method, status: status.to_i }
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