summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2017-11-07 16:14:11 -0800
committerStan Hu <stanhu@gmail.com>2017-11-07 23:58:17 -0800
commitaf0dddbf1015bc96e0b51ffb9172fc0c5567323a (patch)
tree70a48034405c0f4ca368c73dc136fbea1db1c2dd
parentac4a976c5ff77a1327345245b91e8e0ca5601b9d (diff)
downloadgitlab-ce-sh-fix-protected-method-labels-error.tar.gz
Fix NoMethodError due to protected method `labels` when trying to use metricssh-fix-protected-method-labels-error
Closes gitlab-org/gitlab-ee#3949
-rw-r--r--lib/gitlab/metrics/background_transaction.rb2
-rw-r--r--spec/lib/gitlab/metrics/background_transaction_spec.rb6
2 files changed, 6 insertions, 2 deletions
diff --git a/lib/gitlab/metrics/background_transaction.rb b/lib/gitlab/metrics/background_transaction.rb
index d01de5eef0a..5919ebb1493 100644
--- a/lib/gitlab/metrics/background_transaction.rb
+++ b/lib/gitlab/metrics/background_transaction.rb
@@ -6,8 +6,6 @@ module Gitlab
@worker_class = worker_class
end
- protected
-
def labels
{ controller: @worker_class.name, action: 'perform' }
end
diff --git a/spec/lib/gitlab/metrics/background_transaction_spec.rb b/spec/lib/gitlab/metrics/background_transaction_spec.rb
index 96052b8dc2f..19f504d8b61 100644
--- a/spec/lib/gitlab/metrics/background_transaction_spec.rb
+++ b/spec/lib/gitlab/metrics/background_transaction_spec.rb
@@ -10,4 +10,10 @@ describe Gitlab::Metrics::BackgroundTransaction do
expect(subject.action).to eq('TestWorker#perform')
end
end
+
+ describe '#labels' do
+ it 'returns controller name' do
+ expect(subject.labels).to eq({ controller: 'TestWorker', action: 'perform' })
+ end
+ end
end