Temporary Rollbar additions

pull/303/head
Rick Carlino 2016-12-12 12:28:30 -06:00
parent 96b8ba28a4
commit dcf668fb31
3 changed files with 69 additions and 0 deletions

View File

@ -12,6 +12,7 @@ gem "ice_cube"
gem "rack-cors"
gem "mysql"
gem "database_cleaner"
gem "rollbar"
group :development, :test do
gem "sqlite3"

View File

@ -87,6 +87,7 @@ GEM
mime-types-data (3.2016.0521)
mini_portile2 (2.1.0)
minitest (5.9.1)
multi_json (1.12.1)
mutations (0.8.0)
activesupport
mysql (2.9.1)
@ -140,6 +141,8 @@ GEM
rake (11.3.0)
responders (2.3.0)
railties (>= 4.2.0, < 5.1)
rollbar (2.13.3)
multi_json
rspec (3.5.0)
rspec-core (~> 3.5.0)
rspec-expectations (~> 3.5.0)
@ -210,6 +213,7 @@ DEPENDENCIES
rails (= 5.0.0.1)
rails-erd
rails_12factor
rollbar
rspec
rspec-rails
simplecov

View File

@ -0,0 +1,64 @@
# NOTE ABOUT THIS FILE
#=================================================+
# PLEASE READ: |
#=================================================+
# FarmBot, Inc. uses Rollbar for error reporting. |
# Rollbar is a proprietary, paid product that |
# most users would not use on their own servers. |
# Our eventual plan is to remove this into its |
# own repo and out of the main app. |
# TODO: Move this into its own module. |
#=================================================+
class Device < ActiveRecord::Base
# This is for the error reporting tool.
def username
device.users.pluck(:name).join(" ")
end
# This is for the error reporting tool.
def email
device.users.pluck(:name).join(" ")
end
end
Rollbar.configure do |config|
config.access_token = ENV['ROLLBAR_ACCESS_TOKEN'] || "NO_ROLLBAR_ACCESS"
config.enabled = Rails.env.production? ? true : false
config.person_method = "current_device"
# 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_from_async_handler(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' => 'default'
# If you run your staging application instance in production environment then
# you'll want to override the environment reported by `Rails.env` with an
# environment variable like this: `ROLLBAR_ENV=staging`. This is a recommended
# setup for Heroku. See:
# https://devcenter.heroku.com/articles/deploying-to-a-custom-rails-environment
config.environment = $API_URL || ENV['ROLLBAR_ENV'] || Rails.env
end