minitest_rollbar 0.2.2 → 0.2.3

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: cfa3a94ac9127ea129eb515847863aa955ad4f37
4
- data.tar.gz: 3383a834cd51f36d99c673a9b5219b9a7e28f53c
3
+ metadata.gz: c364e80e6791171ac60e1d572d1b66d8751d2f15
4
+ data.tar.gz: 369c9601fb7944eccffb7f688d4ecf6e95742289
5
5
  SHA512:
6
- metadata.gz: 4b35bea9a2e6b262b90b08df71e34c02d30f8f843ab256aab4e7ea3d8a4c15b4124a16f79e3e70e14a31964296ee9c68eb77c1972f29a1794e2a2650dcc4cdf6
7
- data.tar.gz: 68f9211b4bca8c4447db10d408cb59270387576ba09d8c6e29a100c9b7a6de7e64c18b4a6d975720adbc46ff994edb7df2ec1a01b450408e40f2bfc85358bcf0
6
+ metadata.gz: 83123c2ede21ce086307087ebe90e2cd0efed85bf5f5e4241a106876f2fb2b0241d742f9653b7faa1d78b559763801fc321717d39ca4fd07ba5c4be143056975
7
+ data.tar.gz: 2223f889169c48921b5b4013d0cf0b0101f6ecced930a155624a538fa1df36bcf3e8c07bc260becfbdb3c65ba0154cbb715f401d9ce1dfd47c49edc3664fd8f4
data/README.md CHANGED
@@ -30,6 +30,11 @@ Set up authentication token by:
30
30
 
31
31
  MinitestRollbar.access_token = {YOUR_TOKEN}
32
32
 
33
+ By default we try to group occurrence by string returned by exception.inspect (Concatenate exception class name and message). We generate a fingerprint for that. To use rollbar's [default](https://rollbar.com/docs/grouping-algorithm/) default grouping algorithm, do
34
+
35
+ MinitestRollbar.use_default_grouping = true
36
+
37
+
33
38
  ## License
34
39
 
35
40
  This gem is available under the Simplified BSD License.
@@ -4,6 +4,7 @@ require 'minitest/reporters'
4
4
  module MinitestRollbar
5
5
  class << self
6
6
  attr_accessor :access_token
7
+ attr_accessor :use_default_grouping
7
8
  end
8
9
 
9
10
  class RollbarReporter < Minitest::Reporters::BaseReporter
@@ -12,7 +13,7 @@ module MinitestRollbar
12
13
  @sequential_exception_count = 0
13
14
  # Inspect will return ExceptionType + Message.
14
15
  # E.g #<Selenium::WebDriver::Error::NoSuchWindowError: Window not found. The browser window may have been closed.>
15
- # Use this as a criteria of grouping
16
+ # Use this as a criteria for log batch grouping
16
17
  @previous_exception_inspect_result = nil
17
18
  @previous_exception = nil
18
19
 
@@ -28,22 +29,17 @@ module MinitestRollbar
28
29
  current_exception = result.failure.exception
29
30
  current_exception_inspect_result = current_exception.inspect
30
31
 
31
- # If there is no previous exception, start a fresh counter
32
32
  if @previous_exception_inspect_result.nil?
33
33
  record_new_error(current_exception)
34
- # Report or increment the count the previous errors if a new error occurs
35
34
  elsif current_exception_inspect_result == @previous_exception_inspect_result
36
- # Same error, increment counter
37
35
  increment_error_counting
38
- else
39
- # Different error, report previous errors and record new error
40
- report_error_to_rollbar
36
+ else # New exception
37
+ report_error_to_rollbar notifier
41
38
  record_new_error current_exception
42
39
  end
43
40
  else
44
- # Report previous errors if there is any
45
41
  unless @previous_exception.nil?
46
- report_error_to_rollbar
42
+ report_error_to_rollbar notifier
47
43
  reset_error_counting
48
44
  end
49
45
  end
@@ -52,20 +48,20 @@ module MinitestRollbar
52
48
  def report
53
49
  super
54
50
  if @sequential_exception_count > 0
55
- notifier = Rollbar.scope(count: @sequential_exception_count)
56
- notifier.error(@previous_exception)
57
-
58
- @previous_exception_inspect_result = nil
59
- @previous_exception = nil
60
- @sequential_exception_count = 0
61
-
51
+ report_error_to_rollbar notifier
52
+ reset_error_counting
62
53
  end
63
54
  end
64
55
 
65
56
  private
66
57
 
67
- def report_error_to_rollbar
68
- notifier = Rollbar.scope(count: @sequential_exception_count)
58
+ def notifier
59
+ MinitestRollbar.use_default_grouping.nil? ?
60
+ Rollbar.scope({count: @sequential_exception_count, fingerprint: @previous_exception_inspect_result}):
61
+ Rollbar.scope({count: @sequential_exception_count})
62
+ end
63
+
64
+ def report_error_to_rollbar(notifier)
69
65
  notifier.error(@previous_exception)
70
66
  end
71
67
 
@@ -1,3 +1,3 @@
1
1
  module MinitestRollbar
2
- VERSION = '0.2.2'.freeze
2
+ VERSION = '0.2.3'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: minitest_rollbar
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yuesong Wang
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-07-04 00:00:00.000000000 Z
11
+ date: 2016-07-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -98,7 +98,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
98
98
  version: '0'
99
99
  requirements: []
100
100
  rubyforge_project:
101
- rubygems_version: 2.6.6
101
+ rubygems_version: 2.5.1
102
102
  signing_key:
103
103
  specification_version: 4
104
104
  summary: A minitest reporter that logs testexceptions to Rollbar.