rollbar 2.8.3 → 3.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (238) hide show
  1. checksums.yaml +5 -5
  2. data/.codeclimate.yml +18 -0
  3. data/.github/pull_request_template.md +34 -0
  4. data/.github/workflows/ci.yml +67 -0
  5. data/.gitignore +3 -1
  6. data/.rubocop.yml +206 -7
  7. data/Appraisals +10 -10
  8. data/CHANGELOG.md +257 -3
  9. data/Gemfile +74 -13
  10. data/README.md +38 -833
  11. data/Rakefile +0 -0
  12. data/THANKS.md +1 -0
  13. data/data/rollbar.snippet.js +1 -1
  14. data/docs/configuration.md +64 -3
  15. data/docs/plugins.md +46 -0
  16. data/gemfiles/rails50.gemfile +56 -0
  17. data/gemfiles/rails51.gemfile +57 -0
  18. data/gemfiles/rails52.gemfile +56 -0
  19. data/gemfiles/rails60.gemfile +52 -0
  20. data/gemfiles/rails61.gemfile +52 -0
  21. data/gemfiles/rails70.gemfile +52 -0
  22. data/gemfiles/rails71.gemfile +52 -0
  23. data/lib/generators/rollbar/rollbar_generator.rb +24 -20
  24. data/lib/generators/rollbar/templates/{initializer.rb → initializer.erb} +19 -5
  25. data/lib/rails/rollbar_runner.rb +26 -22
  26. data/lib/rollbar/capistrano.rb +78 -38
  27. data/lib/rollbar/capistrano3.rb +62 -1
  28. data/lib/rollbar/capistrano_tasks.rb +166 -0
  29. data/lib/rollbar/configuration.rb +291 -71
  30. data/lib/rollbar/delay/active_job.rb +17 -0
  31. data/lib/rollbar/delay/delayed_job.rb +23 -0
  32. data/lib/rollbar/delay/girl_friday.rb +4 -9
  33. data/lib/rollbar/delay/resque.rb +3 -6
  34. data/lib/rollbar/delay/shoryuken.rb +36 -0
  35. data/lib/rollbar/delay/sidekiq.rb +6 -8
  36. data/lib/rollbar/delay/sucker_punch.rb +17 -22
  37. data/lib/rollbar/delay/thread.rb +74 -3
  38. data/lib/rollbar/deploy.rb +91 -0
  39. data/lib/rollbar/encoding/encoder.rb +22 -11
  40. data/lib/rollbar/encoding.rb +2 -7
  41. data/lib/rollbar/exception_reporter.rb +36 -12
  42. data/lib/rollbar/item/backtrace.rb +118 -0
  43. data/lib/rollbar/item/frame.rb +121 -0
  44. data/lib/rollbar/item/locals.rb +103 -0
  45. data/lib/rollbar/item.rb +314 -0
  46. data/lib/rollbar/js.rb +0 -28
  47. data/lib/rollbar/json.rb +7 -55
  48. data/lib/rollbar/language_support.rb +7 -19
  49. data/lib/rollbar/lazy_store.rb +8 -12
  50. data/lib/rollbar/logger.rb +71 -0
  51. data/lib/rollbar/logger_proxy.rb +18 -1
  52. data/lib/rollbar/middleware/js/json_value.rb +36 -0
  53. data/lib/rollbar/middleware/js.rb +297 -0
  54. data/lib/rollbar/middleware/rack/builder.rb +4 -4
  55. data/lib/rollbar/middleware/rack/test_session.rb +4 -4
  56. data/lib/rollbar/middleware/rack.rb +52 -0
  57. data/lib/rollbar/middleware/rails/rollbar.rb +19 -7
  58. data/lib/rollbar/middleware/rails/show_exceptions.rb +21 -9
  59. data/lib/rollbar/middleware/sinatra.rb +2 -40
  60. data/lib/rollbar/notifier/trace_with_bindings.rb +75 -0
  61. data/lib/rollbar/notifier.rb +913 -0
  62. data/lib/rollbar/plugin.rb +126 -0
  63. data/lib/rollbar/plugins/active_job.rb +54 -0
  64. data/lib/rollbar/plugins/basic_socket.rb +31 -0
  65. data/lib/rollbar/plugins/delayed_job/job_data.rb +50 -0
  66. data/lib/rollbar/plugins/delayed_job/plugin.rb +88 -0
  67. data/lib/rollbar/plugins/delayed_job.rb +12 -0
  68. data/lib/rollbar/plugins/error_context.rb +11 -0
  69. data/lib/rollbar/plugins/goalie.rb +65 -0
  70. data/lib/rollbar/plugins/rack.rb +18 -0
  71. data/lib/rollbar/plugins/rails/controller_methods.rb +56 -0
  72. data/lib/rollbar/plugins/rails/error_subscriber.rb +12 -0
  73. data/lib/rollbar/plugins/rails/railtie30.rb +18 -0
  74. data/lib/rollbar/plugins/rails/railtie32.rb +18 -0
  75. data/lib/rollbar/plugins/rails/railtie_mixin.rb +37 -0
  76. data/lib/rollbar/plugins/rails.rb +89 -0
  77. data/lib/rollbar/plugins/rake.rb +73 -0
  78. data/lib/rollbar/plugins/resque/failure.rb +39 -0
  79. data/lib/rollbar/plugins/resque.rb +11 -0
  80. data/lib/rollbar/plugins/sidekiq/plugin.rb +77 -0
  81. data/lib/rollbar/plugins/sidekiq.rb +37 -0
  82. data/lib/rollbar/plugins/thread.rb +14 -0
  83. data/lib/rollbar/plugins/validations.rb +45 -0
  84. data/lib/rollbar/plugins.rb +47 -0
  85. data/lib/rollbar/rails.rb +0 -1
  86. data/lib/rollbar/rake_tasks.rb +4 -66
  87. data/lib/rollbar/request_data_extractor.rb +157 -117
  88. data/lib/rollbar/rollbar_test.rb +38 -0
  89. data/lib/rollbar/scrubbers/params.rb +133 -0
  90. data/lib/rollbar/scrubbers/url.rb +90 -35
  91. data/lib/rollbar/scrubbers.rb +13 -0
  92. data/lib/rollbar/truncation/frames_strategy.rb +2 -1
  93. data/lib/rollbar/truncation/min_body_strategy.rb +3 -4
  94. data/lib/rollbar/truncation/mixin.rb +1 -1
  95. data/lib/rollbar/truncation/remove_any_key_strategy.rb +126 -0
  96. data/lib/rollbar/truncation/remove_extra_strategy.rb +37 -0
  97. data/lib/rollbar/truncation/remove_request_strategy.rb +21 -0
  98. data/lib/rollbar/truncation/strings_strategy.rb +6 -5
  99. data/lib/rollbar/truncation.rb +10 -4
  100. data/lib/rollbar/util/hash.rb +37 -6
  101. data/lib/rollbar/util/ip_anonymizer.rb +33 -0
  102. data/lib/rollbar/util/ip_obfuscator.rb +1 -1
  103. data/lib/rollbar/util.rb +101 -55
  104. data/lib/rollbar/version.rb +1 -1
  105. data/lib/rollbar.rb +91 -879
  106. data/lib/tasks/benchmark.rake +104 -0
  107. data/lib/tasks/tasks.rake +3 -3
  108. data/rollbar.gemspec +21 -32
  109. data/spec/support/rollbar_api.rb +67 -0
  110. metadata +78 -439
  111. data/.travis.yml +0 -155
  112. data/gemfiles/rails30.gemfile +0 -20
  113. data/gemfiles/rails31.gemfile +0 -16
  114. data/gemfiles/rails32.gemfile +0 -17
  115. data/gemfiles/rails40.gemfile +0 -17
  116. data/gemfiles/rails41.gemfile +0 -15
  117. data/gemfiles/rails42.gemfile +0 -15
  118. data/lib/rollbar/active_job.rb +0 -11
  119. data/lib/rollbar/active_record_extension.rb +0 -14
  120. data/lib/rollbar/core_ext/basic_socket.rb +0 -7
  121. data/lib/rollbar/core_ext/thread.rb +0 -9
  122. data/lib/rollbar/delayed_job.rb +0 -78
  123. data/lib/rollbar/encoding/legacy_encoder.rb +0 -20
  124. data/lib/rollbar/goalie.rb +0 -33
  125. data/lib/rollbar/js/frameworks/rails.rb +0 -29
  126. data/lib/rollbar/js/frameworks.rb +0 -6
  127. data/lib/rollbar/js/middleware.rb +0 -129
  128. data/lib/rollbar/js/version.rb +0 -5
  129. data/lib/rollbar/json/default.rb +0 -11
  130. data/lib/rollbar/json/oj.rb +0 -15
  131. data/lib/rollbar/rack.rb +0 -9
  132. data/lib/rollbar/rails/controller_methods.rb +0 -40
  133. data/lib/rollbar/railtie.rb +0 -46
  134. data/lib/rollbar/rake.rb +0 -38
  135. data/lib/rollbar/sidekiq.rb +0 -40
  136. data/lib/rollbar/tasks/rollbar.cap +0 -45
  137. data/spec/cacert.pem +0 -3988
  138. data/spec/controllers/home_controller_spec.rb +0 -455
  139. data/spec/delay/sidekiq_spec.rb +0 -61
  140. data/spec/delay/sucker_punch_spec.rb +0 -25
  141. data/spec/delayed/backend/test.rb +0 -139
  142. data/spec/delayed/serialization/test.rb +0 -0
  143. data/spec/dummyapp/.gitignore +0 -73
  144. data/spec/dummyapp/Rakefile +0 -7
  145. data/spec/dummyapp/app/assets/javascripts/application.js +0 -3
  146. data/spec/dummyapp/app/assets/stylesheets/application.css.scss +0 -37
  147. data/spec/dummyapp/app/controllers/application_controller.rb +0 -3
  148. data/spec/dummyapp/app/controllers/home_controller.rb +0 -60
  149. data/spec/dummyapp/app/controllers/users_controller.rb +0 -17
  150. data/spec/dummyapp/app/helpers/.gitkeep +0 -0
  151. data/spec/dummyapp/app/mailers/.gitkeep +0 -0
  152. data/spec/dummyapp/app/models/.gitkeep +0 -0
  153. data/spec/dummyapp/app/models/user.rb +0 -7
  154. data/spec/dummyapp/app/views/devise/registrations/edit.html.erb +0 -27
  155. data/spec/dummyapp/app/views/devise/registrations/new.html.erb +0 -20
  156. data/spec/dummyapp/app/views/devise/shared/_links.html.erb +0 -25
  157. data/spec/dummyapp/app/views/home/cause_exception.html.erb +0 -1
  158. data/spec/dummyapp/app/views/home/index.html.erb +0 -4
  159. data/spec/dummyapp/app/views/home/report_exception.html.erb +0 -1
  160. data/spec/dummyapp/app/views/js/test.html.erb +0 -1
  161. data/spec/dummyapp/app/views/layouts/_messages.html.erb +0 -5
  162. data/spec/dummyapp/app/views/layouts/_navigation.html.erb +0 -21
  163. data/spec/dummyapp/app/views/layouts/application.html.erb +0 -25
  164. data/spec/dummyapp/app/views/layouts/simple.html.erb +0 -18
  165. data/spec/dummyapp/app/views/users/index.html.erb +0 -8
  166. data/spec/dummyapp/app/views/users/show.html.erb +0 -3
  167. data/spec/dummyapp/config/application.rb +0 -59
  168. data/spec/dummyapp/config/boot.rb +0 -10
  169. data/spec/dummyapp/config/database.yml +0 -25
  170. data/spec/dummyapp/config/environment.rb +0 -5
  171. data/spec/dummyapp/config/environments/development.rb +0 -37
  172. data/spec/dummyapp/config/environments/production.rb +0 -67
  173. data/spec/dummyapp/config/environments/test.rb +0 -37
  174. data/spec/dummyapp/config/initializers/backtrace_silencers.rb +0 -7
  175. data/spec/dummyapp/config/initializers/inflections.rb +0 -15
  176. data/spec/dummyapp/config/initializers/mime_types.rb +0 -5
  177. data/spec/dummyapp/config/initializers/rollbar.rb +0 -23
  178. data/spec/dummyapp/config/initializers/secret_token.rb +0 -7
  179. data/spec/dummyapp/config/initializers/session_store.rb +0 -8
  180. data/spec/dummyapp/config/initializers/wrap_parameters.rb +0 -16
  181. data/spec/dummyapp/config/locales/devise.en.yml +0 -58
  182. data/spec/dummyapp/config/locales/en.yml +0 -5
  183. data/spec/dummyapp/config/routes.rb +0 -17
  184. data/spec/dummyapp/config.ru +0 -4
  185. data/spec/dummyapp/db/migrate/20121121184652_devise_create_users.rb +0 -46
  186. data/spec/dummyapp/db/migrate/20121121184654_add_name_to_users.rb +0 -5
  187. data/spec/dummyapp/db/schema.rb +0 -35
  188. data/spec/dummyapp/db/seeds.rb +0 -12
  189. data/spec/dummyapp/lib/assets/.gitkeep +0 -0
  190. data/spec/dummyapp/public/404.html +0 -26
  191. data/spec/dummyapp/public/422.html +0 -26
  192. data/spec/dummyapp/public/500.html +0 -25
  193. data/spec/dummyapp/public/favicon.ico +0 -0
  194. data/spec/dummyapp/script/rails +0 -6
  195. data/spec/fixtures/file1 +0 -1
  196. data/spec/fixtures/file2 +0 -1
  197. data/spec/fixtures/payloads/message.json +0 -25
  198. data/spec/fixtures/payloads/sample.trace.json +0 -275
  199. data/spec/fixtures/payloads/sample.trace_chain.json +0 -530
  200. data/spec/generators/rollbar/rollbar_generator_spec.rb +0 -24
  201. data/spec/requests/home_spec.rb +0 -49
  202. data/spec/rollbar/active_job_spec.rb +0 -33
  203. data/spec/rollbar/configuration_spec.rb +0 -24
  204. data/spec/rollbar/delay/girl_friday_spec.rb +0 -41
  205. data/spec/rollbar/delay/resque_spec.rb +0 -37
  206. data/spec/rollbar/delay/thread_spec.rb +0 -27
  207. data/spec/rollbar/delayed_job/job_data.rb +0 -35
  208. data/spec/rollbar/delayed_job_spec.rb +0 -90
  209. data/spec/rollbar/encoding/encoder_spec.rb +0 -63
  210. data/spec/rollbar/js/frameworks/rails_spec.rb +0 -19
  211. data/spec/rollbar/js/middleware_spec.rb +0 -162
  212. data/spec/rollbar/json/oj_spec.rb +0 -18
  213. data/spec/rollbar/json_spec.rb +0 -110
  214. data/spec/rollbar/lazy_store_spec.rb +0 -99
  215. data/spec/rollbar/logger_proxy_spec.rb +0 -34
  216. data/spec/rollbar/middleware/rack/builder_spec.rb +0 -151
  217. data/spec/rollbar/middleware/sinatra_spec.rb +0 -197
  218. data/spec/rollbar/rake_spec.rb +0 -34
  219. data/spec/rollbar/request_data_extractor_spec.rb +0 -82
  220. data/spec/rollbar/scrubbers/url_spec.rb +0 -111
  221. data/spec/rollbar/sidekiq_spec.rb +0 -90
  222. data/spec/rollbar/truncation/frames_strategy_spec.rb +0 -70
  223. data/spec/rollbar/truncation/min_body_strategy_spec.rb +0 -57
  224. data/spec/rollbar/truncation/strings_strategy_spec.rb +0 -89
  225. data/spec/rollbar/truncation_spec.rb +0 -27
  226. data/spec/rollbar/util/hash_spec.rb +0 -22
  227. data/spec/rollbar/util_spec.rb +0 -19
  228. data/spec/rollbar_bc_spec.rb +0 -380
  229. data/spec/rollbar_spec.rb +0 -2067
  230. data/spec/spec_helper.rb +0 -49
  231. data/spec/support/cause_exception.rb +0 -1
  232. data/spec/support/encoding_helpers.rb +0 -8
  233. data/spec/support/encodings/iso_8859_9 +0 -1
  234. data/spec/support/fixture_helpers.rb +0 -10
  235. data/spec/support/get_ip_raising.rb +0 -7
  236. data/spec/support/helpers.rb +0 -5
  237. data/spec/support/notifier_helpers.rb +0 -36
  238. data/spec/support/shared_contexts.rb +0 -12
data/README.md CHANGED
@@ -1,866 +1,68 @@
1
- # Rollbar notifier for Ruby [![Build Status](https://api.travis-ci.org/rollbar/rollbar-gem.svg?branch=v2.8.3)](https://travis-ci.org/rollbar/rollbar-gem/branches)
1
+ <p align="center">
2
+ <img alt="rollbar-logo" src="https://user-images.githubusercontent.com/3300063/207964480-54eda665-d6fe-4527-ba51-b0ab3f41f10b.png" />
3
+ </p>
2
4
 
3
- <!-- RemoveNext -->
4
- [Rollbar](https://rollbar.com) is an error tracking service for Ruby and other languages. The Rollbar service will alert you of problems with your code and help you understand them in a ways never possible before. We love it and we hope you will too.
5
+ <h1 align="center">Rollbar Ruby Gem</h1>
5
6
 
6
- This is the Ruby library for Rollbar. It will instrument many kinds of Ruby applications automatically at the framework level. You can also make direct calls to send exceptions and messages to Rollbar.
7
+ <p align="center">
8
+ <strong>Proactively discover, predict, and resolve errors in real-time with <a href="https://rollbar.com">Rollbar’s</a> error monitoring platform. <a href="https://rollbar.com/signup/">Start tracking errors today</a>!</strong>
9
+ </p>
7
10
 
8
- <!-- Sub:[TOC] -->
9
11
 
10
- ## Getting Started
12
+ ![Build Status](https://github.com/rollbar/rollbar-gem/workflows/Rollbar-gem%20CI/badge.svg?tag=latest)
13
+ [![Gem Version](https://badge.fury.io/rb/rollbar.svg)](http://badge.fury.io/rb/rollbar)
14
+ [![SemVer](https://api.dependabot.com/badges/compatibility_score?dependency-name=rollbar&package-manager=bundler&version-scheme=semver&target-version=latest)](https://dependabot.com/compatibility-score.html?dependency-name=rollbar&package-manager=bundler&version-scheme=semver&new-version=latest)
11
15
 
12
- Add this line to your application's Gemfile:
13
16
 
14
- ```ruby
15
- gem 'rollbar', '~> 2.8.3'
16
- ```
17
+ ---
17
18
 
18
- And then execute:
19
+ [Rollbar](https://rollbar.com) is a real-time exception reporting service for Ruby and other languages. The Rollbar service will alert you of problems with your code and help you understand them in a ways never possible before. We love it and we hope you will too.
19
20
 
20
- ```bash
21
- $ bundle install
22
- # Or if you don't use bundler:
23
- $ gem install rollbar
24
- ```
21
+ Rollbar-gem is the SDK for Ruby apps and includes support for apps using Rails, Sinatra, Rack, plain Ruby, and other frameworks.
25
22
 
26
- Unless you are using JRuby, we suggest also installing [Oj](https://github.com/ohler55/oj) for JSON serialization. Add this line to your Gemfile:
27
23
 
28
- ```ruby
29
- gem 'oj', '~> 2.12.14'
30
- ```
24
+ ## Key benefits of using Rollbar Ruby Gem are:
31
25
 
32
- and then `bundle install` again.
26
+ - **Frameworks:** Rollbar Ruby Gem supports popular Ruby frameworks such as <a href="https://docs.rollbar.com/docs/rails">Rails</a>, <a href="https://docs.rollbar.com/docs/sinatra">Sinatra</a>, <a href="https://docs.rollbar.com/docs/grape">Grape</a> and more.
27
+ - **Integrations:** Rollbar Ruby has integrations for <a href="https://docs.rollbar.com/docs/resque-integration">Resque</a>, <a href="https://docs.rollbar.com/docs/activejob-integration">ActiveJob</a>, <a href="https://docs.rollbar.com/docs/using-with-rollbar-agent">rollbar-agent</a>, <a href="https://docs.rollbar.com/docs/sidekiq-integration">Sidekiq</a> and more!
28
+ - **Automatic error grouping:** Rollbar aggregates Occurrences caused by the same error into Items that represent application issues. <a href="https://docs.rollbar.com/docs/grouping-occurrences">Learn more about reducing log noise</a>.
29
+ - **Advanced search:** Filter items by many different properties. <a href="https://docs.rollbar.com/docs/search-items">Learn more about search</a>.
30
+ - **Customizable notifications:** Rollbar supports several messaging and incident management tools where your team can get notified about errors and important events by real-time alerts. <a href="https://docs.rollbar.com/docs/notifications">Learn more about Rollbar notifications</a>.
33
31
 
34
- ### If using Rails
35
32
 
36
- Run the following command from your Rails root:
33
+ ## Setup Instructions
37
34
 
38
- ```bash
39
- $ rails generate rollbar POST_SERVER_ITEM_ACCESS_TOKEN
40
- ```
35
+ 1. [Sign up for a Rollbar account](https://rollbar.com/signup)
36
+ 2. Follow the [Getting Started](https://docs.rollbar.com/docs/ruby#section-getting-started) instructions in our [Ruby SDK docs](https://docs.rollbar.com/docs/ruby) to install rollbar-gem and configure it for your platform.
41
37
 
42
- <!-- RemoveNextIfProject -->
43
- Be sure to replace ```POST_SERVER_ITEM_ACCESS_TOKEN``` with your project's ```post_server_item``` access token, which you can find in the Rollbar.com interface.
38
+ ## Usage and Reference
44
39
 
45
- That will create the file ```config/initializers/rollbar.rb```, which initializes Rollbar and holds your access token and other configuration values.
40
+ For complete usage instructions and configuration reference, see our [Ruby SDK docs](https://docs.rollbar.com/docs/ruby).
46
41
 
47
- If you want to store your access token outside of your repo, run the same command without arguments and create an environment variable ```ROLLBAR_ACCESS_TOKEN``` that holds your server-side access token:
42
+ ## Compatibility
48
43
 
49
- ```bash
50
- $ rails generate rollbar
51
- $ export ROLLBAR_ACCESS_TOKEN=POST_SERVER_ITEM_ACCESS_TOKEN
52
- ```
44
+ Version >= 3.0.0 is compatible with Ruby >= 2.0.0.
53
45
 
54
- For Heroku users:
46
+ Version >= 2.19.0 is compatible with Ruby >= 1.9.3.
55
47
 
56
- If you're on Heroku, you can store the access token in your Heroku config:
48
+ Version < 2.19.0 is compatible with Ruby >= 1.8.7.
57
49
 
58
- ```bash
59
- $ heroku config:add ROLLBAR_ACCESS_TOKEN=POST_SERVER_ITEM_ACCESS_TOKEN
60
- ```
50
+ ### Ruby 2.6.0
61
51
 
62
- That's all you need to use Rollbar with Rails.
52
+ > WARNING: Ruby 2.6.0 introduced a new bug ([#15472 -
53
+ Invalid JSON data being sent from Net::HTTP in some cases with Ruby 2.6.0](https://bugs.ruby-lang.org/issues/15472)) that may result in the Rollbar API returning an error when an exception is reported. (See [rollbar-gem issue #797](https://github.com/rollbar/rollbar-gem/issues/797)).
63
54
 
55
+ > UPDATE: This bug is fixed in Ruby 2.6.1, and rollbar-gem has a safe workaround in version >= 2.19.0.
56
+ If you need to stay on Ruby 2.6.0 for any reason, make sure you have the latest rollbar-gem.
64
57
 
65
- ### If using Rack
58
+ ## Release History & Changelog
66
59
 
67
- Initialize Rollbar with your access token somewhere during startup:
68
-
69
- ```ruby
70
- Rollbar.configure do |config|
71
- config.access_token = 'POST_SERVER_ITEM_ACCESS_TOKEN'
72
- # other configuration settings
73
- # ...
74
- end
75
- ```
76
-
77
- <!-- RemoveNextIfProject -->
78
- Be sure to replace ```POST_SERVER_ITEM_ACCESS_TOKEN``` with your project's ```post_server_item``` access token, which you can find in the Rollbar.com interface.
79
-
80
- This monkey patches `Rack::Builder` to work with Rollbar automatically.
81
-
82
- For more control, disable the monkey patch:
83
-
84
- ```ruby
85
- Rollbar.configure do |config|
86
- config.disable_monkey_patch = true
87
- # other configuration settings
88
- # ...
89
- end
90
- ```
91
-
92
- Then mount the middleware in your app, like:
93
-
94
- ```ruby
95
- class MyApp < Sinatra::Base
96
- use Rollbar::Middleware::Sinatra
97
- # other middleware/etc
98
- # ...
99
- end
100
- ```
101
-
102
- ### If using Plain Ruby
103
-
104
- Rollbar isn't dependent on Rack or Rails for most of its functionality. In a regular script, assuming you've
105
- installed the rollbar gem:
106
-
107
- 1. Require rollbar
108
- 2. Configure rollbar
109
- 3. Send Rollbar data
110
-
111
- ```ruby
112
- require 'rollbar'
113
-
114
- Rollbar.configure do |config|
115
- config.access_token = "POST_SERVER_ITEM_ACCESS_TOKEN"
116
- # Other Configuration Settings
117
- end
118
-
119
- Rollbar.debug("Running Script")
120
-
121
- begin
122
- run_script ARGV
123
- rescue Exception => e # Never rescue Exception *unless* you re-raise in rescue body
124
- Rollbar.error(e)
125
- raise e
126
- end
127
-
128
- Rollbar.info("Script ran successfully")
129
- ```
130
-
131
-
132
- ## Integration with Rollbar.js
133
-
134
- In case you want to report your JavaScript errors using [Rollbar.js](https://github.com/rollbar/rollbar.js), you can configure the gem to enable Rollbar.js on your site. Example:
135
-
136
- ```ruby
137
- Rollbar.configure do |config|
138
- # common gem configuration
139
- # ...
140
- config.js_enabled = true
141
- config.js_options = {
142
- accessToken: "POST_CLIENT_ITEM_ACCESS_TOKEN",
143
- captureUncaught: true,
144
- payload: {
145
- environment: "production"
146
- }
147
- }
148
- end
149
- ```
150
-
151
- The `Hash` passed to `#js_options=` should have the same availalbe options that you can find in [Rollbar.js](https://github.com/rollbar/rollbar.js), using symbols or strings for the keys.
152
-
153
- ## Test your installation
154
-
155
- To confirm that it worked, run:
156
-
157
- ```bash
158
- $ rake rollbar:test
159
- ```
160
-
161
- This will raise an exception within a test request; if it works, you'll see a stacktrace in the console, and the exception will appear in the Rollbar dashboard.
162
-
163
- ## Usage
164
-
165
- ### Uncaught exceptions
166
-
167
- Uncaught exceptions in Rails controllers will be automatically reported to Rollbar.
168
-
169
- ### Caught exceptions and messages
170
-
171
- You can use one of `Rollbar.log(level, ...)`, `Rollbar.debug()`, `Rollbar.info()`, `Rollbar.warning()`, `Rollbar.error()` and `Rollbar.critical()` to report exceptions and messages.
172
-
173
- The methods accept any number of arguments. The last exception is used as the reported exception, the last string is used as the message/description, and the last hash is used as the extra data.
174
-
175
- For example:
176
-
177
- ```ruby
178
- begin
179
- result = user_info[:key1][:key2][:key3]
180
- rescue NoMethodError => e
181
- # simple exception report (level can be 'debug', 'info', 'warning', 'error' and 'critical')
182
- Rollbar.log('error', e)
183
-
184
- # same functionality as above
185
- Rollbar.error(e)
186
-
187
- # with a description
188
- Rollbar.error(e, 'The user info hash doesn\'t contain the correct data')
189
-
190
- # with extra data giving more insight about the exception
191
- Rollbar.error(e, :user_info => user_info, :job_id => job_id)
192
- end
193
- ```
194
-
195
- You can also log individual messages:
196
-
197
- ```ruby
198
- Rollbar.warning('Unexpected input')
199
-
200
- # can also include extra data
201
- Rollbar.info("Login successful", :username => @username)
202
-
203
- Rollbar.log('debug', 'Settings saved', :account_id => account.id)
204
- ```
205
-
206
- ### Reporting form validation errors
207
-
208
- To get form validation errors automatically reported to Rollbar just add the following ```after_validation``` callback to your models:
209
-
210
- ```ruby
211
- after_validation :report_validation_errors_to_rollbar
212
- ```
213
-
214
- ### Advanced usage
215
-
216
- You can use `Rollbar.scope()` to copy a notifier instance and customize the payload data for one-off reporting. The hash argument to `scope()` will be merged into the copied notifier's "payload options", a hash that will be merged into the final payload just before it is reported to Rollbar.
217
-
218
- For example:
219
-
220
- ```ruby
221
- while job
222
- user = job.user
223
-
224
- # Overwrites any existing person data
225
- notifier = Rollbar.scope({
226
- :person => {:id => user.id, :username => user.username, :email => user.email}
227
- })
228
-
229
- begin
230
- job.do_work
231
- rescue => e
232
- # Sends a report with the above person data
233
- notifier.critical(e)
234
- end
235
-
236
- job = next_job
237
- end
238
-
239
- # Wipe person data
240
- notifier = notifier.scope({
241
- :person => nil
242
- })
243
-
244
- # No associated person data
245
- notifier.info('Jobs processed')
246
- ```
247
-
248
- If you don't want to work with a new `Notifier` instance `.scoped` will do it for you:
249
-
250
- ```ruby
251
- while job
252
- user = job.user
253
-
254
- # Overwrites any existing person data
255
- scope = {
256
- :person => {:id => user.id, :username => user.username, :email => user.email}
257
- }
258
-
259
- Rollbar.scoped(scope) do
260
- begin
261
- job.do_work
262
- rescue => e
263
- # Sends a report with the above person data
264
- Rollbar.critical(e)
265
- end
266
- end
267
-
268
- job = next_job
269
- end
270
- ```
271
-
272
- To modify the current scope (rather than creating a new one), use `Rollbar.scope!`. You can use this to add additional context data from inside a web request, background job, etc.
273
-
274
- ```ruby
275
- class NotificationJob
276
- include Sidekiq::Worker
277
-
278
- def perform(user_id)
279
- Rollbar.scope!(:person => { :id => :user_id })
280
-
281
- # If this next line causes an exception, the reported exception (which will
282
- # be reported by Rollbar's standard Sidekiq instrumentation) will also
283
- # include the above person information.
284
- Notification.send_to_user(user_id)
285
- end
286
- end
287
- ```
288
-
289
-
290
- ## Person tracking
291
-
292
- Rollbar will send information about the current user (called a "person" in Rollbar parlance) along with each error report, when available. This works by calling the ```current_user``` controller method. The return value should be an object with an ```id``` method and, optionally, ```username``` and ```email``` methods.
293
-
294
- This will happen automatically for uncaught Rails exceptions and for any manual exception or log reporting done within a Rails request.
295
-
296
- If the gem should call a controller method besides ```current_user```, add the following in ```config/initializers/rollbar.rb```:
297
-
298
- ```ruby
299
- Rollbar.configure do |config|
300
- config.person_method = "my_current_user"
301
- end
302
- ```
303
-
304
- If the methods to extract the ```id```, ```username```, and ```email``` from the object returned by the ```person_method``` have other names, configure like so in ```config/initializers/rollbar.rb```:
305
-
306
- ```ruby
307
- Rollbar.configure do |config|
308
- config.person_id_method = "user_id" # default is "id"
309
- config.person_username_method = "user_name" # default is "username"
310
- config.person_email_method = "email_address" # default is "email"
311
- end
312
- ```
313
-
314
- ### Person tracking with Rack applications
315
-
316
- To track information about the current user in non-Rails applications, you can populate the `rollbar.person_data` key in the Rack environment with the desired data. Its value should be a hash like:
317
-
318
- ```ruby
319
- {
320
- :id => "123", # required; string up to 40 characters
321
- :username => "adalovelace", # optional; string up to 255 characters
322
- :email => "ada@lovelace.net" # optional; string up to 255 characters
323
- }
324
- ```
325
-
326
- Because Rack applications can vary so widely, we don't provide a default implementation in the gem, but here is an example middleware:
327
-
328
- ```ruby
329
- class RollbarPersonData
330
- def initialize(app)
331
- @app = app
332
- end
333
-
334
- def call(env)
335
- token = Rack::Request.new(env).params['token']
336
- user = User.find_by_token(token)
337
-
338
- if user
339
- env['rollbar.person_data'] = extract_person_data(user)
340
- end
341
-
342
- @app.call(env)
343
- end
344
-
345
- def extract_person_data(user)
346
- {
347
- id: user.id,
348
- username: user.username,
349
- email: user.email
350
- }
351
- end
352
- end
353
-
354
- # You can add the middleware to your application, for example:
355
-
356
- class App < Sinatra::Base
357
- use Rollbar::Middleware::Sinatra
358
- use RollbarPersonData
359
-
360
- # ...
361
- # ...
362
- end
363
- ```
364
-
365
- ## Special note about reporting within a request
366
-
367
- The gem instantiates one `Notifier` instance on initialization, which will be the base notifier that is used for all reporting (via a `method_missing` proxy in the `Rollbar` module). Calling `Rollbar.configure()` will configure this base notifier that will be used globally in a ruby app.
368
-
369
- However, the Rails middleware will actually scope this base notifier for use within a request by storing it in thread-local storage (see [here](https://github.com/rollbar/rollbar-gem/blob/5f4e6135f0e61148672b0190c88767aa52e5cdb3/lib/rollbar/middleware/rails/rollbar.rb#L35-L39)). This is done to make any manual logging within a request automatically contain request and person data. Calling `Rollbar.configure()` therefore will only affect the notifier for the duration of the request, and not the base notifier used globally.
370
-
371
- ## Data sanitization (scrubbing)
372
-
373
- By default, the notifier will "scrub" the following fields from payloads before sending to Rollbar
374
-
375
- - ```:passwd```
376
- - ```:password```
377
- - ```:password_confirmation```
378
- - ```:secret```
379
- - ```:confirm_password```
380
- - ```:password_confirmation```
381
- - ```:secret_token```
382
-
383
- And the following http header
384
-
385
- - ```"Authorization"```
386
-
387
- If a request contains one of these fields, the value will be replaced with a ```"*"``` before being sent.
388
-
389
- Additional fields can be scrubbed by updating ```Rollbar.configuration.scrub_fields```:
390
-
391
- ```ruby
392
- # scrub out the "user_password" field
393
- Rollbar.configuration.scrub_fields |= [:user_password]
394
- ```
395
-
396
- And ```Rollbar.configuration.scrub_headers```:
397
-
398
- ```ruby
399
- # scrub out the "X-Access-Token" http header
400
- Rollbar.configuration.scrub_headers |= ["X-Access-Token"]
401
- ```
402
-
403
- If you want to obfuscate the user IP reported to the Rollbar API you can configure a secret to do it and a different IP address from the original will be reported:
404
-
405
- ```
406
- Rollbar.configuration.user_ip_obfuscator_secret = "a-private-secret-here"
407
- ```
408
-
409
- ## Including additional runtime data
410
-
411
- You can provide a callable that will be called for each exception or message report. ```custom_data_method``` should be a lambda that takes no arguments and returns a hash.
412
-
413
- Add the following in ```config/initializers/rollbar.rb```:
414
-
415
- ```ruby
416
- config.custom_data_method = lambda {
417
- { :some_key => :some_value, :complex_key => {:a => 1, :b => [2, 3, 4]} }
418
- }
419
- ```
420
-
421
- This data will appear in the Occurrences tab and on the Occurrence Detail pages in the Rollbar interface.
422
-
423
- If your `custom_data_method` crashes while reporting an error, Rollbar will report that new error and will attach its uuid URL to the parent error report.
424
-
425
- ## Exception level filters
426
-
427
- By default, all uncaught exceptions are reported at the "error" level, except for the following, which are reported at "warning" level:
428
-
429
- - ```ActiveRecord::RecordNotFound```
430
- - ```AbstractController::ActionNotFound```
431
- - ```ActionController::RoutingError```
432
-
433
- If you'd like to customize this list, modify the example code in ```config/initializers/rollbar.rb```. Supported levels: "critical", "error", "warning", "info", "debug", "ignore". Set to "ignore" to cause the exception not to be reported at all. For example, to ignore 404s and treat `NoMethodError`s as critical bugs, you can use the following code:
434
-
435
- ```ruby
436
- config.exception_level_filters.merge!({
437
- 'ActiveRecord::RecordNotFound' => 'ignore',
438
- 'NoMethodError' => 'critical'
439
- })
440
- ```
441
-
442
- This behavior applies to uncaught exceptions, not direct calls to `Rollbar.error()`, `Rollbar.warning()`, etc. If you are making a direct call to one of the log methods and want exception level filters to apply, pass an extra keyword argument:
443
-
444
- ```ruby
445
- Rollbar.error(exception, :use_exception_level_filters => true)
446
- ```
447
-
448
- ## [Before process hook](#before-process-hook)
449
-
450
- Before we process data sent to Rollbar.log (or Rollbar.error/info/etc.) to build and send the payload, the gem will call the handlers defined in `configuration.before_process`. This handlers should be `Proc` objects or objects responding to `#call` method. The received argument is a `Hash` object with these keys:
451
-
452
- - `level`: the level used for the report.
453
- - `exception`: the exception that caused the report, if any.
454
- - `message`: the message to use for the report, if any.
455
- - `extra`: extra data passed to the report methods.
456
- - `scope`: the current Scope; see [Scope](#the-scope)
457
-
458
- If the exception `Rollbar::Ignore` is raised inside any of the handlers defined for `configuration.before_process`, we'll ignore the report and not send it to the API. For example:
459
-
460
- ```ruby
461
- handler = proc do |options|
462
- raise Rollbar::Ignore if any_smart_method(options)
463
- end
464
-
465
- Rollbar.configure do |config|
466
- config.before_process << handler
467
- end
468
- ```
469
-
470
- ## [Transform hook](#transform-hook)
471
-
472
- After the payload is built but before it it sent to our API, the gem will call the handlers defined in `configuration.transform`. This handlers should be `Proc` objects or objects responding to `#call` method. The received argument is a `Hash` object with these keys:
473
-
474
- - `level`: the level used for the report.
475
- - `exception`: the exception that caused the report, if any.
476
- - `message`: the message to use for the report, if any.
477
- - `extra`: extra data passed to the report methods.
478
- - `scope`: the current Scope; see [Scope](#the-scope)
479
- - `payload`: the built payload that will be sent to the API
480
-
481
- Handlers may mutate the payload. For example:
482
-
483
- ```ruby
484
- handler = proc do |options|
485
- payload = options[:payload]
486
-
487
- payload['data']['environment'] = 'foo'
488
- end
489
-
490
- Rollbar.configure do |config|
491
- config.before_process << handler
492
- end
493
- ```
494
-
495
- ## [The Scope](#the-scope)
496
-
497
- The scope an object, an instance of `Rollbar::LazyStore` that stores the current context data for a certain moment or situation. For example, the Rails middleware defines the scope in a way similar to this:
498
-
499
- ```ruby
500
- scope = {request: request_data,
501
- person: person_data,
502
- context: context_data
503
- }
504
- Rollbar.scoped(scope) do
505
- begin
506
- @app.call(env)
507
- rescue Exception => exception
508
- # ...
509
- end
510
- end
511
-
512
- ```
513
-
514
- You can access the scope on the [before_process](#before-process-hook) and [transform](#transform-hook) hooks like this:
515
-
516
- ```ruby
517
- your_handler = proc do |options|
518
- scope = options[:scope]
519
-
520
- request_data = scope[:request]
521
- person_data = scope[:person]
522
- context_data = scope[:context]
523
- end
524
- ```
525
-
526
- ## Silencing exceptions at runtime
527
-
528
- If you just want to disable exception reporting for a single block, use ```Rollbar.silenced```:
529
-
530
- ```ruby
531
- Rollbar.silenced {
532
- foo = bar # will not be reported
533
- }
534
- ```
535
-
536
- # Sending backtrace without rescued exceptions
537
-
538
- If you use the gem in this way:
539
-
540
- ```ruby
541
- exception = MyException.new('this is a message')
542
- Rollbar.error(exception)
543
- ```
544
-
545
- You will notice a backtrace doesn't appear in your Rollbar dashboard. This is because `exception.backtrace` is `nil` in these cases. We can send the current backtrace for you even if your exception doesn't have it. In order to enable this feature you should configure Rollbar in this way:
546
-
547
- ```ruby
548
- Rollbar.configure do |config|
549
- config.populate_empty_backtraces = true
550
- end
551
- ```
552
-
553
- ## ActiveJob integration
554
-
555
- Include the module `Rollbar::ActiveJob` in you jobs to report any uncaught errors in a job to Rollbar.
556
-
557
- ```ruby
558
- class YourAwesomeJob < ActiveJob::Base
559
- include Rollbar::ActiveJob
560
- end
561
- ```
562
-
563
- If you need to customize the reporting write your own `rescue_from` handler instead of using the `Rollbar::ActiveJob` module.
564
-
565
- ## Delayed::Job integration
566
-
567
- If `delayed_job` is defined, Rollbar will automatically install a plugin that reports any uncaught exceptions that occur in jobs.
568
-
569
- By default, the job's data will be included in the report. If you want to disable this functionality to prevent sensitive data from possibly being sent, use the following configuration option:
570
-
571
- ```ruby
572
- config.report_dj_data = false # default is true
573
- ```
574
-
575
- You can also change the threshold of job retries that must occur before a job is reported to Rollbar:
576
-
577
- ```ruby
578
- config.dj_threshold = 2 # default is 0
579
- ```
580
-
581
- If you use [custom jobs](https://github.com/collectiveidea/delayed_job#custom-jobs) that define their own hooks to report exceptions, please consider disabling our plugin. Not doing so will result in duplicate exceptions being reported as well as lack of control when exceptions should be reported. To disable our Delayed::Job plugin, add the following line after the `Rollbar.configure` block.
582
-
583
- ```ruby
584
- config.delayed_job_enabled = false
585
- ```
586
-
587
- Only versions >= 3.0 of delayed_job are supported.
588
-
589
-
590
- ## Asynchronous reporting
591
-
592
- By default, all messages are reported synchronously. You can enable asynchronous reporting with [girl_friday](https://github.com/mperham/girl_friday), [sucker_punch](https://github.com/brandonhilkert/sucker_punch), [Sidekiq](https://github.com/mperham/sidekiq), [Resque](https://github.com/resque/resque) or using threading.
593
-
594
- ### Using girl_friday
595
-
596
- Add the following in ```config/initializers/rollbar.rb```:
597
-
598
- ```ruby
599
- config.use_async = true
600
- ```
601
-
602
- Asynchronous reporting falls back to Threading if girl_friday is not installed.
603
-
604
- ### Using sucker_punch
605
-
606
- Add the following in ```config/initializers/rollbar.rb```:
607
-
608
- ```ruby
609
- config.use_sucker_punch
610
- ```
611
-
612
- ### Using Sidekiq
613
-
614
- Add the following in ```config/initializers/rollbar.rb```:
615
-
616
- ```ruby
617
- config.use_sidekiq
618
- ```
619
-
620
-
621
- The default Sidekiq queue will be `rollbar` but you can also supply custom Sidekiq options:
622
-
623
- ```ruby
624
- config.use_sidekiq 'queue' => 'default'
625
- ```
626
-
627
- Start the redis server:
628
-
629
- ```bash
630
- $ redis-server
631
- ```
632
-
633
- Start Sidekiq from the root directory of your Rails app and declare the name of your queue. Unless you've configured otherwise, the queue name is "rollbar":
634
-
635
- ```bash
636
- $ bundle exec sidekiq -q rollbar
637
- ```
638
-
639
- For every errored job a new report will be sent to Rollbar API, also for errored retried jobs. You can configure the retries threshold to start reporting to rollbar:
640
-
641
- ```ruby
642
- config.sidekiq_threshold = 3 # Start reporting from 3 retries jobs
643
- ```
644
-
645
- ### Using Resque
646
-
647
- Add the following in ```config/initializers/rollbar.rb```:
648
-
649
- ```ruby
650
- config.use_resque
651
- ```
652
-
653
- You can also supply a custom Resque queue:
654
-
655
- ```ruby
656
- config.use_resque :queue => 'my_queue'
657
- ```
658
-
659
- Now you can just start a new Resque worker processing jobs in that queue:
660
-
661
- ```bash
662
- $ QUEUE=my_queue bundle exec resque:work
663
- ```
664
-
665
- ### Using threading
666
-
667
- Add the following in ```config/initializers/rollbar.rb```:
668
-
669
- ```ruby
670
- config.use_thread
671
- ```
672
-
673
- ### Using another handler
674
-
675
- You can supply your own handler using ```config.async_handler```. The object to set for `async_handler` should respond to `#call` and receive the payload. The handler should schedule the payload for later processing (i.e. with a delayed_job, in a resque queue, etc.) and should itself return immediately. For example:
676
-
677
- ```ruby
678
- config.use_async = true
679
- config.async_handler = Proc.new { |payload|
680
- Thread.new { Rollbar.process_from_async_handler(payload) }
681
- }
682
- ```
683
-
684
- Make sure you pass ```payload``` to ```Rollbar.process_from_async_handler``` in your own implementation.
685
-
686
- ## Failover handlers
687
-
688
- If you are using `async_handler` to process asynchronous the error it's possible that the handler fails before it calls `Rollbar.process_payload`. For example, for the Resque handler, the Redis connection could fail so the job is finally not processed.
689
-
690
- To ensure that the error is sent you can define a chain of failover handlers that Rollbar will use to send the payload in case that the primary handler fails. The failover handlers, as for `async_handler`, are just objects responding to `#call`.
691
-
692
- To configure the failover handlers you can add the following:
693
-
694
- ```ruby
695
- config.use_resque
696
- config.failover_handlers = [Rollbar::Delay::GirlFriday, Rollbar::Delay::Thread]
697
- ```
698
-
699
- With the configuration above Resque will be your primary asynchronous handler but if it fails queueing the job Rollbar will use GirlFriday at first, and just a thread in case that GirlFriday fails too.
700
-
701
- ## Using with rollbar-agent
702
-
703
- For even more asynchrony, you can configure the gem to write to a file instead of sending the payload to Rollbar servers directly. [rollbar-agent](https://github.com/rollbar/rollbar-agent) can then be hooked up to this file to actually send the payload across. To enable, add the following in ```config/initializers/rollbar.rb```:
704
-
705
- ```ruby
706
- config.write_to_file = true
707
- # optional, defaults to "#{AppName}.rollbar"
708
- config.filepath = '/path/to/file.rollbar' #should end in '.rollbar' for use with rollbar-agent
709
- ```
710
-
711
- For this to work, you'll also need to set up rollbar-agent--see its docs for details.
712
-
713
- ## Rails booting process
714
-
715
- Rails doesn't provide a way to hook into its booting process, so we can't catch errors during boot out of the box. To report these errors to Rollbar, make the following changes to your project files.
716
-
717
- First, move your `config/initializers/rollbar.rb` file to `config/rollbar.rb`. Then be sure your `config/environment.rb` looks similar to this:
718
-
719
- ```ruby
720
- # config/environment.rb
721
-
722
- require File.expand_path('../application', __FILE__)
723
- require File.expand_path('../rollbar', __FILE__)
724
-
725
- begin
726
- Rails.application.initialize!
727
- rescue Exception => e
728
- Rollbar.error(e)
729
- raise
730
- end
731
- ```
732
-
733
- How this works: first, Rollbar config (which is now at `config/rollbar.rb` is required). Later, `Rails.application/initialize` statement is wrapped with a `begin/rescue` and any exceptions within will be reported to Rollbar.
734
-
735
- ## Rails runner command
736
-
737
- We aren't able to instrument `rails runner` directly, but we do provide a wrapper, `rollbar-rails-runner`, which you can use to capture errors when running commands in a `rails runner`-like way. For example:
738
-
739
- ```shell
740
- $ bundle exec rollbar-rails-runner 'puts User.count'
741
- 45
742
- ```
743
-
744
- If an error occurs during that command, the exception will be reported to Rollbar.
745
-
746
- ## Deploy Tracking with Capistrano
747
-
748
- ### Capistrano 3
749
-
750
- Add to your `Capfile`:
751
-
752
- ```ruby
753
- require 'rollbar/capistrano3'
754
- ```
755
-
756
- And then, to your `deploy.rb`:
757
-
758
- ```ruby
759
- set :rollbar_token, 'POST_SERVER_ITEM_ACCESS_TOKEN'
760
- set :rollbar_env, Proc.new { fetch :stage }
761
- set :rollbar_role, Proc.new { :app }
762
- ```
763
-
764
- NOTE: We've seen problems with Capistrano version `3.0.x` where the revision reported is incorrect. Version `3.1.0` and higher works correctly.
765
-
766
- ### Capistrano 2
767
-
768
- Add the following to ```deploy.rb```:
769
-
770
- ```ruby
771
- require 'rollbar/capistrano'
772
- set :rollbar_token, 'POST_SERVER_ITEM_ACCESS_TOKEN'
773
- ```
774
-
775
- Available options:
776
-
777
- <dl>
778
- <dt>rollbar_token</dt>
779
- <dd>The same project access token as you used for the ```rails generate rollbar``` command; find it in ```config/initializers/rollbar.rb```. (It's repeated here for performance reasons, so the rails environment doesn't have to be initialized.)
780
- </dd>
781
- <dt>rollbar_env</dt>
782
- <dd>Deploy environment name
783
-
784
- Default: ```rails_env```
785
-
786
- </dd>
787
- </dl>
788
-
789
- For ```capistrano/multistage```, try:
790
-
791
- ```ruby
792
- set(:rollbar_env) { stage }
793
- ```
794
-
795
- ## Counting specific gems as in-project code
796
-
797
- In the Rollbar interface, stacktraces are shown with in-project code expanded and other code collapsed. Stack frames are counted as in-project if they occur in a file that is inside of the `configuration.root` (automatically set to ```Rails.root``` if you're using Rails). The collapsed sections can be expanded by clicking on them.
798
-
799
- If you want code from some specific gems to start expanded as well, you can configure this in ```config/initializers/rollbar.rb```:
800
-
801
- ```ruby
802
- Rollbar.configure do |config |
803
- config.access_token = '...'
804
- config.project_gems = ['my_custom_gem', 'my_other_gem']
805
- end
806
- ```
807
-
808
- ## Using with Goalie
809
-
810
- If you're using [Goalie](https://github.com/obvio171/goalie) for custom error pages, you may need to explicitly add ```require 'goalie'``` to ```config/application.rb``` (in addition to ```require 'goalie/rails'```) so that the monkeypatch will work. (This will be obvious if it is needed because your app won't start up: you'll see a cryptic error message about ```Goalie::CustomErrorPages.render_exception``` not being defined.)
811
-
812
-
813
- ## Using with Resque
814
-
815
- Check out [resque-rollbar](https://github.com/dimko/resque-rollbar) for using Rollbar as a failure backend for Resque.
816
-
817
- ## SSL
818
-
819
- By default we use `OpenSSL::SSL::VERIFY_PEER` for SSL very mode. Although we don't recommend change it, you can disable peer verification in case you experience SSL connection problems:
820
-
821
- ```ruby
822
- Rollbar.configure do |config|
823
- config.verify_ssl_peer = false
824
- end
825
- ```
826
-
827
-
828
- ## Using with Zeus
829
-
830
- Some users have reported problems with Zeus when ```rake``` was not explicitly included in their Gemfile. If the zeus server fails to start after installing the rollbar gem, try explicitly adding ```gem 'rake'``` to your ```Gemfile```. See [this thread](https://github.com/rollbar/rollbar-gem/issues/30) for more information.
831
-
832
-
833
- ## Configuration options
834
-
835
- For a listing of all configuration options available, see
836
- [configuration](https://rollbar.com/docs/notifier/rollbar-gem/configuration).
837
-
838
- ## Backwards Compatibility
839
-
840
- You can find upgrading notes in [UPGRADING.md](UPGRADING.md).
841
-
842
- ## Known Issues
843
-
844
- If you are using jRuby with Oracle and JDK7, you may be expecting some errors sending reports to our API. This is caused by a bug in that JDK and the primer number used in the SSL algorithm. In order to fix this you can set the next configuration:
845
-
846
- ```ruby
847
- Rollbar.configure do|config|
848
- config.endpoint = 'https://api-alt.rollbar.com/api/1/item/'
849
- end
850
- ```
851
-
852
- ## Supported Language/Framework Versions
853
-
854
- We support Ruby >= 1.8.7.
855
-
856
- We support Rails >= 3.0.
60
+ See our [Releases](https://github.com/rollbar/rollbar-gem/releases) page for a list of all releases, including changes.
857
61
 
858
62
  ## Help / Support
859
63
 
860
64
  If you run into any issues, please email us at [support@rollbar.com](mailto:support@rollbar.com)
861
65
 
862
- You can also find us in IRC: [#rollbar on chat.freenode.net](irc://chat.freenode.net/rollbar)
863
-
864
66
  For bug reports, please [open an issue on GitHub](https://github.com/rollbar/rollbar-gem/issues/new).
865
67
 
866
68
  ## Contributing
@@ -872,3 +74,6 @@ For bug reports, please [open an issue on GitHub](https://github.com/rollbar/rol
872
74
  5. Create new Pull Request
873
75
 
874
76
  We're using RSpec for testing. Run the test suite with ```rake spec```. Tests for pull requests are appreciated but not required. (If you don't include a test, we'll write one before merging.)
77
+
78
+ ## License
79
+ Rollbar-gem is free software released under the MIT License. See [LICENSE](LICENSE) for details.