Commit 0f2375ba authored by Peter Leitzen's avatar Peter Leitzen

Revert "Merge branch 'bvl-feature-category-label-in-api' into 'master'"

This reverts commit 42603e9b, reversing
changes made to e0153c04.
parent 6685adf9
......@@ -65,10 +65,7 @@ module Gitlab
if route
path = endpoint_paths_cache[route.request_method][route.path]
# Feature categories will be added for grape endpoints in
# https://gitlab.com/gitlab-com/gl-infra/scalability/-/issues/462
{ controller: 'Grape', action: "#{route.request_method} #{path}", feature_category: '' }
{ controller: 'Grape', action: "#{route.request_method} #{path}" }
end
end
......
......@@ -70,9 +70,6 @@ RSpec.describe Gitlab::Metrics::WebTransaction do
end
describe '#labels' do
let(:request) { double(:request, format: double(:format, ref: :html)) }
let(:controller_class) { double(:controller_class, name: 'TestController') }
context 'when request goes to Grape endpoint' do
before do
route = double(:route, request_method: 'GET', path: '/:version/projects/:id/archive(.:format)')
......@@ -80,9 +77,8 @@ RSpec.describe Gitlab::Metrics::WebTransaction do
env['api.endpoint'] = endpoint
end
it 'provides labels with the method and path of the route in the grape endpoint' do
expect(transaction.labels).to eq({ controller: 'Grape', action: 'GET /projects/:id/archive', feature_category: '' })
expect(transaction.labels).to eq({ controller: 'Grape', action: 'GET /projects/:id/archive' })
end
it 'does not provide labels if route infos are missing' do
......@@ -96,6 +92,9 @@ RSpec.describe Gitlab::Metrics::WebTransaction do
end
context 'when request goes to ActionController' do
let(:request) { double(:request, format: double(:format, ref: :html)) }
let(:controller_class) { double(:controller_class, name: 'TestController') }
before do
controller = double(:controller, class: controller_class, action_name: 'show', request: request)
......@@ -130,19 +129,6 @@ RSpec.describe Gitlab::Metrics::WebTransaction do
end
end
it 'returns the same labels for API and controller requests' do
route = double(:route, request_method: 'GET', path: '/:version/projects/:id/archive(.:format)')
endpoint = double(:endpoint, route: route)
api_env = { 'api.endpoint' => endpoint }
api_labels = described_class.new(api_env).labels
controller = double(:controller, class: controller_class, action_name: 'show', request: request)
controller_env = { 'action_controller.instance' => controller }
controller_labels = described_class.new(controller_env).labels
expect(api_labels.keys).to contain_exactly(*controller_labels.keys)
end
it 'returns no labels when no route information is present in env' do
expect(transaction.labels).to eq({})
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