diff options
author | Yorick Peterse <yorickpeterse@gmail.com> | 2018-05-16 13:53:54 +0300 |
---|---|---|
committer | Yorick Peterse <yorickpeterse@gmail.com> | 2018-05-16 13:53:54 +0300 |
commit | 33af33d7cbf947055a2a40dc2dddf74dfb13079c (patch) | |
tree | 2addb0fa11738df14a91afe26160fd7f229c2ca4 /lib/gitlab | |
parent | 75f94fc39bedbc635bd4bc52cdf145d1e81752dd (diff) |
Fix GPM content types for Doorkeeper
Certain controllers (e.g. Doorkeeper::TokensController) don't expose the
method "request_format". This commit changes
Gitlab::Metrics::WebTransaction so we don't rely on this method, instead
using the underlying code this method uses.
Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/46412
Diffstat (limited to 'lib/gitlab')
-rw-r--r-- | lib/gitlab/metrics/web_transaction.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/gitlab/metrics/web_transaction.rb b/lib/gitlab/metrics/web_transaction.rb index 7cf33ca9e8a..3799aaebf1c 100644 --- a/lib/gitlab/metrics/web_transaction.rb +++ b/lib/gitlab/metrics/web_transaction.rb @@ -28,7 +28,11 @@ module Gitlab controller = @env[CONTROLLER_KEY] action = "#{controller.action_name}" - suffix = controller.request_format + + # Devise exposes a method called "request_format" that does the below. + # However, this method is not available to all controllers (e.g. certain + # Doorkeeper controllers). As such we use the underlying code directly. + suffix = controller.request.format.try(:ref) if suffix && suffix != :html action += ".#{suffix}" |