sentry-raven 3.0.4 → 3.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (173) hide show
  1. checksums.yaml +4 -4
  2. data/.github/ISSUE_TEMPLATE/bug_report.md +32 -0
  3. data/.github/pull_request_template.md +16 -0
  4. data/.github/workflows/test.yml +5 -0
  5. data/.gitignore +1 -0
  6. data/.rubocop.yml +6 -3
  7. data/CHANGELOG.md +134 -1
  8. data/CONTRIBUTING.md +71 -0
  9. data/README.md +8 -2
  10. data/lib/raven/backtrace.rb +2 -0
  11. data/lib/raven/base.rb +1 -0
  12. data/lib/raven/breadcrumbs/active_support_logger.rb +25 -0
  13. data/lib/raven/breadcrumbs/logger.rb +2 -92
  14. data/lib/raven/breadcrumbs/sentry_logger.rb +73 -0
  15. data/lib/raven/cli.rb +1 -1
  16. data/lib/raven/client.rb +1 -1
  17. data/lib/raven/configuration.rb +76 -4
  18. data/lib/raven/context.rb +13 -8
  19. data/lib/raven/event.rb +23 -13
  20. data/lib/raven/helpers/deprecation_helper.rb +17 -0
  21. data/lib/raven/instance.rb +8 -1
  22. data/lib/raven/integrations/delayed_job.rb +2 -1
  23. data/lib/raven/integrations/rack-timeout.rb +5 -1
  24. data/lib/raven/integrations/rack.rb +15 -2
  25. data/lib/raven/integrations/rails.rb +12 -3
  26. data/lib/raven/integrations/rails/active_job.rb +2 -1
  27. data/lib/raven/integrations/rails/backtrace_cleaner.rb +29 -0
  28. data/lib/raven/integrations/sidekiq.rb +4 -78
  29. data/lib/raven/integrations/sidekiq/cleanup_middleware.rb +13 -0
  30. data/lib/raven/integrations/sidekiq/error_handler.rb +38 -0
  31. data/lib/raven/transports/http.rb +0 -2
  32. data/lib/raven/utils/context_filter.rb +42 -0
  33. data/lib/raven/version.rb +1 -1
  34. data/lib/sentry-raven-without-integrations.rb +6 -1
  35. data/lib/sentry_raven_without_integrations.rb +1 -0
  36. data/sentry-ruby/.gitignore +11 -0
  37. data/sentry-ruby/.rspec +3 -0
  38. data/sentry-ruby/.travis.yml +6 -0
  39. data/sentry-ruby/CODE_OF_CONDUCT.md +74 -0
  40. data/sentry-ruby/Gemfile +9 -0
  41. data/sentry-ruby/LICENSE.txt +21 -0
  42. data/sentry-ruby/README.md +44 -0
  43. data/sentry-ruby/Rakefile +6 -0
  44. data/sentry-ruby/bin/console +14 -0
  45. data/sentry-ruby/bin/setup +8 -0
  46. data/sentry-ruby/examples/rails-6.0/.browserslistrc +1 -0
  47. data/sentry-ruby/examples/rails-6.0/.gitignore +35 -0
  48. data/sentry-ruby/examples/rails-6.0/Gemfile +58 -0
  49. data/sentry-ruby/examples/rails-6.0/README.md +23 -0
  50. data/sentry-ruby/examples/rails-6.0/Rakefile +6 -0
  51. data/sentry-ruby/examples/rails-6.0/app/assets/config/manifest.js +2 -0
  52. data/sentry-ruby/examples/rails-6.0/app/assets/images/.keep +0 -0
  53. data/sentry-ruby/examples/rails-6.0/app/assets/stylesheets/application.css +15 -0
  54. data/sentry-ruby/examples/rails-6.0/app/channels/application_cable/channel.rb +4 -0
  55. data/sentry-ruby/examples/rails-6.0/app/channels/application_cable/connection.rb +4 -0
  56. data/sentry-ruby/examples/rails-6.0/app/controllers/application_controller.rb +2 -0
  57. data/sentry-ruby/examples/rails-6.0/app/controllers/concerns/.keep +0 -0
  58. data/sentry-ruby/examples/rails-6.0/app/controllers/welcome_controller.rb +23 -0
  59. data/sentry-ruby/examples/rails-6.0/app/helpers/application_helper.rb +2 -0
  60. data/sentry-ruby/examples/rails-6.0/app/javascript/channels/consumer.js +6 -0
  61. data/sentry-ruby/examples/rails-6.0/app/javascript/channels/index.js +5 -0
  62. data/sentry-ruby/examples/rails-6.0/app/javascript/packs/application.js +17 -0
  63. data/sentry-ruby/examples/rails-6.0/app/jobs/application_job.rb +7 -0
  64. data/sentry-ruby/examples/rails-6.0/app/mailers/application_mailer.rb +4 -0
  65. data/sentry-ruby/examples/rails-6.0/app/models/application_record.rb +3 -0
  66. data/sentry-ruby/examples/rails-6.0/app/models/concerns/.keep +0 -0
  67. data/sentry-ruby/examples/rails-6.0/app/views/layouts/application.html.erb +15 -0
  68. data/sentry-ruby/examples/rails-6.0/app/views/layouts/mailer.html.erb +13 -0
  69. data/sentry-ruby/examples/rails-6.0/app/views/layouts/mailer.text.erb +1 -0
  70. data/sentry-ruby/examples/rails-6.0/app/views/welcome/report_demo.html.erb +22 -0
  71. data/sentry-ruby/examples/rails-6.0/app/views/welcome/view_error.html.erb +1 -0
  72. data/sentry-ruby/examples/rails-6.0/app/workers/error_worker.rb +7 -0
  73. data/sentry-ruby/examples/rails-6.0/babel.config.js +72 -0
  74. data/sentry-ruby/examples/rails-6.0/bin/bundle +114 -0
  75. data/sentry-ruby/examples/rails-6.0/bin/rails +9 -0
  76. data/sentry-ruby/examples/rails-6.0/bin/rake +9 -0
  77. data/sentry-ruby/examples/rails-6.0/bin/setup +36 -0
  78. data/sentry-ruby/examples/rails-6.0/bin/spring +17 -0
  79. data/sentry-ruby/examples/rails-6.0/bin/webpack +18 -0
  80. data/sentry-ruby/examples/rails-6.0/bin/webpack-dev-server +18 -0
  81. data/sentry-ruby/examples/rails-6.0/bin/yarn +11 -0
  82. data/sentry-ruby/examples/rails-6.0/config.ru +5 -0
  83. data/sentry-ruby/examples/rails-6.0/config/application.rb +28 -0
  84. data/sentry-ruby/examples/rails-6.0/config/boot.rb +4 -0
  85. data/sentry-ruby/examples/rails-6.0/config/cable.yml +10 -0
  86. data/sentry-ruby/examples/rails-6.0/config/credentials.yml.enc +1 -0
  87. data/sentry-ruby/examples/rails-6.0/config/database.yml +25 -0
  88. data/sentry-ruby/examples/rails-6.0/config/environment.rb +5 -0
  89. data/sentry-ruby/examples/rails-6.0/config/environments/development.rb +62 -0
  90. data/sentry-ruby/examples/rails-6.0/config/environments/production.rb +112 -0
  91. data/sentry-ruby/examples/rails-6.0/config/environments/test.rb +48 -0
  92. data/sentry-ruby/examples/rails-6.0/config/initializers/application_controller_renderer.rb +8 -0
  93. data/sentry-ruby/examples/rails-6.0/config/initializers/assets.rb +14 -0
  94. data/sentry-ruby/examples/rails-6.0/config/initializers/backtrace_silencers.rb +7 -0
  95. data/sentry-ruby/examples/rails-6.0/config/initializers/content_security_policy.rb +30 -0
  96. data/sentry-ruby/examples/rails-6.0/config/initializers/cookies_serializer.rb +5 -0
  97. data/sentry-ruby/examples/rails-6.0/config/initializers/filter_parameter_logging.rb +4 -0
  98. data/sentry-ruby/examples/rails-6.0/config/initializers/inflections.rb +16 -0
  99. data/sentry-ruby/examples/rails-6.0/config/initializers/mime_types.rb +4 -0
  100. data/sentry-ruby/examples/rails-6.0/config/initializers/wrap_parameters.rb +14 -0
  101. data/sentry-ruby/examples/rails-6.0/config/locales/en.yml +33 -0
  102. data/sentry-ruby/examples/rails-6.0/config/puma.rb +38 -0
  103. data/sentry-ruby/examples/rails-6.0/config/routes.rb +10 -0
  104. data/sentry-ruby/examples/rails-6.0/config/spring.rb +6 -0
  105. data/sentry-ruby/examples/rails-6.0/config/storage.yml +34 -0
  106. data/sentry-ruby/examples/rails-6.0/config/webpack/development.js +5 -0
  107. data/sentry-ruby/examples/rails-6.0/config/webpack/environment.js +3 -0
  108. data/sentry-ruby/examples/rails-6.0/config/webpack/production.js +5 -0
  109. data/sentry-ruby/examples/rails-6.0/config/webpack/test.js +5 -0
  110. data/sentry-ruby/examples/rails-6.0/config/webpacker.yml +96 -0
  111. data/sentry-ruby/examples/rails-6.0/db/seeds.rb +7 -0
  112. data/sentry-ruby/examples/rails-6.0/lib/assets/.keep +0 -0
  113. data/sentry-ruby/examples/rails-6.0/lib/tasks/.keep +0 -0
  114. data/sentry-ruby/examples/rails-6.0/package.json +15 -0
  115. data/sentry-ruby/examples/rails-6.0/postcss.config.js +12 -0
  116. data/sentry-ruby/examples/rails-6.0/public/404.html +67 -0
  117. data/sentry-ruby/examples/rails-6.0/public/422.html +67 -0
  118. data/sentry-ruby/examples/rails-6.0/public/500.html +66 -0
  119. data/sentry-ruby/examples/rails-6.0/public/apple-touch-icon-precomposed.png +0 -0
  120. data/sentry-ruby/examples/rails-6.0/public/apple-touch-icon.png +0 -0
  121. data/sentry-ruby/examples/rails-6.0/public/favicon.ico +0 -0
  122. data/sentry-ruby/examples/rails-6.0/public/robots.txt +1 -0
  123. data/sentry-ruby/examples/rails-6.0/storage/.keep +0 -0
  124. data/sentry-ruby/examples/rails-6.0/test/application_system_test_case.rb +5 -0
  125. data/sentry-ruby/examples/rails-6.0/test/channels/application_cable/connection_test.rb +11 -0
  126. data/sentry-ruby/examples/rails-6.0/test/controllers/.keep +0 -0
  127. data/sentry-ruby/examples/rails-6.0/test/fixtures/.keep +0 -0
  128. data/sentry-ruby/examples/rails-6.0/test/fixtures/files/.keep +0 -0
  129. data/sentry-ruby/examples/rails-6.0/test/helpers/.keep +0 -0
  130. data/sentry-ruby/examples/rails-6.0/test/integration/.keep +0 -0
  131. data/sentry-ruby/examples/rails-6.0/test/mailers/.keep +0 -0
  132. data/sentry-ruby/examples/rails-6.0/test/models/.keep +0 -0
  133. data/sentry-ruby/examples/rails-6.0/test/system/.keep +0 -0
  134. data/sentry-ruby/examples/rails-6.0/test/test_helper.rb +13 -0
  135. data/sentry-ruby/examples/rails-6.0/vendor/.keep +0 -0
  136. data/sentry-ruby/examples/rails-6.0/yarn.lock +7508 -0
  137. data/sentry-ruby/lib/sentry.rb +16 -0
  138. data/sentry-ruby/lib/sentry/backtrace.rb +128 -0
  139. data/sentry-ruby/lib/sentry/client.rb +162 -0
  140. data/sentry-ruby/lib/sentry/client/state.rb +40 -0
  141. data/sentry-ruby/lib/sentry/configuration.rb +533 -0
  142. data/sentry-ruby/lib/sentry/event.rb +209 -0
  143. data/sentry-ruby/lib/sentry/interface.rb +31 -0
  144. data/sentry-ruby/lib/sentry/interfaces/exception.rb +15 -0
  145. data/sentry-ruby/lib/sentry/interfaces/http.rb +16 -0
  146. data/sentry-ruby/lib/sentry/interfaces/message.rb +18 -0
  147. data/sentry-ruby/lib/sentry/interfaces/single_exception.rb +14 -0
  148. data/sentry-ruby/lib/sentry/interfaces/stack_trace.rb +69 -0
  149. data/sentry-ruby/lib/sentry/linecache.rb +44 -0
  150. data/sentry-ruby/lib/sentry/logger.rb +20 -0
  151. data/sentry-ruby/lib/sentry/transports.rb +19 -0
  152. data/sentry-ruby/lib/sentry/transports/dummy.rb +16 -0
  153. data/sentry-ruby/lib/sentry/transports/http.rb +66 -0
  154. data/sentry-ruby/lib/sentry/transports/stdout.rb +20 -0
  155. data/sentry-ruby/lib/sentry/utils/deep_merge.rb +22 -0
  156. data/sentry-ruby/lib/sentry/utils/exception_cause_chain.rb +20 -0
  157. data/sentry-ruby/lib/sentry/version.rb +3 -0
  158. data/sentry-ruby/sentry-ruby.gemspec +26 -0
  159. data/sentry-ruby/spec/sentry/backtrace_spec.rb +38 -0
  160. data/sentry-ruby/spec/sentry/client_spec.rb +443 -0
  161. data/sentry-ruby/spec/sentry/configuration_spec.rb +400 -0
  162. data/sentry-ruby/spec/sentry/event_spec.rb +238 -0
  163. data/sentry-ruby/spec/sentry/interface_spec.rb +38 -0
  164. data/sentry-ruby/spec/sentry/interfaces/stack_trace_spec.rb +11 -0
  165. data/sentry-ruby/spec/sentry/linecache_spec.rb +40 -0
  166. data/sentry-ruby/spec/sentry/transports/http_spec.rb +57 -0
  167. data/sentry-ruby/spec/sentry/transports/stdout_spec.rb +11 -0
  168. data/sentry-ruby/spec/sentry_spec.rb +9 -0
  169. data/sentry-ruby/spec/spec_helper.rb +49 -0
  170. data/sentry-ruby/spec/support/linecache.txt +6 -0
  171. metadata +148 -4
  172. data/CONTRIUTING.md +0 -26
  173. data/lib/raven/breadcrumbs/activesupport.rb +0 -19
@@ -67,6 +67,8 @@ module Raven
67
67
  end
68
68
 
69
69
  module RackInterface
70
+ REQUEST_ID_HEADERS = %w(action_dispatch.request_id HTTP_X_REQUEST_ID).freeze
71
+
70
72
  def from_rack(env_hash)
71
73
  req = ::Rack::Request.new(env_hash)
72
74
 
@@ -82,6 +84,15 @@ module Raven
82
84
 
83
85
  private
84
86
 
87
+ # Request ID based on ActionDispatch::RequestId
88
+ def read_request_id_from(env_hash)
89
+ REQUEST_ID_HEADERS.each do |key|
90
+ request_id = env_hash[key]
91
+ return request_id if request_id
92
+ end
93
+ nil
94
+ end
95
+
85
96
  # See Sentry server default limits at
86
97
  # https://github.com/getsentry/sentry/blob/master/src/sentry/conf/server.py
87
98
  def read_data_from(request)
@@ -101,6 +112,7 @@ module Raven
101
112
  begin
102
113
  key = key.to_s # rack env can contain symbols
103
114
  value = value.to_s
115
+ next memo['X-Request-Id'] ||= read_request_id_from(env_hash) if REQUEST_ID_HEADERS.include?(key)
104
116
  next unless key.upcase == key # Non-upper case stuff isn't either
105
117
 
106
118
  # Rack adds in an incorrect HTTP_VERSION key, which causes downstream
@@ -110,7 +122,6 @@ module Raven
110
122
  # See: https://github.com/rack/rack/blob/028438f/lib/rack/handler/cgi.rb#L29
111
123
  next if key == 'HTTP_VERSION' && value == env_hash['SERVER_PROTOCOL']
112
124
  next if key == 'HTTP_COOKIE' # Cookies don't go here, they go somewhere else
113
-
114
125
  next unless key.start_with?('HTTP_') || %w(CONTENT_TYPE CONTENT_LENGTH).include?(key)
115
126
 
116
127
  # Rack stores headers as HTTP_WHAT_EVER, we need What-Ever
@@ -128,8 +139,10 @@ module Raven
128
139
  end
129
140
 
130
141
  def format_env_for_sentry(env_hash)
142
+ return env_hash if Raven.configuration.rack_env_whitelist.empty?
143
+
131
144
  env_hash.select do |k, _v|
132
- %w(REMOTE_ADDR SERVER_NAME SERVER_PORT).include? k.to_s
145
+ Raven.configuration.rack_env_whitelist.include? k.to_s
133
146
  end
134
147
  end
135
148
  end
@@ -5,6 +5,7 @@ module Raven
5
5
  require 'raven/integrations/rails/overrides/streaming_reporter'
6
6
  require 'raven/integrations/rails/controller_methods'
7
7
  require 'raven/integrations/rails/controller_transaction'
8
+ require 'raven/integrations/rails/backtrace_cleaner'
8
9
  require 'raven/integrations/rack'
9
10
 
10
11
  initializer "raven.use_rack_middleware" do |app|
@@ -37,12 +38,20 @@ module Raven
37
38
 
38
39
  config.before_initialize do
39
40
  Raven.configuration.logger = ::Rails.logger
41
+
42
+ backtrace_cleaner = Raven::Rails::BacktraceCleaner.new
43
+
44
+ Raven.configuration.backtrace_cleanup_callback = lambda do |backtrace|
45
+ backtrace_cleaner.clean(backtrace)
46
+ end
40
47
  end
41
48
 
42
49
  config.after_initialize do
43
- if Raven.configuration.rails_activesupport_breadcrumbs
44
- require 'raven/breadcrumbs/activesupport'
45
- Raven::ActiveSupportBreadcrumbs.inject
50
+ if Raven.configuration.breadcrumbs_logger.include?(:active_support_logger) ||
51
+ Raven.configuration.rails_activesupport_breadcrumbs
52
+
53
+ require 'raven/breadcrumbs/active_support_logger'
54
+ Raven::Breadcrumbs::ActiveSupportLogger.inject
46
55
  end
47
56
 
48
57
  if Raven.configuration.rails_report_rescued_exceptions
@@ -21,7 +21,8 @@ module Raven
21
21
  def capture_and_reraise_with_sentry(job, block)
22
22
  block.call
23
23
  rescue Exception => e # rubocop:disable Lint/RescueException
24
- return if rescue_with_handler(e)
24
+ rescue_handler_result = rescue_with_handler(e)
25
+ return rescue_handler_result if rescue_handler_result
25
26
 
26
27
  Raven.capture_exception(e, :extra => raven_context(job))
27
28
  raise e
@@ -0,0 +1,29 @@
1
+ require "active_support/backtrace_cleaner"
2
+ require "active_support/core_ext/string/access"
3
+
4
+ module Raven
5
+ class Rails
6
+ class BacktraceCleaner < ActiveSupport::BacktraceCleaner
7
+ APP_DIRS_PATTERN = /\A(?:\.\/)?(?:app|config|lib|test|\(\w*\))/.freeze
8
+ RENDER_TEMPLATE_PATTERN = /:in `.*_\w+_{2,3}\d+_\d+'/.freeze
9
+
10
+ def initialize
11
+ super
12
+ # we don't want any default silencers because they're too aggressive
13
+ remove_silencers!
14
+
15
+ @root = "#{Raven.configuration.project_root}/"
16
+ add_filter do |line|
17
+ line.start_with?(@root) ? line.from(@root.size) : line
18
+ end
19
+ add_filter do |line|
20
+ if line =~ RENDER_TEMPLATE_PATTERN
21
+ line.sub(RENDER_TEMPLATE_PATTERN, "")
22
+ else
23
+ line
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
@@ -1,87 +1,13 @@
1
1
  require 'time'
2
2
  require 'sidekiq'
3
-
4
- module Raven
5
- class SidekiqCleanupMiddleware
6
- def call(_worker, job, queue)
7
- Raven.context.transaction.push "Sidekiq/#{job['class']}"
8
- Raven.extra_context(:sidekiq => job.merge("queue" => queue))
9
- yield
10
- Context.clear!
11
- BreadcrumbBuffer.clear!
12
- end
13
- end
14
-
15
- class SidekiqErrorHandler
16
- ACTIVEJOB_RESERVED_PREFIX = "_aj_".freeze
17
- HAS_GLOBALID = const_defined?('GlobalID')
18
-
19
- def call(ex, context)
20
- context = filter_context(context)
21
- Raven.context.transaction.push transaction_from_context(context)
22
- Raven.capture_exception(
23
- ex,
24
- :message => ex.message,
25
- :extra => { :sidekiq => context }
26
- )
27
- Context.clear!
28
- BreadcrumbBuffer.clear!
29
- end
30
-
31
- private
32
-
33
- # Once an ActiveJob is queued, ActiveRecord references get serialized into
34
- # some internal reserved keys, such as _aj_globalid.
35
- #
36
- # The problem is, if this job in turn gets queued back into ActiveJob with
37
- # these magic reserved keys, ActiveJob will throw up and error. We want to
38
- # capture these and mutate the keys so we can sanely report it.
39
- def filter_context(context)
40
- case context
41
- when Array
42
- context.map { |arg| filter_context(arg) }
43
- when Hash
44
- Hash[context.map { |key, value| filter_context_hash(key, value) }]
45
- else
46
- format_globalid(context)
47
- end
48
- end
49
-
50
- def filter_context_hash(key, value)
51
- (key = key[3..-1]) if key [0..3] == ACTIVEJOB_RESERVED_PREFIX
52
- [key, filter_context(value)]
53
- end
54
-
55
- # this will change in the future:
56
- # https://github.com/mperham/sidekiq/pull/3161
57
- def transaction_from_context(context)
58
- classname = (context["wrapped"] || context["class"] ||
59
- (context[:job] && (context[:job]["wrapped"] || context[:job]["class"]))
60
- )
61
- if classname
62
- "Sidekiq/#{classname}"
63
- elsif context[:event]
64
- "Sidekiq/#{context[:event]}"
65
- else
66
- "Sidekiq"
67
- end
68
- end
69
-
70
- def format_globalid(context)
71
- if HAS_GLOBALID && context.is_a?(GlobalID)
72
- context.to_s
73
- else
74
- context
75
- end
76
- end
77
- end
78
- end
3
+ require 'raven/integrations/sidekiq/cleanup_middleware'
4
+ require 'raven/integrations/sidekiq/error_handler'
79
5
 
80
6
  if Sidekiq::VERSION > '3'
81
7
  Sidekiq.configure_server do |config|
82
- config.error_handlers << Raven::SidekiqErrorHandler.new
8
+ config.error_handlers << Raven::Sidekiq::ErrorHandler.new
83
9
  config.server_middleware do |chain|
84
- chain.add Raven::SidekiqCleanupMiddleware
10
+ chain.add Raven::Sidekiq::CleanupMiddleware
85
11
  end
86
12
  end
87
13
  end
@@ -0,0 +1,13 @@
1
+ module Raven
2
+ module Sidekiq
3
+ class CleanupMiddleware
4
+ def call(_worker, job, queue)
5
+ Raven.context.transaction.push "Sidekiq/#{job['class']}"
6
+ Raven.extra_context(:sidekiq => job.merge("queue" => queue))
7
+ yield
8
+ Context.clear!
9
+ BreadcrumbBuffer.clear!
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,38 @@
1
+ require 'raven/utils/context_filter'
2
+
3
+ module Raven
4
+ module Sidekiq
5
+ class ErrorHandler
6
+ SIDEKIQ_NAME = "Sidekiq".freeze
7
+
8
+ def call(ex, context)
9
+ context = Utils::ContextFilter.filter_context(context)
10
+ Raven.context.transaction.push transaction_from_context(context)
11
+ Raven.capture_exception(
12
+ ex,
13
+ :message => ex.message,
14
+ :extra => { :sidekiq => context }
15
+ )
16
+ Context.clear!
17
+ BreadcrumbBuffer.clear!
18
+ end
19
+
20
+ private
21
+
22
+ # this will change in the future:
23
+ # https://github.com/mperham/sidekiq/pull/3161
24
+ def transaction_from_context(context)
25
+ classname = (context["wrapped"] || context["class"] ||
26
+ (context[:job] && (context[:job]["wrapped"] || context[:job]["class"]))
27
+ )
28
+ if classname
29
+ "#{SIDEKIQ_NAME}/#{classname}"
30
+ elsif context[:event]
31
+ "#{SIDEKIQ_NAME}/#{context[:event]}"
32
+ else
33
+ SIDEKIQ_NAME
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
@@ -1,7 +1,5 @@
1
1
  require 'faraday'
2
2
 
3
- require 'raven/transports'
4
-
5
3
  module Raven
6
4
  module Transports
7
5
  class HTTP < Transport
@@ -0,0 +1,42 @@
1
+ module Raven
2
+ module Utils
3
+ module ContextFilter
4
+ class << self
5
+ ACTIVEJOB_RESERVED_PREFIX_REGEX = /^_aj_/.freeze
6
+ HAS_GLOBALID = const_defined?('GlobalID')
7
+
8
+ # Once an ActiveJob is queued, ActiveRecord references get serialized into
9
+ # some internal reserved keys, such as _aj_globalid.
10
+ #
11
+ # The problem is, if this job in turn gets queued back into ActiveJob with
12
+ # these magic reserved keys, ActiveJob will throw up and error. We want to
13
+ # capture these and mutate the keys so we can sanely report it.
14
+ def filter_context(context)
15
+ case context
16
+ when Array
17
+ context.map { |arg| filter_context(arg) }
18
+ when Hash
19
+ Hash[context.map { |key, value| filter_context_hash(key, value) }]
20
+ else
21
+ format_globalid(context)
22
+ end
23
+ end
24
+
25
+ private
26
+
27
+ def filter_context_hash(key, value)
28
+ key = key.to_s.sub(ACTIVEJOB_RESERVED_PREFIX_REGEX, "") if key.match(ACTIVEJOB_RESERVED_PREFIX_REGEX)
29
+ [key, filter_context(value)]
30
+ end
31
+
32
+ def format_globalid(context)
33
+ if HAS_GLOBALID && context.is_a?(GlobalID)
34
+ context.to_s
35
+ else
36
+ context
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Raven
4
- VERSION = "3.0.4"
4
+ VERSION = "3.1.1"
5
5
  end
@@ -1 +1,6 @@
1
- require 'raven/base'
1
+ require "raven/helpers/deprecation_helper"
2
+
3
+ filename = "sentry_raven_without_integrations"
4
+ DeprecationHelper.deprecate_dasherized_filename(filename)
5
+
6
+ require filename
@@ -0,0 +1 @@
1
+ require 'raven/base'
@@ -0,0 +1,11 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
@@ -0,0 +1,6 @@
1
+ ---
2
+ language: ruby
3
+ cache: bundler
4
+ rvm:
5
+ - 2.6.5
6
+ before_install: gem install bundler -v 2.1.1
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at stan001212@gmail.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [https://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: https://contributor-covenant.org
74
+ [version]: https://contributor-covenant.org/version/1/4/
@@ -0,0 +1,9 @@
1
+ source "https://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in sentry-ruby.gemspec
4
+ gemspec
5
+
6
+ gem "rake", "~> 12.0"
7
+ gem "rspec", "~> 3.0"
8
+
9
+ gem "pry"