summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArinde Eniola <eniolaarinde1@gmail.com>2016-04-19 22:04:52 +0100
committerArinde Eniola <eniolaarinde1@gmail.com>2016-04-19 22:04:52 +0100
commit3e7a8b0789745080e499f68862ff29e3bc178453 (patch)
treedcbdc3b6dda20836c347751bcfb93c39114f9aad
parent5661f47d3834edb81dbddf4c272bcd49f2195a14 (diff)
downloadgitlab-ce-sentry-js.tar.gz
place the sentry config into a new file, and some changessentry-js
-rw-r--r--app/assets/javascripts/application.js.coffee43
-rw-r--r--app/assets/javascripts/raven_config.js.coffee44
-rw-r--r--lib/gitlab/gon_helper.rb2
3 files changed, 45 insertions, 44 deletions
diff --git a/app/assets/javascripts/application.js.coffee b/app/assets/javascripts/application.js.coffee
index 83d52cabcda..ef7e7ece4af 100644
--- a/app/assets/javascripts/application.js.coffee
+++ b/app/assets/javascripts/application.js.coffee
@@ -296,46 +296,3 @@ $ ->
checkInitialSidebarSize()
new Aside()
-
- if gon.sentry_dsn?
- Raven.config(gon.sentry_dsn, {
- includePaths: [/gon.relative_url_root/]
- ignoreErrors: [
- # Random plugins/extensions
- 'top.GLOBALS',
- # See: http://blog.errorception.com/2012/03/tale-of-unfindable-js-error. html
- 'originalCreateNotification',
- 'canvas.contentDocument',
- 'MyApp_RemoveAllHighlights',
- 'http://tt.epicplay.com',
- 'Can\'t find variable: ZiteReader',
- 'jigsaw is not defined',
- 'ComboSearch is not defined',
- 'http://loading.retry.widdit.com/',
- 'atomicFindClose',
- # ISP "optimizing" proxy - `Cache-Control: no-transform` seems to
- # reduce this. (thanks @acdha)
- # See http://stackoverflow.com/questions/4113268
- 'bmi_SafeAddOnload',
- 'EBCallBackMessageReceived',
- # See http://toolbar.conduit.com/Developer/HtmlAndGadget/Methods/JSInjection.aspx
- 'conduitPage'
- ],
- ignoreUrls: [
- # Woopra flakiness
- /eatdifferent\.com\.woopra-ns\.com/i,
- /static\.woopra\.com\/js\/woopra\.js/i,
- # Chrome extensions
- /extensions\//i,
- /^chrome:\/\//i,
- # Other plugins
- /127\.0\.0\.1:4001\/isrunning/i, # Cacaoweb
- /webappstoolbarba\.texthelp\.com\//i,
- /metrics\.itunes\.apple\.com\.edgesuite\.net\//i
- ]
- }).install()
-
- if gon.current_user_id
- Raven.setUserContext({
- id: gon.current_user_id
- }) \ No newline at end of file
diff --git a/app/assets/javascripts/raven_config.js.coffee b/app/assets/javascripts/raven_config.js.coffee
new file mode 100644
index 00000000000..d031a655abf
--- /dev/null
+++ b/app/assets/javascripts/raven_config.js.coffee
@@ -0,0 +1,44 @@
+@raven =
+ init: ->
+ if gon.sentry_dsn?
+ Raven.config(gon.sentry_dsn, {
+ includePaths: [/gon.relative_url_root/]
+ ignoreErrors: [
+ # Random plugins/extensions
+ 'top.GLOBALS',
+ # See: http://blog.errorception.com/2012/03/tale-of-unfindable-js-error. html
+ 'originalCreateNotification',
+ 'canvas.contentDocument',
+ 'MyApp_RemoveAllHighlights',
+ 'http://tt.epicplay.com',
+ 'Can\'t find variable: ZiteReader',
+ 'jigsaw is not defined',
+ 'ComboSearch is not defined',
+ 'http://loading.retry.widdit.com/',
+ 'atomicFindClose',
+ # ISP "optimizing" proxy - `Cache-Control: no-transform` seems to
+ # reduce this. (thanks @acdha)
+ # See http://stackoverflow.com/questions/4113268
+ 'bmi_SafeAddOnload',
+ 'EBCallBackMessageReceived',
+ # See http://toolbar.conduit.com/Developer/HtmlAndGadget/Methods/JSInjection.aspx
+ 'conduitPage'
+ ],
+ ignoreUrls: [
+ # Chrome extensions
+ /extensions\//i,
+ /^chrome:\/\//i,
+ # Other plugins
+ /127\.0\.0\.1:4001\/isrunning/i, # Cacaoweb
+ /webappstoolbarba\.texthelp\.com\//i,
+ /metrics\.itunes\.apple\.com\.edgesuite\.net\//i
+ ]
+ }).install()
+
+ if gon.current_user_id
+ Raven.setUserContext({
+ id: gon.current_user_id
+ })
+
+$ ->
+ raven.init()
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