Commit 2cf113b5 authored by Jarka Košanová's avatar Jarka Košanová

Merge branch 'rp-add-missing-docstring' into 'master'

Add missing docstring to Prometheus metric

See merge request gitlab-org/gitlab!27868
parents b4e2d21d 028f5a4d
---
title: Add missing docstring to Prometheus metric
merge_request: 27868
author:
type: fixed
...@@ -32,6 +32,7 @@ module Gitlab ...@@ -32,6 +32,7 @@ module Gitlab
def metric_rails_queue_duration_seconds def metric_rails_queue_duration_seconds
@metric_rails_queue_duration_seconds ||= Gitlab::Metrics.histogram( @metric_rails_queue_duration_seconds ||= Gitlab::Metrics.histogram(
:gitlab_rails_queue_duration_seconds, :gitlab_rails_queue_duration_seconds,
'Measures latency between GitLab Workhorse forwarding a request to Rails',
Gitlab::Metrics::Transaction::BASE_LABELS Gitlab::Metrics::Transaction::BASE_LABELS
) )
end end
......
...@@ -9,7 +9,7 @@ describe Gitlab::Middleware::RailsQueueDuration do ...@@ -9,7 +9,7 @@ describe Gitlab::Middleware::RailsQueueDuration do
let(:transaction) { Gitlab::Metrics::WebTransaction.new(env) } let(:transaction) { Gitlab::Metrics::WebTransaction.new(env) }
before do before do
expect(app).to receive(:call).with(env).and_return('yay') allow(app).to receive(:call).with(env).and_return('yay')
end end
describe '#call' do describe '#call' do
...@@ -42,6 +42,13 @@ describe Gitlab::Middleware::RailsQueueDuration do ...@@ -42,6 +42,13 @@ describe Gitlab::Middleware::RailsQueueDuration do
expect(middleware.call(env)).to eq('yay') expect(middleware.call(env)).to eq('yay')
end end
end end
it 'creates a metric with a docstring' do
metric = middleware.send(:metric_rails_queue_duration_seconds)
expect(metric).to be_instance_of(Prometheus::Client::Histogram)
expect(metric.docstring).to eq('Measures latency between GitLab Workhorse forwarding a request to Rails')
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