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
path: root/lib
diff options
context:
space:
mode:
authorRobert Speicher <robert@gitlab.com>2016-04-21 00:27:43 +0300
committerRobert Speicher <robert@gitlab.com>2016-04-21 00:27:43 +0300
commit7e6d59067eb614a139cfa438d4c9f9f9f5368a47 (patch)
treebf874c8a6afec05847ea1d08323640e8a4a903aa /lib
parent07c5df51eb5b02bbe58f40812c3dc377e362ec44 (diff)
parenta257d117a05e0a9eaaef305990335ee7c85cd7a8 (diff)
Merge branch 'fix-grape-internal-allowed-action' into 'master'
Fix setting of "action" for Grape transactions After wondering why we're not getting all the data in Grafana that I wanted I realized I wasn't setting the "action" field properly here. See merge request !3842
Diffstat (limited to 'lib')
-rw-r--r--lib/api/internal.rb2
-rw-r--r--lib/gitlab/metrics.rb9
2 files changed, 10 insertions, 1 deletions
diff --git a/lib/api/internal.rb b/lib/api/internal.rb
index 8cfa1f1556b..3ac7b50c4ce 100644
--- a/lib/api/internal.rb
+++ b/lib/api/internal.rb
@@ -23,7 +23,7 @@ module API
end
post "/allowed" do
- Gitlab::Metrics.tag_transaction('action', 'Grape#/internal/allowed')
+ Gitlab::Metrics.action = 'Grape#/internal/allowed'
status 200
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?