Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYorick Peterse <yorickpeterse@gmail.com>2018-05-15 18:37:19 +0300
committerYorick Peterse <yorickpeterse@gmail.com>2018-05-15 18:38:39 +0300
commitc003337729e6a68df10878f77b11c7a24321df9c (patch)
tree1e17667be4468aa060e0b701b957657578002fa6 /lib/gitlab
parentf4ef6b474c44eb8e7034034dd95152818ae33b4a (diff)
Fix setting Gitlab metrics content types
The method "content_type" on a controller does not always return the correct content type. On the other hand, the method "request_format" does _and_ immediately returns a Symbol (e.g. :json) instead of a mime-type name (e.g. application/json). With these changes metrics should again report their action names correctly. Fixes https://gitlab.com/gitlab-com/infrastructure/issues/3499
Diffstat (limited to 'lib/gitlab')
-rw-r--r--lib/gitlab/metrics/web_transaction.rb14
1 files changed, 1 insertions, 13 deletions
diff --git a/lib/gitlab/metrics/web_transaction.rb b/lib/gitlab/metrics/web_transaction.rb
index 89ff02a96d6..7cf33ca9e8a 100644
--- a/lib/gitlab/metrics/web_transaction.rb
+++ b/lib/gitlab/metrics/web_transaction.rb
@@ -4,18 +4,6 @@ module Gitlab
CONTROLLER_KEY = 'action_controller.instance'.freeze
ENDPOINT_KEY = 'api.endpoint'.freeze
- CONTENT_TYPES = {
- 'text/html' => :html,
- 'text/plain' => :txt,
- 'application/json' => :json,
- 'text/js' => :js,
- 'application/atom+xml' => :atom,
- 'image/png' => :png,
- 'image/jpeg' => :jpeg,
- 'image/gif' => :gif,
- 'image/svg+xml' => :svg
- }.freeze
-
def initialize(env)
super()
@env = env
@@ -40,7 +28,7 @@ module Gitlab
controller = @env[CONTROLLER_KEY]
action = "#{controller.action_name}"
- suffix = CONTENT_TYPES[controller.content_type]
+ suffix = controller.request_format
if suffix && suffix != :html
action += ".#{suffix}"