honeybadger 2.5.3 → 2.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 960bb68ee11d0d8dce4c6eb5d9311993653f33db
4
- data.tar.gz: a2c016f3cadd8d29dba7c5d1771e113ae568c2aa
3
+ metadata.gz: 2222a4433ac78457a32df416c829a8e0723a7a4e
4
+ data.tar.gz: 2b86c78e7f197cb536bc113b0f529fbe1c8922f4
5
5
  SHA512:
6
- metadata.gz: 2cb05d59a7a735ef68afa3527c555a4206db6fea6aaf97023b6d5e314466229bbf0931542f86d8ac5ee554bd0b0a990246aff1713c849e54dcf023032d28956d
7
- data.tar.gz: b10c5fa1d237940f8cef27852c97f43ca0e02222495f5d062d3f9d2352000c635906685c758f284877bdc7c55d9cbcb9e04270a5c63cb3c0ca8e1368d2bc2ffd
6
+ metadata.gz: 5df00423284aa557dcf82df4d6e951e63fe0c4cd1c1cd019332c03f5b60cccaab0169e39692e40369ba4e5a5d01c145f4abd740ecce2f6b609c83a55c94cee90
7
+ data.tar.gz: 052aab1703d0ab8895754725423791079bf675ca274442b8b5ba475bc8b28b5a7febe13906c1eed7bd946a427b8646dd36675e36b5a0f2d6335918e6eabf5921
@@ -5,6 +5,18 @@ adheres to [Semantic Versioning](http://semver.org/).
5
5
 
6
6
  ## [Unreleased][unreleased]
7
7
 
8
+ ## [2.6.0] - 2016-04-22
9
+ ### Added
10
+ - Automatically report unhandled exceptions at exit.
11
+ - Add `Honeybadger.get_context` method. -@homanchou
12
+
13
+ ### Changed
14
+ - Filter Authorization header (HTTP\_AUTHORIZATION) by default.
15
+
16
+ ### Fixed
17
+ - Always convert to string when sanitizing strings.
18
+ - Fix potential performance issue due to and `ensure` block. See #186.
19
+
8
20
  ## [2.5.3] - 2016-03-10
9
21
  ### Fixed
10
22
  - Squashed a bug where the wrong source extract was sent for some instances of
data/README.md CHANGED
@@ -146,6 +146,10 @@ run app
146
146
 
147
147
  There are a few ways to configure the Honeybadger gem. You can use a YAML config file. You can use environment variables. Or you can use a combination of the two.
148
148
 
149
+ We put together a short video highligting a few of the most common configuration options:
150
+
151
+ [![Advanced Honeybadger Gem Usage](https://embed-ssl.wistia.com/deliveries/5fccf29d2b27d0f7ec62b5b39e2f5d9cd1f6f5b7.jpg?image_play_button=true&image_play_button_color=7b796ae0&image_crop_resized=150x84)](https://honeybadger.wistia.com/medias/vv9qq9x39d)
152
+
149
153
 
150
154
  ### YAML Configuration File
151
155
 
@@ -167,7 +171,7 @@ Some configuration options are written in YAML as nested hashes. For example, he
167
171
  logging:
168
172
  path: "/path/to/honeybadger.log"
169
173
  request:
170
- filter-keys:
174
+ filter_keys:
171
175
  - "credit_card"
172
176
  ```
173
177
 
@@ -221,6 +225,7 @@ You can use any of the options below in your config file, or in the environment.
221
225
  |`hostname` | String | The hostname of the current box.<br/>_Default: `Socket.gethostname`_|
222
226
  |`backend` | String | An alternate backend to use for reporting data.<br/>_Default: `nil`_|
223
227
  |`debug` | Boolean | Forces metrics and traces to be reported every 10 seconds rather than 60, and enables verbose debug logging.<br/>_Default: `false`_|
228
+ |`send_data_at_exit` | Boolean | Finish sending enqueued exceptions and metrics data before allowing program to exit.<br/>_Default: `true`_|
224
229
  |`disabled` | Boolean | Prevents Honeybadger from starting entirely.<br/>_Default: `false`_|
225
230
  | `config_path` | String | The path of the honeybadger config file. Can only be set via the `$HONEYBADGER_CONFIG_PATH` environment variable |
226
231
  |`development_environments` | Array | Environments which will not report data by default (use report_data to enable/disable explicitly).<br/>_Default: `["development", "test", "cucumber"]`_|
@@ -257,11 +262,11 @@ You can use any of the options below in your config file, or in the environment.
257
262
  |`feedback.enabled` | Boolean | Enable the UserFeedback middleware. Feedback displays a comment form to your-end user when they encounter an error. When the user creates a comment, it is added to the error in Honeybadger, and a notification is sent.  [Learn More](http://docs.honeybadger.io/article/166-how-to-implement-a-custom-feedback-form)<br/>_Default: `true`_|
258
263
  |&nbsp; | ||
259
264
  |__EXCEPTION REPORTING__ | ||
260
- |`exceptions.enabled` | Boolean | Enable automatic reporting of exceptions.<br/>_Default: `true`_|
261
265
  |`exceptions.ignore` | Array | A list of exception class names to ignore (appends to defaults).<br/>_Default: `['ActiveRecord::RecordNotFound', 'ActionController::RoutingError', 'ActionController::InvalidAuthenticityToken', 'CGI::Session::CookieStore::TamperedWithCookie', 'ActionController::UnknownAction', 'AbstractController::ActionNotFound', 'Mongoid::Errors::DocumentNotFound Sinatra::NotFound']`_|
262
266
  |`exceptions.ignore_only` | Array | A list of exception class names to ignore (overrides defaults).<br/>_Default: `[]`_|
263
267
  |`exceptions.` `ignored_user_agents` | Array | A list of user agents to ignore.<br/>_Default: `[]`_|
264
268
  |`exceptions.rescue_rake` | Boolean | Enable rescuing exceptions in rake tasks.<br/>_Default: `true` when run in background; `false` when run in terminal._|
269
+ |`exceptions.notify_at_exit` | Boolean | Report unhandled exception when Ruby crashes (at\_exit).<br/>_Default: `true`._|
265
270
  |`exceptions.source_radius` | Integer | The number of lines before and after the source when reporting snippets.<br/>_Default: `2`_|
266
271
  |`exceptions.local_variables` | Boolean | Enable sending local variables. Requires the [binding_of_caller gem](https://rubygems.org/gems/binding_of_caller).<br/>_Default: `false`_|
267
272
  |`exceptions.unwrap` | Boolean | Reports #original_exception or #cause one level up from rescued exception when available.<br/>_Default: `false`_|
@@ -171,6 +171,20 @@ module Honeybadger
171
171
  self
172
172
  end
173
173
 
174
+
175
+ # Public: Get global context for the current request.
176
+ #
177
+ #
178
+ # Examples:
179
+ #
180
+ # Honeybadger.context({my_data: 'my value'})
181
+ # Honeybadger.get_context #now returns {my_data: 'my value'}
182
+ #
183
+ # Returns hash or nil.
184
+ def get_context
185
+ Thread.current[:__honeybadger_context]
186
+ end
187
+
174
188
  # Internal: Clears the global context
175
189
  def clear!
176
190
  Thread.current[:__honeybadger_context] = nil
@@ -154,6 +154,7 @@ module Honeybadger
154
154
  exit_status = $!.status if $!.is_a?(SystemExit)
155
155
  end
156
156
 
157
+ notify_at_exit($!)
157
158
  stop if config[:'send_data_at_exit']
158
159
  self.class.at_exit.call if self.class.at_exit
159
160
 
@@ -299,12 +300,12 @@ module Honeybadger
299
300
  def work
300
301
  flush_metrics if metrics.flush?
301
302
  flush_traces if traces.flush?
303
+ sleep(delay)
302
304
  rescue StandardError => e
303
305
  error {
304
306
  msg = "error in agent thread class=%s message=%s\n\t%s"
305
307
  sprintf(msg, e.class, e.message.dump, Array(e.backtrace).join("\n\t"))
306
308
  }
307
- ensure
308
309
  sleep(delay)
309
310
  end
310
311
 
@@ -342,5 +343,13 @@ module Honeybadger
342
343
  init_traces
343
344
  end
344
345
  end
346
+
347
+ def notify_at_exit(ex)
348
+ return unless ex
349
+ return unless config[:'exceptions.notify_at_exit']
350
+ return if ex.is_a?(SystemExit)
351
+
352
+ notice(exception: ex, component: 'at_exit')
353
+ end
345
354
  end
346
355
  end
@@ -25,6 +25,7 @@ module Honeybadger
25
25
  Net::HTTPHeaderSyntaxError,
26
26
  Net::ProtocolError,
27
27
  Errno::ECONNREFUSED,
28
+ OpenSSL::SSL::SSLError,
28
29
  SocketError].freeze
29
30
 
30
31
  def initialize(config)
@@ -168,7 +168,7 @@ module Honeybadger
168
168
  },
169
169
  :'request.filter_keys' => {
170
170
  description: 'A list of keys to filter when sending request data.',
171
- default: ['password'.freeze, 'password_confirmation'.freeze].freeze,
171
+ default: ['password'.freeze, 'password_confirmation'.freeze, 'HTTP_AUTHORIZATION'.freeze].freeze,
172
172
  type: Array
173
173
  },
174
174
  :'request.disable_session' => {
@@ -227,10 +227,15 @@ module Honeybadger
227
227
  type: Array
228
228
  },
229
229
  :'exceptions.rescue_rake' => {
230
- description: 'Enable rescuing exceptions in rake tasks.',
230
+ description: 'Enable reporting exceptions in rake tasks.',
231
231
  default: !STDOUT.tty?,
232
232
  type: Boolean
233
233
  },
234
+ :'exceptions.notify_at_exit' => {
235
+ description: 'Report unhandled exception when Ruby crashes (at_exit).',
236
+ default: true,
237
+ type: Boolean
238
+ },
234
239
  :'exceptions.source_radius' => {
235
240
  description: 'The number of lines before and after the source when reporting snippets.',
236
241
  default: 2,
@@ -107,7 +107,7 @@ module Honeybadger
107
107
  end
108
108
 
109
109
  def sanitize_string(data)
110
- data = valid_encoding(data)
110
+ data = valid_encoding(data.to_s)
111
111
  return data unless data.respond_to?(:size) && data.size > MAX_STRING_SIZE
112
112
  data[0...MAX_STRING_SIZE] + TRUNCATION_REPLACEMENT
113
113
  end
@@ -1,4 +1,4 @@
1
1
  module Honeybadger
2
2
  # Public: The current String Honeybadger version.
3
- VERSION = '2.5.3'.freeze
3
+ VERSION = '2.6.0'.freeze
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: honeybadger
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.3
4
+ version: 2.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Honeybadger Industries LLC
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-10 00:00:00.000000000 Z
11
+ date: 2016-04-22 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Make managing application errors a more pleasant experience.
14
14
  email: