failbot 1.1.4 → 1.1.5

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9c8cb2311ae811089adcbf1e9c9fbecd099f5d9f
4
- data.tar.gz: 6d66e03bfb51972d2353b33351ec875f67a975f3
3
+ metadata.gz: 90628071f00b062ad9f21fae9244d905c2f38ceb
4
+ data.tar.gz: d54bf144087e7a9bac861e838faa7e64ccc7deb8
5
5
  SHA512:
6
- metadata.gz: 1876d1ff886d036124b734c89c99eeb83b1edc551cfa7ad1420255e4ae579171f6947c6df8575574a59646d4dd7c3bce5f808b333e381dddeaed2021d90289ce
7
- data.tar.gz: 9cea110b67d819c02d461061e8939f108d493d5e793da64d7cbfa60b094ba95db956551ca7858bc0a1b755a34691eaa0b14b876421db4867f3ee72204dd2da30
6
+ metadata.gz: 851ec7c6a661593e9edc3ffee53799c3ceab8cde34c14a0109f8ecbdb84e95f38a304600f1671d9b2a720ccf2e09a8857d75426bff3d5197fd9d5b71182f2759
7
+ data.tar.gz: f47a0e5f9f083b44380f76818392e8e98bc61fc19d7871c71d205c0e92006598b3283c58ab868c243b41efc858e2fb620d566a046f177d14497b76223deeaf35
data/lib/failbot.rb CHANGED
@@ -251,8 +251,8 @@ module Failbot
251
251
  # e - The exception object to turn into a Hash.
252
252
  #
253
253
  # Returns a Hash including a 'class', 'message', 'backtrace', and 'rollup'
254
- # keys. The rollup value is a MD5 hash of the exception class, file, and line
255
- # number and is used to group exceptions.
254
+ # keys. The rollup value is an MD5 hash of the exception class and the
255
+ # raising file, line, and method.
256
256
  def exception_info(e)
257
257
  backtrace = Array(e.backtrace)[0, 500]
258
258
 
@@ -261,7 +261,7 @@ module Failbot
261
261
  'message' => e.message,
262
262
  'backtrace' => backtrace.join("\n"),
263
263
  'ruby' => RUBY_DESCRIPTION,
264
- 'rollup' => Digest::MD5.hexdigest("#{e.class}#{backtrace[0]}"),
264
+ 'rollup' => rollup(e),
265
265
  'created_at' => Time.now.utc.iso8601(6)
266
266
  }
267
267
 
@@ -300,6 +300,22 @@ module Failbot
300
300
  Failbot.instrumenter.instrument(name, payload) if Failbot.instrumenter
301
301
  end
302
302
 
303
+ # Generate a rollup for an exception. Exceptions with the same rollup are
304
+ # grouped together in Haystack. The rollup is an MD5 hash of the exception
305
+ # class and the raising file, line, and method.
306
+ #
307
+ # e - The exception object
308
+ #
309
+ # Returns a String.
310
+ def rollup(e)
311
+ backtrace_line = Array(e.backtrace).first || ""
312
+ # We want all exceptions from foo.html.erb:123 to be grouped together, no
313
+ # matter what wacky generated ERB method name is attached to it.
314
+ cleaned_line = backtrace_line.sub(/_erb__[_\d]+'\z/, "_erb'")
315
+
316
+ Digest::MD5.hexdigest("#{e.class}#{cleaned_line}")
317
+ end
318
+
303
319
  extend self
304
320
 
305
321
  # If the library was lazy loaded due to failbot/exit_hook.rb and a delayed
@@ -1,3 +1,3 @@
1
1
  module Failbot
2
- VERSION = "1.1.4"
2
+ VERSION = "1.1.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: failbot
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.4
4
+ version: 1.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - "@rtomayko"
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2015-04-14 00:00:00.000000000 Z
13
+ date: 2015-05-26 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: yajl-ruby