From 90c6a1a3198ba8090c645d740ac619e01a2e834e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9my=20Coutable?= <remy@rymai.me>
Date: Wed, 21 Dec 2016 13:45:18 +0100
Subject: [PATCH] Use Grape's new Route methods
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

- Use Route#request_method instead of Route#route_method
- Use Route#path instead of Route#route_path

Signed-off-by: Rémy Coutable <remy@rymai.me>
---
 changelogs/unreleased/25908-fix-grape-after-update.yml | 4 ++++
 lib/gitlab/metrics/rack_middleware.rb                  | 4 ++--
 spec/lib/gitlab/metrics/rack_middleware_spec.rb        | 4 ++--
 3 files changed, 8 insertions(+), 4 deletions(-)
 create mode 100644 changelogs/unreleased/25908-fix-grape-after-update.yml

diff --git a/changelogs/unreleased/25908-fix-grape-after-update.yml b/changelogs/unreleased/25908-fix-grape-after-update.yml
new file mode 100644
index 00000000000..026d5592441
--- /dev/null
+++ b/changelogs/unreleased/25908-fix-grape-after-update.yml
@@ -0,0 +1,4 @@
+---
+title: Use Grape's new Route methods
+merge_request:
+author:
diff --git a/lib/gitlab/metrics/rack_middleware.rb b/lib/gitlab/metrics/rack_middleware.rb
index 01c96a6fe96..91fb0bb317a 100644
--- a/lib/gitlab/metrics/rack_middleware.rb
+++ b/lib/gitlab/metrics/rack_middleware.rb
@@ -70,8 +70,8 @@ module Gitlab
 
       def tag_endpoint(trans, env)
         endpoint = env[ENDPOINT_KEY]
-        path = endpoint_paths_cache[endpoint.route.route_method][endpoint.route.route_path]
-        trans.action = "Grape##{endpoint.route.route_method} #{path}"
+        path = endpoint_paths_cache[endpoint.route.request_method][endpoint.route.path]
+        trans.action = "Grape##{endpoint.route.request_method} #{path}"
       end
 
       private
diff --git a/spec/lib/gitlab/metrics/rack_middleware_spec.rb b/spec/lib/gitlab/metrics/rack_middleware_spec.rb
index bcaffd27909..7371b578a48 100644
--- a/spec/lib/gitlab/metrics/rack_middleware_spec.rb
+++ b/spec/lib/gitlab/metrics/rack_middleware_spec.rb
@@ -33,7 +33,7 @@ describe Gitlab::Metrics::RackMiddleware do
     end
 
     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)
 
       env['api.endpoint'] = endpoint
@@ -117,7 +117,7 @@ describe Gitlab::Metrics::RackMiddleware do
     let(:transaction) { middleware.transaction_from_env(env) }
 
     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)
 
       env['api.endpoint'] = endpoint
-- 
GitLab