From 5f98fdcdc9bca5b33220a1bb2b6ded32606271ff Mon Sep 17 00:00:00 2001 From: Jacob Schatz Date: Mon, 18 Apr 2016 12:26:32 -0400 Subject: Add sentry logger to GitLab --- lib/gitlab/gon_helper.rb | 1 + 1 file changed, 1 insertion(+) (limited to 'lib') diff --git a/lib/gitlab/gon_helper.rb b/lib/gitlab/gon_helper.rb index 5ebaad6ca6e..4bdaedbf9b6 100644 --- a/lib/gitlab/gon_helper.rb +++ b/lib/gitlab/gon_helper.rb @@ -7,6 +7,7 @@ module Gitlab gon.max_file_size = current_application_settings.max_attachment_size gon.relative_url_root = Gitlab.config.gitlab.relative_url_root gon.user_color_scheme = Gitlab::ColorSchemes.for_user(current_user).css_class + gon.sentry_dsn = ApplicationSetting.current.sentry_dsn if current_user gon.current_user_id = current_user.id -- cgit v1.2.1 From 3e7a8b0789745080e499f68862ff29e3bc178453 Mon Sep 17 00:00:00 2001 From: Arinde Eniola Date: Tue, 19 Apr 2016 22:04:52 +0100 Subject: place the sentry config into a new file, and some changes --- lib/gitlab/gon_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/gitlab/gon_helper.rb b/lib/gitlab/gon_helper.rb index 4bdaedbf9b6..eb27d82f110 100644 --- a/lib/gitlab/gon_helper.rb +++ b/lib/gitlab/gon_helper.rb @@ -7,7 +7,7 @@ module Gitlab gon.max_file_size = current_application_settings.max_attachment_size gon.relative_url_root = Gitlab.config.gitlab.relative_url_root gon.user_color_scheme = Gitlab::ColorSchemes.for_user(current_user).css_class - gon.sentry_dsn = ApplicationSetting.current.sentry_dsn + gon.sentry_dsn = ApplicationSetting.current.sentry_dsn if Rails.env.production? if current_user gon.current_user_id = current_user.id -- cgit v1.2.1 From a257d117a05e0a9eaaef305990335ee7c85cd7a8 Mon Sep 17 00:00:00 2001 From: Yorick Peterse Date: Wed, 20 Apr 2016 22:42:52 +0200 Subject: 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. --- lib/api/internal.rb | 2 +- lib/gitlab/metrics.rb | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) (limited to 'lib') 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? -- cgit v1.2.1