summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBob Van Landuyt <bob@vanlanduyt.co>2017-07-20 08:53:57 +0200
committerBob Van Landuyt <bob@vanlanduyt.co>2017-07-20 08:53:57 +0200
commit2b1365c02961cd972e9ddef127ac312e5d0201d8 (patch)
treec7226e39fb6eefd5e4d3dc1ee1efd27d4ef16375
parent312ed3f9a458ba76a738cf75da8e07954cedecdd (diff)
downloadgitlab-ce-2b1365c02961cd972e9ddef127ac312e5d0201d8.tar.gz
Track the locale in Sentry so we know which ones are failing
-rw-r--r--lib/gitlab/sentry.rb2
-rw-r--r--spec/lib/gitlab/sentry_spec.rb13
2 files changed, 15 insertions, 0 deletions
diff --git a/lib/gitlab/sentry.rb b/lib/gitlab/sentry.rb
index 2442c2ded3b..d7e73f30abf 100644
--- a/lib/gitlab/sentry.rb
+++ b/lib/gitlab/sentry.rb
@@ -7,6 +7,8 @@ module Gitlab
def self.context(current_user = nil)
return unless self.enabled?
+ Raven.tags_context(locale: I18n.locale)
+
if current_user
Raven.user_context(
id: current_user.id,
diff --git a/spec/lib/gitlab/sentry_spec.rb b/spec/lib/gitlab/sentry_spec.rb
new file mode 100644
index 00000000000..8c211d1c63f
--- /dev/null
+++ b/spec/lib/gitlab/sentry_spec.rb
@@ -0,0 +1,13 @@
+require 'spec_helper'
+
+describe Gitlab::Sentry do
+ describe '.context' do
+ it 'adds the locale to the tags' do
+ expect(described_class).to receive(:enabled?).and_return(true)
+
+ described_class.context(nil)
+
+ expect(Raven.tags_context[:locale]).to eq(I18n.locale.to_s)
+ end
+ end
+end