sentry-rails 4.1.7 → 4.2.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +37 -1
- data/Gemfile +3 -0
- data/app/jobs/sentry/send_event_job.rb +20 -0
- data/lib/sentry/rails.rb +1 -0
- data/lib/sentry/rails/active_job.rb +16 -18
- data/lib/sentry/rails/configuration.rb +7 -2
- data/lib/sentry/rails/engine.rb +5 -0
- data/lib/sentry/rails/railtie.rb +5 -0
- data/lib/sentry/rails/version.rb +1 -1
- data/sentry-rails.gemspec +1 -1
- metadata +6 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 88b2f50f7497ed668cc86fda80d8bbd653e3e01b3a7d3c3f7643e5de81de697c
|
4
|
+
data.tar.gz: e2ee2b20c9a85f947f4fcfe4f5c68b82226336aa54c73b5c116e767307bb4cd0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1c86549b0348fec623ed863f9f11147d6cf04c20a7c8cd4ba96755959084f8d8436a8ee768edf5011230b7dfe62155aafcca7f1aaebf298a30d2dff1799c9310
|
7
|
+
data.tar.gz: f6ee86657ef5960e22fe72c826b86ee0992a16769416429ab791821b2d974672ebe83d3c8fead135554ad2acdda6c0f59ad4a1c291d0ae3e6e7dc8d1584dfee4
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,42 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 4.2.0
|
4
|
+
|
5
|
+
### Features
|
6
|
+
|
7
|
+
- Make sentry-rails a Rails engine and provide default job class for async [#1181](https://github.com/getsentry/sentry-ruby/pull/1181)
|
8
|
+
|
9
|
+
`sentry-rails` now provides a default ActiveJob class for sending events asynchronously. You can use it directly without define your own one:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
config.async = lambda { |event, hint| Sentry::SendEventJob.perform_later(event, hint) }
|
13
|
+
```
|
14
|
+
|
15
|
+
- Add configuration option for trusted proxies [#1126](https://github.com/getsentry/sentry-ruby/pull/1126)
|
16
|
+
|
17
|
+
`sentry-rails` now injects `Rails.application.config.action_dispatch.trusted_proxies` into `Sentry.configuration.trusted_proxies` automatically.
|
18
|
+
|
19
|
+
- Allow users to configure ActiveJob adapters to ignore [#1256](https://github.com/getsentry/sentry-ruby/pull/1256)
|
20
|
+
|
21
|
+
```ruby
|
22
|
+
# sentry-rails will skip active_job reporting for jobs that use ActiveJob::QueueAdapters::SidekiqAdapter
|
23
|
+
# you should use this option when:
|
24
|
+
# - you don't want to see events from a certain adapter
|
25
|
+
# - you already have a better reporting setup for the adapter (like having `sentry-sidekiq` installed)
|
26
|
+
config.rails.skippable_job_adapters = ["ActiveJob::QueueAdapters::SidekiqAdapter"]
|
27
|
+
```
|
28
|
+
|
29
|
+
- Tag `job_id` and `provider_job_id` on ActiveJob events [#1259](https://github.com/getsentry/sentry-ruby/pull/1259)
|
30
|
+
|
31
|
+
<img width="1330" alt="example of tagged event" src="https://user-images.githubusercontent.com/5079556/106389781-3a03f100-6420-11eb-810c-a99869eb26dd.png">
|
32
|
+
|
33
|
+
- Use another method for post initialization callback [#1261](https://github.com/getsentry/sentry-ruby/pull/1261)
|
34
|
+
|
35
|
+
### Bug Fixes
|
36
|
+
|
37
|
+
- Inspect exception cause by default & don't exclude ActiveJob::DeserializationError [#1180](https://github.com/getsentry/sentry-ruby/pull/1180)
|
38
|
+
- Fixes [#1071](https://github.com/getsentry/sentry-ruby/issues/1071)
|
39
|
+
|
3
40
|
## 4.1.7
|
4
41
|
|
5
42
|
- Use env to carry original transaction name [#1255](https://github.com/getsentry/sentry-ruby/pull/1255)
|
@@ -75,4 +112,3 @@ Release test
|
|
75
112
|
## 0.1.0
|
76
113
|
|
77
114
|
First version
|
78
|
-
|
data/Gemfile
CHANGED
@@ -0,0 +1,20 @@
|
|
1
|
+
return unless defined?(ActiveJob)
|
2
|
+
|
3
|
+
module Sentry
|
4
|
+
parent_job =
|
5
|
+
if defined?(ApplicationJob)
|
6
|
+
ApplicationJob
|
7
|
+
else
|
8
|
+
ActiveJob::Base
|
9
|
+
end
|
10
|
+
|
11
|
+
class SendEventJob < parent_job
|
12
|
+
self.log_arguments = false if ::Rails.version.to_f >= 6.1
|
13
|
+
discard_on ActiveJob::DeserializationError # this will prevent infinite loop when there's an issue deserializing SentryJob
|
14
|
+
|
15
|
+
def perform(event, hint = {})
|
16
|
+
Sentry.send_event(event, hint)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
data/lib/sentry/rails.rb
CHANGED
@@ -1,10 +1,6 @@
|
|
1
1
|
module Sentry
|
2
2
|
module Rails
|
3
3
|
module ActiveJobExtensions
|
4
|
-
ALREADY_SUPPORTED_SENTRY_ADAPTERS = %w(
|
5
|
-
ActiveJob::QueueAdapters::SidekiqAdapter
|
6
|
-
).freeze
|
7
|
-
|
8
4
|
def self.included(base)
|
9
5
|
base.class_eval do
|
10
6
|
around_perform do |job, block|
|
@@ -29,28 +25,30 @@ module Sentry
|
|
29
25
|
rescue_handler_result = rescue_with_handler(e)
|
30
26
|
return rescue_handler_result if rescue_handler_result
|
31
27
|
|
32
|
-
Sentry::Rails.capture_exception(
|
28
|
+
Sentry::Rails.capture_exception(
|
29
|
+
e,
|
30
|
+
extra: sentry_context(job),
|
31
|
+
tags: {
|
32
|
+
job_id: job.job_id,
|
33
|
+
provider_job_id: job.provider_job_id
|
34
|
+
}
|
35
|
+
)
|
33
36
|
raise e
|
34
37
|
end
|
35
38
|
|
36
39
|
def already_supported_by_specific_integration?(job)
|
37
|
-
|
40
|
+
Sentry.configuration.rails.skippable_job_adapters.include?(job.class.queue_adapter.class.to_s)
|
38
41
|
end
|
39
42
|
|
40
43
|
def sentry_context(job)
|
41
|
-
|
42
|
-
:
|
43
|
-
:
|
44
|
-
:
|
45
|
-
:
|
46
|
-
:
|
44
|
+
{
|
45
|
+
active_job: job.class.name,
|
46
|
+
arguments: job.arguments,
|
47
|
+
scheduled_at: job.scheduled_at,
|
48
|
+
job_id: job.job_id,
|
49
|
+
provider_job_id: job.provider_job_id,
|
50
|
+
locale: job.locale
|
47
51
|
}
|
48
|
-
# Add provider_job_id details if Rails 5
|
49
|
-
if job.respond_to?(:provider_job_id)
|
50
|
-
ctx[:provider_job_id] = job.provider_job_id
|
51
|
-
end
|
52
|
-
|
53
|
-
ctx
|
54
52
|
end
|
55
53
|
end
|
56
54
|
end
|
@@ -2,7 +2,7 @@ module Sentry
|
|
2
2
|
class Configuration
|
3
3
|
attr_reader :rails
|
4
4
|
|
5
|
-
|
5
|
+
add_post_initialization_callback do
|
6
6
|
@rails = Sentry::Rails::Configuration.new
|
7
7
|
@excluded_exceptions = @excluded_exceptions.concat(Sentry::Rails::IGNORE_DEFAULT)
|
8
8
|
end
|
@@ -23,7 +23,6 @@ module Sentry
|
|
23
23
|
'ActionDispatch::Http::MimeNegotiation::InvalidType',
|
24
24
|
'ActionController::UnknownHttpMethod',
|
25
25
|
'ActionDispatch::Http::Parameters::ParseError',
|
26
|
-
'ActiveJob::DeserializationError', # Can cause infinite loops
|
27
26
|
'ActiveRecord::RecordNotFound'
|
28
27
|
].freeze
|
29
28
|
class Configuration
|
@@ -33,8 +32,14 @@ module Sentry
|
|
33
32
|
# will report exceptions even when they are rescued by these middlewares.
|
34
33
|
attr_accessor :report_rescued_exceptions
|
35
34
|
|
35
|
+
# Some adapters, like sidekiq, already have their own sentry integration.
|
36
|
+
# In those cases, we should skip ActiveJob's reporting to avoid duplicated reports.
|
37
|
+
attr_accessor :skippable_job_adapters
|
38
|
+
|
36
39
|
def initialize
|
37
40
|
@report_rescued_exceptions = true
|
41
|
+
# TODO: Remove this in 4.2.0
|
42
|
+
@skippable_job_adapters = []
|
38
43
|
end
|
39
44
|
end
|
40
45
|
end
|
data/lib/sentry/rails/railtie.rb
CHANGED
@@ -22,6 +22,7 @@ module Sentry
|
|
22
22
|
|
23
23
|
configure_project_root
|
24
24
|
configure_sentry_logger
|
25
|
+
configure_trusted_proxies
|
25
26
|
extend_controller_methods
|
26
27
|
extend_active_job if defined?(ActiveJob)
|
27
28
|
override_streaming_reporter
|
@@ -39,6 +40,10 @@ module Sentry
|
|
39
40
|
Sentry.configuration.logger = ::Rails.logger
|
40
41
|
end
|
41
42
|
|
43
|
+
def configure_trusted_proxies
|
44
|
+
Sentry.configuration.trusted_proxies += Array(::Rails.application.config.action_dispatch.trusted_proxies)
|
45
|
+
end
|
46
|
+
|
42
47
|
def extend_active_job
|
43
48
|
require "sentry/rails/active_job"
|
44
49
|
ActiveJob::Base.send(:prepend, Sentry::Rails::ActiveJobExtensions)
|
data/lib/sentry/rails/version.rb
CHANGED
data/sentry-rails.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sentry-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sentry Team
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-02-
|
11
|
+
date: 2021-02-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 4.
|
33
|
+
version: 4.2.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 4.
|
40
|
+
version: 4.2.0
|
41
41
|
description: A gem that provides Rails integration for the Sentry error logger
|
42
42
|
email: accounts@sentry.io
|
43
43
|
executables: []
|
@@ -56,6 +56,7 @@ files:
|
|
56
56
|
- Makefile
|
57
57
|
- README.md
|
58
58
|
- Rakefile
|
59
|
+
- app/jobs/sentry/send_event_job.rb
|
59
60
|
- bin/console
|
60
61
|
- bin/setup
|
61
62
|
- lib/sentry-rails.rb
|
@@ -67,6 +68,7 @@ files:
|
|
67
68
|
- lib/sentry/rails/configuration.rb
|
68
69
|
- lib/sentry/rails/controller_methods.rb
|
69
70
|
- lib/sentry/rails/controller_transaction.rb
|
71
|
+
- lib/sentry/rails/engine.rb
|
70
72
|
- lib/sentry/rails/overrides/file_handler.rb
|
71
73
|
- lib/sentry/rails/overrides/streaming_reporter.rb
|
72
74
|
- lib/sentry/rails/railtie.rb
|