sentry-rails 6.6.2 → 6.7.0

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.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -1
  3. data/Gemfile +50 -0
  4. data/README.md +1 -1
  5. data/bin/test +12 -386
  6. data/bin/test_old +389 -0
  7. data/gemfiles/ruby-2.7_rails-5.2.0.gemfile.lock +266 -0
  8. data/gemfiles/ruby-2.7_rails-6.0.0.gemfile.lock +282 -0
  9. data/gemfiles/ruby-2.7_rails-6.1.0.gemfile.lock +294 -0
  10. data/gemfiles/ruby-2.7_rails-7.0.0.gemfile.lock +311 -0
  11. data/gemfiles/ruby-2.7_rails-7.1.0.gemfile.lock +348 -0
  12. data/gemfiles/ruby-3.0_rails-6.1.0.gemfile.lock +362 -0
  13. data/gemfiles/ruby-3.0_rails-7.0.0.gemfile.lock +379 -0
  14. data/gemfiles/ruby-3.0_rails-7.1.0.gemfile.lock +405 -0
  15. data/gemfiles/ruby-3.1_rails-6.1.0.gemfile.lock +493 -0
  16. data/gemfiles/ruby-3.1_rails-7.0.0.gemfile.lock +513 -0
  17. data/gemfiles/ruby-3.1_rails-7.1.0.gemfile.lock +547 -0
  18. data/gemfiles/ruby-3.1_rails-7.2.0.gemfile.lock +541 -0
  19. data/gemfiles/ruby-3.2_rails-6.1.0.gemfile.lock +493 -0
  20. data/gemfiles/ruby-3.2_rails-7.0.0.gemfile.lock +511 -0
  21. data/gemfiles/ruby-3.2_rails-7.1.0.gemfile.lock +553 -0
  22. data/gemfiles/ruby-3.2_rails-7.2.0.gemfile.lock +545 -0
  23. data/gemfiles/ruby-3.2_rails-8.0.0.gemfile.lock +544 -0
  24. data/gemfiles/ruby-3.3_rails-6.1.0.gemfile.lock +493 -0
  25. data/gemfiles/ruby-3.3_rails-7.0.0.gemfile.lock +511 -0
  26. data/gemfiles/ruby-3.3_rails-7.1.0.gemfile.lock +553 -0
  27. data/gemfiles/ruby-3.3_rails-7.2.0.gemfile.lock +545 -0
  28. data/gemfiles/ruby-3.3_rails-8.0.0.gemfile.lock +544 -0
  29. data/gemfiles/ruby-3.4_rails-7.1.0.gemfile.lock +534 -0
  30. data/gemfiles/ruby-3.4_rails-7.2.0.gemfile.lock +528 -0
  31. data/gemfiles/ruby-3.4_rails-8.0.0.gemfile.lock +523 -0
  32. data/gemfiles/ruby-3.4_rails-8.1.3.gemfile.lock +527 -0
  33. data/gemfiles/ruby-4.0_rails-6.1.0.gemfile.lock +476 -0
  34. data/gemfiles/ruby-4.0_rails-7.0.0.gemfile.lock +492 -0
  35. data/gemfiles/ruby-4.0_rails-7.1.0.gemfile.lock +534 -0
  36. data/gemfiles/ruby-4.0_rails-8.0.0.gemfile.lock +523 -0
  37. data/gemfiles/ruby-4.0_rails-8.1.3.gemfile.lock +527 -0
  38. data/gemfiles/ruby-jruby-9.4.14.0_rails-6.1.0.gemfile.lock +369 -0
  39. data/gemfiles/ruby-jruby-9.4.14.0_rails-7.0.0.gemfile.lock +391 -0
  40. data/gemfiles/ruby-jruby-9.4.14.0_rails-7.1.0.gemfile.lock +425 -0
  41. data/lib/sentry/rails/active_job.rb +177 -24
  42. data/lib/sentry/rails/capture_exceptions.rb +5 -1
  43. data/lib/sentry/rails/configuration.rb +6 -0
  44. data/lib/sentry/rails/error_reporter_context.rb +26 -0
  45. data/lib/sentry/rails/railtie.rb +7 -0
  46. data/lib/sentry/rails/serializer.rb +35 -0
  47. data/lib/sentry/rails/version.rb +1 -1
  48. data/sentry-rails.gemspec +2 -2
  49. metadata +45 -8
@@ -1,8 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "sentry/rails/error_reporter_context"
4
+
3
5
  module Sentry
4
6
  module Rails
5
7
  class CaptureExceptions < Sentry::Rack::CaptureExceptions
8
+ include ErrorReporterContext
9
+
6
10
  RAILS_7_1 = Gem::Version.new(::Rails.version) >= Gem::Version.new("7.1.0.alpha")
7
11
  SPAN_ORIGIN = "auto.http.rails"
8
12
 
@@ -30,7 +34,7 @@ module Sentry
30
34
  return unless Sentry.initialized?
31
35
  return if show_exceptions?(exception, env) && !Sentry.configuration.rails.report_rescued_exceptions
32
36
 
33
- Sentry::Rails.capture_exception(exception).tap do |event|
37
+ Sentry::Rails.capture_exception(exception, contexts: execution_context).tap do |event|
34
38
  env[ERROR_EVENT_ID_KEY] = event.event_id if event
35
39
  end
36
40
  end
@@ -172,6 +172,11 @@ module Sentry
172
172
  # Set this option to true if you want Sentry to capture each retry failure
173
173
  attr_accessor :active_job_report_on_retry_error
174
174
 
175
+ # Whether we should inject trace propagation headers into the serialized job
176
+ # payload in order to have a connected trace between producer and consumer.
177
+ # Defaults to true. Set to false to opt out.
178
+ attr_accessor :active_job_propagate_traces
179
+
175
180
  # Configuration for structured logging feature
176
181
  # @return [StructuredLoggingConfiguration]
177
182
  attr_reader :structured_logging
@@ -193,6 +198,7 @@ module Sentry
193
198
  @db_query_source_threshold_ms = 100
194
199
  @active_support_logger_subscription_items = Sentry::Rails::ACTIVE_SUPPORT_LOGGER_SUBSCRIPTION_ITEMS_DEFAULT.dup
195
200
  @active_job_report_on_retry_error = false
201
+ @active_job_propagate_traces = true
196
202
  @structured_logging = StructuredLoggingConfiguration.new
197
203
  end
198
204
  end
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "sentry/rails/serializer"
4
+
5
+ module Sentry
6
+ module Rails
7
+ module ErrorReporterContext
8
+ SUPPORTS_EXECUTION_CONTEXT = Gem::Version.new(::Rails.version) >= Gem::Version.new("7.0.0")
9
+
10
+ if SUPPORTS_EXECUTION_CONTEXT
11
+ def execution_context
12
+ return {} unless Sentry.configuration.send_default_pii
13
+
14
+ context = ::ActiveSupport::ExecutionContext.to_h
15
+ return {} if context.empty?
16
+
17
+ { "rails.error" => Sentry::Rails::Serializer.serialize(context) }
18
+ end
19
+ else
20
+ def execution_context
21
+ {}
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -21,6 +21,13 @@ module Sentry
21
21
  ActiveSupport.on_load(:active_job) do
22
22
  require "sentry/rails/active_job"
23
23
  prepend Sentry::Rails::ActiveJobExtensions
24
+
25
+ unless Sentry::Rails::ActiveJobExtensions::SentryReporter.producer_callback_registered?
26
+ around_enqueue do |job, block|
27
+ Sentry::Rails::ActiveJobExtensions::SentryReporter.record_producer_span(job, &block)
28
+ end
29
+ Sentry::Rails::ActiveJobExtensions::SentryReporter.producer_callback_registered!
30
+ end
24
31
  end
25
32
  end
26
33
 
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Sentry
4
+ module Rails
5
+ module Serializer
6
+ def self.serialize(value)
7
+ case value
8
+ when Range
9
+ serialize_range(value)
10
+ when Hash
11
+ value.transform_values { |item| serialize(item) }
12
+ when Array, Enumerable
13
+ value.map { |item| serialize(item) }
14
+ when ->(item) { item.respond_to?(:to_global_id) }
15
+ serialize_global_id(value)
16
+ else
17
+ value
18
+ end
19
+ end
20
+
21
+ def self.serialize_global_id(value)
22
+ value.to_global_id.to_s
23
+ rescue StandardError
24
+ value
25
+ end
26
+
27
+ def self.serialize_range(range)
28
+ return range.to_s if range.begin.nil? || range.end.nil?
29
+ return range.to_s if range.begin.is_a?(::ActiveSupport::TimeWithZone)
30
+
31
+ range.map { |item| serialize(item) }
32
+ end
33
+ end
34
+ end
35
+ end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Sentry
4
4
  module Rails
5
- VERSION = "6.6.2"
5
+ VERSION = "6.7.0"
6
6
  end
7
7
  end
data/sentry-rails.gemspec CHANGED
@@ -13,7 +13,7 @@ Gem::Specification.new do |spec|
13
13
  spec.platform = Gem::Platform::RUBY
14
14
  spec.required_ruby_version = '>= 2.7'
15
15
  spec.extra_rdoc_files = ["README.md", "LICENSE.txt"]
16
- spec.files = `git ls-files | grep -Ev '^(spec|benchmarks|examples|\.rubocop\.yml)'`.split("\n")
16
+ spec.files = `git ls-files | grep -Ev '^(spec|benchmarks|examples|test-matrix\.json|\.rubocop\.yml)'`.split("\n")
17
17
 
18
18
  github_root_uri = 'https://github.com/getsentry/sentry-ruby'
19
19
  spec.homepage = "#{github_root_uri}/tree/#{spec.version}/#{spec.name}"
@@ -31,5 +31,5 @@ Gem::Specification.new do |spec|
31
31
  spec.require_paths = ["lib"]
32
32
 
33
33
  spec.add_dependency "railties", ">= 5.2.0"
34
- spec.add_dependency "sentry-ruby", "~> 6.6.2"
34
+ spec.add_dependency "sentry-ruby", "~> 6.7.0"
35
35
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sentry-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.6.2
4
+ version: 6.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sentry Team
@@ -29,14 +29,14 @@ dependencies:
29
29
  requirements:
30
30
  - - "~>"
31
31
  - !ruby/object:Gem::Version
32
- version: 6.6.2
32
+ version: 6.7.0
33
33
  type: :runtime
34
34
  prerelease: false
35
35
  version_requirements: !ruby/object:Gem::Requirement
36
36
  requirements:
37
37
  - - "~>"
38
38
  - !ruby/object:Gem::Version
39
- version: 6.6.2
39
+ version: 6.7.0
40
40
  description: A gem that provides Rails integration for the Sentry error logger
41
41
  email: accounts@sentry.io
42
42
  executables: []
@@ -57,6 +57,41 @@ files:
57
57
  - bin/console
58
58
  - bin/setup
59
59
  - bin/test
60
+ - bin/test_old
61
+ - gemfiles/ruby-2.7_rails-5.2.0.gemfile.lock
62
+ - gemfiles/ruby-2.7_rails-6.0.0.gemfile.lock
63
+ - gemfiles/ruby-2.7_rails-6.1.0.gemfile.lock
64
+ - gemfiles/ruby-2.7_rails-7.0.0.gemfile.lock
65
+ - gemfiles/ruby-2.7_rails-7.1.0.gemfile.lock
66
+ - gemfiles/ruby-3.0_rails-6.1.0.gemfile.lock
67
+ - gemfiles/ruby-3.0_rails-7.0.0.gemfile.lock
68
+ - gemfiles/ruby-3.0_rails-7.1.0.gemfile.lock
69
+ - gemfiles/ruby-3.1_rails-6.1.0.gemfile.lock
70
+ - gemfiles/ruby-3.1_rails-7.0.0.gemfile.lock
71
+ - gemfiles/ruby-3.1_rails-7.1.0.gemfile.lock
72
+ - gemfiles/ruby-3.1_rails-7.2.0.gemfile.lock
73
+ - gemfiles/ruby-3.2_rails-6.1.0.gemfile.lock
74
+ - gemfiles/ruby-3.2_rails-7.0.0.gemfile.lock
75
+ - gemfiles/ruby-3.2_rails-7.1.0.gemfile.lock
76
+ - gemfiles/ruby-3.2_rails-7.2.0.gemfile.lock
77
+ - gemfiles/ruby-3.2_rails-8.0.0.gemfile.lock
78
+ - gemfiles/ruby-3.3_rails-6.1.0.gemfile.lock
79
+ - gemfiles/ruby-3.3_rails-7.0.0.gemfile.lock
80
+ - gemfiles/ruby-3.3_rails-7.1.0.gemfile.lock
81
+ - gemfiles/ruby-3.3_rails-7.2.0.gemfile.lock
82
+ - gemfiles/ruby-3.3_rails-8.0.0.gemfile.lock
83
+ - gemfiles/ruby-3.4_rails-7.1.0.gemfile.lock
84
+ - gemfiles/ruby-3.4_rails-7.2.0.gemfile.lock
85
+ - gemfiles/ruby-3.4_rails-8.0.0.gemfile.lock
86
+ - gemfiles/ruby-3.4_rails-8.1.3.gemfile.lock
87
+ - gemfiles/ruby-4.0_rails-6.1.0.gemfile.lock
88
+ - gemfiles/ruby-4.0_rails-7.0.0.gemfile.lock
89
+ - gemfiles/ruby-4.0_rails-7.1.0.gemfile.lock
90
+ - gemfiles/ruby-4.0_rails-8.0.0.gemfile.lock
91
+ - gemfiles/ruby-4.0_rails-8.1.3.gemfile.lock
92
+ - gemfiles/ruby-jruby-9.4.14.0_rails-6.1.0.gemfile.lock
93
+ - gemfiles/ruby-jruby-9.4.14.0_rails-7.0.0.gemfile.lock
94
+ - gemfiles/ruby-jruby-9.4.14.0_rails-7.1.0.gemfile.lock
60
95
  - lib/generators/sentry_generator.rb
61
96
  - lib/sentry-rails.rb
62
97
  - lib/sentry/rails.rb
@@ -70,6 +105,7 @@ files:
70
105
  - lib/sentry/rails/controller_methods.rb
71
106
  - lib/sentry/rails/controller_transaction.rb
72
107
  - lib/sentry/rails/engine.rb
108
+ - lib/sentry/rails/error_reporter_context.rb
73
109
  - lib/sentry/rails/error_subscriber.rb
74
110
  - lib/sentry/rails/log_subscriber.rb
75
111
  - lib/sentry/rails/log_subscribers/action_controller_subscriber.rb
@@ -80,6 +116,7 @@ files:
80
116
  - lib/sentry/rails/overrides/streaming_reporter.rb
81
117
  - lib/sentry/rails/railtie.rb
82
118
  - lib/sentry/rails/rescued_exception_interceptor.rb
119
+ - lib/sentry/rails/serializer.rb
83
120
  - lib/sentry/rails/structured_logging.rb
84
121
  - lib/sentry/rails/tracing.rb
85
122
  - lib/sentry/rails/tracing/abstract_subscriber.rb
@@ -89,15 +126,15 @@ files:
89
126
  - lib/sentry/rails/tracing/active_support_subscriber.rb
90
127
  - lib/sentry/rails/version.rb
91
128
  - sentry-rails.gemspec
92
- homepage: https://github.com/getsentry/sentry-ruby/tree/6.6.2/sentry-rails
129
+ homepage: https://github.com/getsentry/sentry-ruby/tree/6.7.0/sentry-rails
93
130
  licenses:
94
131
  - MIT
95
132
  metadata:
96
- homepage_uri: https://github.com/getsentry/sentry-ruby/tree/6.6.2/sentry-rails
97
- source_code_uri: https://github.com/getsentry/sentry-ruby/tree/6.6.2/sentry-rails
98
- changelog_uri: https://github.com/getsentry/sentry-ruby/blob/6.6.2/CHANGELOG.md
133
+ homepage_uri: https://github.com/getsentry/sentry-ruby/tree/6.7.0/sentry-rails
134
+ source_code_uri: https://github.com/getsentry/sentry-ruby/tree/6.7.0/sentry-rails
135
+ changelog_uri: https://github.com/getsentry/sentry-ruby/blob/6.7.0/CHANGELOG.md
99
136
  bug_tracker_uri: https://github.com/getsentry/sentry-ruby/issues
100
- documentation_uri: http://www.rubydoc.info/gems/sentry-rails/6.6.2
137
+ documentation_uri: http://www.rubydoc.info/gems/sentry-rails/6.7.0
101
138
  rdoc_options: []
102
139
  require_paths:
103
140
  - lib