Commit 9d20bc02 authored by Michael Kozono's avatar Michael Kozono

Merge branch 'bjk/label_strings' into 'master'

Use strings for request status label

See merge request gitlab-org/gitlab!19967
parents 0cc5baf2 2e16d0ff
......@@ -35,7 +35,7 @@ module Gitlab
def self.initialize_http_request_duration_seconds
HTTP_METHODS.each do |method, statuses|
statuses.each do |status|
http_request_duration_seconds.get({ method: method, status: status.to_i })
http_request_duration_seconds.get({ method: method, status: status.to_s })
end
end
end
......@@ -49,7 +49,7 @@ module Gitlab
status, headers, body = @app.call(env)
elapsed = Time.now.to_f - started
RequestsRackMiddleware.http_request_duration_seconds.observe({ method: method, status: status }, elapsed)
RequestsRackMiddleware.http_request_duration_seconds.observe({ method: method, status: status.to_s }, elapsed)
[status, headers, body]
rescue
......
......@@ -31,7 +31,7 @@ describe Gitlab::Metrics::RequestsRackMiddleware do
end
it 'measures execution time' do
expect(described_class).to receive_message_chain(:http_request_duration_seconds, :observe).with({ status: 200, method: 'get' }, a_positive_execution_time)
expect(described_class).to receive_message_chain(:http_request_duration_seconds, :observe).with({ status: '200', method: 'get' }, a_positive_execution_time)
Timecop.scale(3600) { subject.call(env) }
end
......@@ -69,7 +69,7 @@ describe Gitlab::Metrics::RequestsRackMiddleware do
expected_labels = []
described_class::HTTP_METHODS.each do |method, statuses|
statuses.each do |status|
expected_labels << { method: method, status: status.to_i }
expected_labels << { method: method, status: status.to_s }
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