summaryrefslogtreecommitdiff
path: root/lib/gitlab/metrics.rb
diff options
context:
space:
mode:
authorYorick Peterse <yorickpeterse@gmail.com>2016-04-20 22:42:52 +0200
committerYorick Peterse <yorickpeterse@gmail.com>2016-04-20 22:42:52 +0200
commita257d117a05e0a9eaaef305990335ee7c85cd7a8 (patch)
tree474384dce916b4d5ae3888b2ecb199bfec401e71 /lib/gitlab/metrics.rb
parent832cdd3d516698d0e6a7257b3d94292819a0436a (diff)
downloadgitlab-ce-a257d117a05e0a9eaaef305990335ee7c85cd7a8.tar.gz
Fix setting of "action" for Grape transactions
Merely setting the "action" tag will only result in the transaction itself containing a value for this tag. To ensure other metrics also contain this tag we must set the action using Transaction#action= instead.
Diffstat (limited to 'lib/gitlab/metrics.rb')
-rw-r--r--lib/gitlab/metrics.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/gitlab/metrics.rb b/lib/gitlab/metrics.rb
index f82dce14865..49f702f91f6 100644
--- a/lib/gitlab/metrics.rb
+++ b/lib/gitlab/metrics.rb
@@ -115,6 +115,15 @@ module Gitlab
trans.add_tag(name, value) if trans
end
+ # Sets the action of the current transaction (if any)
+ #
+ # action - The name of the action.
+ def self.action=(action)
+ trans = current_transaction
+
+ trans.action = action if trans
+ end
+
# When enabled this should be set before being used as the usual pattern
# "@foo ||= bar" is _not_ thread-safe.
if enabled?