diff --git a/.env.sample b/.env.sample index 6e379a4f..061561c2 100644 --- a/.env.sample +++ b/.env.sample @@ -1 +1,2 @@ GOOGLE_MAP_API_KEY="hogehoge" +ROLLBAR_ACCESS_TOKEN="" diff --git a/Gemfile b/Gemfile index 56391906..fa72a021 100644 --- a/Gemfile +++ b/Gemfile @@ -36,6 +36,7 @@ gem 'rails-assets-moment' gem 'rails-assets-respond' gem 'rails-assets-smoothscroll' gem 'rambulance' +gem 'rollbar', '~> 1.4.2' gem 'sass-rails', '~> 5.0.0' gem 'slim-rails' gem 'uglifier', '>= 1.3.0' diff --git a/Gemfile.lock b/Gemfile.lock index d2e5bd46..d026faa6 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -295,6 +295,8 @@ GEM rest-client (1.7.2) mime-types (>= 1.16, < 3.0) netrc (~> 0.7) + rollbar (1.4.4) + multi_json (~> 1.3) ruby-prof (0.15.4) ruby2ruby (2.1.3) ruby_parser (~> 3.1) @@ -415,6 +417,7 @@ DEPENDENCIES rails-footnotes (~> 4.0) rails_12factor rambulance + rollbar (~> 1.4.2) sass-rails (~> 5.0.0) slim-rails spring diff --git a/app/views/application/_rollbar.html.slim b/app/views/application/_rollbar.html.slim new file mode 100644 index 00000000..0894d517 --- /dev/null +++ b/app/views/application/_rollbar.html.slim @@ -0,0 +1,10 @@ +- if Rails.env.production? + javascript: + var _rollbarConfig = { + accessToken: "0a35372d2c794f0e9c5cf916dca4c642", + captureUncaught: true, + payload: { + environment: "production" + } + }; + !function(a,b){function c(b){this.shimId=++h,this.notifier=null,this.parentShim=b,this.logger=function(){},a.console&&void 0===a.console.shimId&&(this.logger=a.console.log)}function d(b,c,d){a._rollbarWrappedError&&(d[4]||(d[4]=a._rollbarWrappedError),d[5]||(d[5]=a._rollbarWrappedError._rollbarContext),a._rollbarWrappedError=null),b.uncaughtError.apply(b,d),c&&c.apply(a,d)}function e(b){var d=c;return g(function(){if(this.notifier)return this.notifier[b].apply(this.notifier,arguments);var c=this,e="scope"===b;e&&(c=new d(this));var f=Array.prototype.slice.call(arguments,0),g={shim:c,method:b,args:f,ts:new Date};return a._rollbarShimQueue.push(g),e?c:void 0})}function f(a,b){if(b.hasOwnProperty&&b.hasOwnProperty("addEventListener")){var c=b.addEventListener;b.addEventListener=function(b,d,e){c.call(this,b,a.wrap(d),e)};var d=b.removeEventListener;b.removeEventListener=function(a,b,c){d.call(this,a,b&&b._wrapped?b._wrapped:b,c)}}}function g(a,b){return b=b||this.logger,function(){try{return a.apply(this,arguments)}catch(c){b("Rollbar internal error:",c)}}}var h=0;c.init=function(a,b){var e=b.globalAlias||"Rollbar";if("object"==typeof a[e])return a[e];a._rollbarShimQueue=[],a._rollbarWrappedError=null,b=b||{};var h=new c;return g(function(){if(h.configure(b),b.captureUncaught){var c=a.onerror;a.onerror=function(){var a=Array.prototype.slice.call(arguments,0);d(h,c,a)};var g,i,j="EventTarget,Window,Node,ApplicationCache,AudioTrackList,ChannelMergerNode,CryptoOperation,EventSource,FileReader,HTMLUnknownElement,IDBDatabase,IDBRequest,IDBTransaction,KeyOperation,MediaController,MessagePort,ModalWindow,Notification,SVGElementInstance,Screen,TextTrack,TextTrackCue,TextTrackList,WebSocket,WebSocketWorker,Worker,XMLHttpRequest,XMLHttpRequestEventTarget,XMLHttpRequestUpload".split(",");for(g=0;g "some_value" } } + + # Add exception class names to the exception_level_filters hash to + # change the level that exception is reported at. Note that if an exception + # has already been reported and logged the level will need to be changed + # via the rollbar interface. + # Valid levels: 'critical', 'error', 'warning', 'info', 'debug', 'ignore' + # 'ignore' will cause the exception to not be reported at all. + # config.exception_level_filters.merge!('MyCriticalException' => 'critical') + # + # You can also specify a callable, which will be called with the exception instance. + # config.exception_level_filters.merge!('MyCriticalException' => lambda { |e| 'critical' }) + + # Enable asynchronous reporting (uses girl_friday or Threading if girl_friday + # is not installed) + # config.use_async = true + # Supply your own async handler: + # config.async_handler = Proc.new { |payload| + # Thread.new { Rollbar.process_payload_safely(payload) } + # } + + # Enable asynchronous reporting (using sucker_punch) + # config.use_sucker_punch + + # Enable delayed reporting (using Sidekiq) + # config.use_sidekiq + # You can supply custom Sidekiq options: + # config.use_sidekiq 'queue' => 'my_queue' +end