Commit 90c6a1a3 authored by Rémy Coutable's avatar Rémy Coutable

Use Grape's new Route methods

- Use Route#request_method instead of Route#route_method
- Use Route#path instead of Route#route_path
Signed-off-by: default avatarRémy Coutable <remy@rymai.me>
parent ffcf1565
---
title: Use Grape's new Route methods
merge_request:
author:
...@@ -70,8 +70,8 @@ module Gitlab ...@@ -70,8 +70,8 @@ module Gitlab
def tag_endpoint(trans, env) def tag_endpoint(trans, env)
endpoint = env[ENDPOINT_KEY] endpoint = env[ENDPOINT_KEY]
path = endpoint_paths_cache[endpoint.route.route_method][endpoint.route.route_path] path = endpoint_paths_cache[endpoint.route.request_method][endpoint.route.path]
trans.action = "Grape##{endpoint.route.route_method} #{path}" trans.action = "Grape##{endpoint.route.request_method} #{path}"
end end
private private
......
...@@ -33,7 +33,7 @@ describe Gitlab::Metrics::RackMiddleware do ...@@ -33,7 +33,7 @@ describe Gitlab::Metrics::RackMiddleware do
end end
it 'tags a transaction with the method and path of the route in the grape endpoint' do it 'tags a transaction with the method and path of the route in the grape endpoint' do
route = double(:route, route_method: "GET", route_path: "/:version/projects/:id/archive(.:format)") route = double(:route, request_method: "GET", path: "/:version/projects/:id/archive(.:format)")
endpoint = double(:endpoint, route: route) endpoint = double(:endpoint, route: route)
env['api.endpoint'] = endpoint env['api.endpoint'] = endpoint
...@@ -117,7 +117,7 @@ describe Gitlab::Metrics::RackMiddleware do ...@@ -117,7 +117,7 @@ describe Gitlab::Metrics::RackMiddleware do
let(:transaction) { middleware.transaction_from_env(env) } let(:transaction) { middleware.transaction_from_env(env) }
it 'tags a transaction with the method and path of the route in the grape endpount' do it 'tags a transaction with the method and path of the route in the grape endpount' do
route = double(:route, route_method: "GET", route_path: "/:version/projects/:id/archive(.:format)") route = double(:route, request_method: "GET", path: "/:version/projects/:id/archive(.:format)")
endpoint = double(:endpoint, route: route) endpoint = double(:endpoint, route: route)
env['api.endpoint'] = endpoint env['api.endpoint'] = endpoint
......
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