rollbar 2.19.1 → 2.27.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (86) hide show
  1. checksums.yaml +5 -5
  2. data/.github/pull_request_template.md +25 -0
  3. data/.rubocop.yml +168 -0
  4. data/.travis.yml +63 -34
  5. data/Appraisals +10 -10
  6. data/Gemfile +35 -14
  7. data/README.md +5 -2
  8. data/Rakefile +0 -0
  9. data/data/rollbar.snippet.js +1 -1
  10. data/docs/configuration.md +17 -0
  11. data/gemfiles/rails30.gemfile +10 -10
  12. data/gemfiles/rails31.gemfile +10 -9
  13. data/gemfiles/rails32.gemfile +10 -9
  14. data/gemfiles/rails40.gemfile +10 -9
  15. data/gemfiles/rails41.gemfile +10 -9
  16. data/gemfiles/rails42.gemfile +12 -9
  17. data/gemfiles/rails50.gemfile +21 -14
  18. data/gemfiles/rails51.gemfile +21 -14
  19. data/gemfiles/rails52.gemfile +15 -12
  20. data/gemfiles/rails60.gemfile +67 -0
  21. data/lib/generators/rollbar/rollbar_generator.rb +1 -1
  22. data/lib/rails/rollbar_runner.rb +4 -2
  23. data/lib/rollbar/capistrano.rb +1 -1
  24. data/lib/rollbar/capistrano3.rb +6 -3
  25. data/lib/rollbar/capistrano_tasks.rb +29 -21
  26. data/lib/rollbar/configuration.rb +86 -16
  27. data/lib/rollbar/delay/girl_friday.rb +4 -8
  28. data/lib/rollbar/delay/resque.rb +3 -6
  29. data/lib/rollbar/delay/sidekiq.rb +4 -10
  30. data/lib/rollbar/delay/sucker_punch.rb +16 -19
  31. data/lib/rollbar/delay/thread.rb +16 -2
  32. data/lib/rollbar/deploy.rb +52 -29
  33. data/lib/rollbar/encoding/encoder.rb +17 -10
  34. data/lib/rollbar/exception_reporter.rb +19 -5
  35. data/lib/rollbar/item/backtrace.rb +13 -3
  36. data/lib/rollbar/item/frame.rb +9 -1
  37. data/lib/rollbar/item/locals.rb +100 -0
  38. data/lib/rollbar/item.rb +56 -17
  39. data/lib/rollbar/json.rb +6 -51
  40. data/lib/rollbar/language_support.rb +4 -20
  41. data/lib/rollbar/lazy_store.rb +5 -5
  42. data/lib/rollbar/logger.rb +1 -0
  43. data/lib/rollbar/logger_proxy.rb +6 -2
  44. data/lib/rollbar/middleware/js.rb +28 -18
  45. data/lib/rollbar/middleware/rack.rb +4 -1
  46. data/lib/rollbar/middleware/rails/rollbar.rb +10 -1
  47. data/lib/rollbar/notifier/trace_with_bindings.rb +65 -0
  48. data/lib/rollbar/notifier.rb +225 -89
  49. data/lib/rollbar/plugin.rb +54 -6
  50. data/lib/rollbar/plugins/active_job.rb +6 -2
  51. data/lib/rollbar/plugins/basic_socket.rb +21 -6
  52. data/lib/rollbar/plugins/delayed_job/job_data.rb +3 -3
  53. data/lib/rollbar/plugins/delayed_job/plugin.rb +13 -3
  54. data/lib/rollbar/plugins/error_context.rb +11 -0
  55. data/lib/rollbar/plugins/goalie.rb +11 -3
  56. data/lib/rollbar/plugins/rails/controller_methods.rb +15 -3
  57. data/lib/rollbar/plugins/rake.rb +2 -2
  58. data/lib/rollbar/plugins/sidekiq/plugin.rb +5 -4
  59. data/lib/rollbar/plugins.rb +7 -1
  60. data/lib/rollbar/rake_tasks.rb +4 -148
  61. data/lib/rollbar/request_data_extractor.rb +31 -21
  62. data/lib/rollbar/rollbar_test.rb +36 -0
  63. data/lib/rollbar/scrubbers/params.rb +19 -18
  64. data/lib/rollbar/scrubbers/url.rb +18 -9
  65. data/lib/rollbar/scrubbers.rb +3 -3
  66. data/lib/rollbar/truncation/frames_strategy.rb +1 -1
  67. data/lib/rollbar/truncation/min_body_strategy.rb +2 -3
  68. data/lib/rollbar/truncation/mixin.rb +1 -1
  69. data/lib/rollbar/truncation/remove_any_key_strategy.rb +123 -0
  70. data/lib/rollbar/truncation/remove_extra_strategy.rb +35 -0
  71. data/lib/rollbar/truncation/remove_request_strategy.rb +21 -0
  72. data/lib/rollbar/truncation/strings_strategy.rb +6 -5
  73. data/lib/rollbar/truncation.rb +9 -2
  74. data/lib/rollbar/util/hash.rb +15 -0
  75. data/lib/rollbar/util/ip_anonymizer.rb +8 -7
  76. data/lib/rollbar/util/ip_obfuscator.rb +1 -1
  77. data/lib/rollbar/util.rb +6 -2
  78. data/lib/rollbar/version.rb +1 -1
  79. data/lib/rollbar.rb +2 -3
  80. data/lib/tasks/benchmark.rake +103 -0
  81. data/rollbar.gemspec +13 -5
  82. data/spec/support/rollbar_api.rb +67 -0
  83. metadata +21 -23
  84. data/gemfiles/ruby_1_8_and_1_9_2.gemfile +0 -49
  85. data/lib/rollbar/json/default.rb +0 -11
  86. data/lib/rollbar/json/oj.rb +0 -16
@@ -17,12 +17,15 @@ module Rollbar
17
17
 
18
18
  Rollbar.scoped(fetch_scope(env)) do
19
19
  begin
20
+ Rollbar.notifier.enable_locals
20
21
  response = @app.call(env)
21
22
  report_exception_to_rollbar(env, framework_error(env)) if framework_error(env)
22
23
  response
23
24
  rescue Exception => e
24
25
  report_exception_to_rollbar(env, e)
25
26
  raise
27
+ ensure
28
+ Rollbar.notifier.disable_locals
26
29
  end
27
30
  end
28
31
  end
@@ -41,7 +44,7 @@ module Rollbar
41
44
  proc { extract_person_data_from_controller(env) }
42
45
  end
43
46
 
44
- def framework_error(env)
47
+ def framework_error(_env)
45
48
  nil
46
49
  end
47
50
  end
@@ -21,6 +21,7 @@ module Rollbar
21
21
 
22
22
  Rollbar.scoped(scope) do
23
23
  begin
24
+ Rollbar.notifier.enable_locals
24
25
  response = @app.call(env)
25
26
 
26
27
  if (framework_exception = env['action_dispatch.exception'])
@@ -31,6 +32,8 @@ module Rollbar
31
32
  rescue Exception => exception
32
33
  report_exception_to_rollbar(env, exception)
33
34
  raise
35
+ ensure
36
+ Rollbar.notifier.disable_locals
34
37
  end
35
38
  end
36
39
  end
@@ -62,7 +65,13 @@ module Rollbar
62
65
  block = proc { extract_person_data_from_controller(env) }
63
66
  return block unless defined?(ActiveRecord::Base) && ActiveRecord::Base.connected?
64
67
 
65
- proc { ActiveRecord::Base.connection_pool.with_connection(&block) }
68
+ proc do
69
+ begin
70
+ ActiveRecord::Base.connection_pool.with_connection(&block)
71
+ rescue ActiveRecord::ConnectionTimeoutError
72
+ {}
73
+ end
74
+ end
66
75
  end
67
76
 
68
77
  def context(request_data)
@@ -0,0 +1,65 @@
1
+ module Rollbar
2
+ class Notifier
3
+ class TraceWithBindings # :nodoc:
4
+ attr_reader :frames, :exception_frames
5
+
6
+ def initialize
7
+ reset
8
+ end
9
+
10
+ def reset
11
+ @frames = []
12
+ @exception_frames = []
13
+ @exception_signature = nil
14
+ end
15
+
16
+ def enable
17
+ reset
18
+ trace_point.enable if defined?(TracePoint)
19
+ end
20
+
21
+ def disable
22
+ trace_point.disable if defined?(TracePoint)
23
+ end
24
+
25
+ private
26
+
27
+ def exception_signature(trace)
28
+ # use the exception backtrace to detect reraised exception.
29
+ trace.raised_exception.backtrace.first
30
+ end
31
+
32
+ def detect_reraise(trace)
33
+ @exception_signature == exception_signature(trace)
34
+ end
35
+
36
+ def trace_point
37
+ return unless defined?(TracePoint)
38
+
39
+ @trace_point ||= TracePoint.new(:call, :return, :b_call, :b_return, :c_call, :c_return, :raise) do |tp|
40
+ case tp.event
41
+ when :call, :b_call, :c_call, :class
42
+ frames.push frame(tp)
43
+ when :return, :b_return, :c_return, :end
44
+ frames.pop
45
+ when :raise
46
+ unless detect_reraise(tp) # ignore reraised exceptions
47
+ @exception_frames = @frames.dup # may be possible to optimize better than #dup
48
+ @exception_signature = exception_signature(tp)
49
+ end
50
+ end
51
+ end
52
+ end
53
+
54
+ def frame(trace)
55
+ {
56
+ :binding => trace.binding,
57
+ :defined_class => trace.defined_class,
58
+ :method_id => trace.method_id,
59
+ :path => trace.path,
60
+ :lineno => trace.lineno
61
+ }
62
+ end
63
+ end
64
+ end
65
+ end