sentry-rails 5.26.0 → 6.0.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/Gemfile +14 -15
- data/bin/test +389 -0
- data/lib/sentry/rails/active_job.rb +7 -11
- data/lib/sentry/rails/background_worker.rb +11 -7
- data/lib/sentry/rails/configuration.rb +39 -2
- data/lib/sentry/rails/log_subscriber.rb +73 -0
- data/lib/sentry/rails/log_subscribers/action_controller_subscriber.rb +116 -0
- data/lib/sentry/rails/log_subscribers/action_mailer_subscriber.rb +88 -0
- data/lib/sentry/rails/log_subscribers/active_job_subscriber.rb +155 -0
- data/lib/sentry/rails/log_subscribers/active_record_subscriber.rb +134 -0
- data/lib/sentry/rails/log_subscribers/parameter_filter.rb +52 -0
- data/lib/sentry/rails/overrides/streaming_reporter.rb +0 -11
- data/lib/sentry/rails/railtie.rb +10 -8
- data/lib/sentry/rails/structured_logging.rb +32 -0
- data/lib/sentry/rails/version.rb +1 -1
- data/lib/sentry/rails.rb +1 -0
- data/sentry-rails.gemspec +3 -3
- metadata +20 -15
- data/lib/sentry/rails/breadcrumb/monotonic_active_support_logger.rb +0 -46
- data/lib/sentry/rails/instrument_payload_cleanup_helper.rb +0 -15
- data/lib/sentry/rails/tracing/action_controller_subscriber.rb +0 -43
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:
|
|
4
|
+
version: 6.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Sentry Team
|
|
@@ -15,28 +15,28 @@ dependencies:
|
|
|
15
15
|
requirements:
|
|
16
16
|
- - ">="
|
|
17
17
|
- !ruby/object:Gem::Version
|
|
18
|
-
version:
|
|
18
|
+
version: 5.2.0
|
|
19
19
|
type: :runtime
|
|
20
20
|
prerelease: false
|
|
21
21
|
version_requirements: !ruby/object:Gem::Requirement
|
|
22
22
|
requirements:
|
|
23
23
|
- - ">="
|
|
24
24
|
- !ruby/object:Gem::Version
|
|
25
|
-
version:
|
|
25
|
+
version: 5.2.0
|
|
26
26
|
- !ruby/object:Gem::Dependency
|
|
27
27
|
name: sentry-ruby
|
|
28
28
|
requirement: !ruby/object:Gem::Requirement
|
|
29
29
|
requirements:
|
|
30
30
|
- - "~>"
|
|
31
31
|
- !ruby/object:Gem::Version
|
|
32
|
-
version:
|
|
32
|
+
version: 6.0.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:
|
|
39
|
+
version: 6.0.0
|
|
40
40
|
description: A gem that provides Rails integration for the Sentry error logger
|
|
41
41
|
email: accounts@sentry.io
|
|
42
42
|
executables: []
|
|
@@ -56,6 +56,7 @@ files:
|
|
|
56
56
|
- app/jobs/sentry/send_event_job.rb
|
|
57
57
|
- bin/console
|
|
58
58
|
- bin/setup
|
|
59
|
+
- bin/test
|
|
59
60
|
- lib/generators/sentry_generator.rb
|
|
60
61
|
- lib/sentry-rails.rb
|
|
61
62
|
- lib/sentry/rails.rb
|
|
@@ -64,35 +65,39 @@ files:
|
|
|
64
65
|
- lib/sentry/rails/background_worker.rb
|
|
65
66
|
- lib/sentry/rails/backtrace_cleaner.rb
|
|
66
67
|
- lib/sentry/rails/breadcrumb/active_support_logger.rb
|
|
67
|
-
- lib/sentry/rails/breadcrumb/monotonic_active_support_logger.rb
|
|
68
68
|
- lib/sentry/rails/capture_exceptions.rb
|
|
69
69
|
- lib/sentry/rails/configuration.rb
|
|
70
70
|
- lib/sentry/rails/controller_methods.rb
|
|
71
71
|
- lib/sentry/rails/controller_transaction.rb
|
|
72
72
|
- lib/sentry/rails/engine.rb
|
|
73
73
|
- lib/sentry/rails/error_subscriber.rb
|
|
74
|
-
- lib/sentry/rails/
|
|
74
|
+
- lib/sentry/rails/log_subscriber.rb
|
|
75
|
+
- lib/sentry/rails/log_subscribers/action_controller_subscriber.rb
|
|
76
|
+
- lib/sentry/rails/log_subscribers/action_mailer_subscriber.rb
|
|
77
|
+
- lib/sentry/rails/log_subscribers/active_job_subscriber.rb
|
|
78
|
+
- lib/sentry/rails/log_subscribers/active_record_subscriber.rb
|
|
79
|
+
- lib/sentry/rails/log_subscribers/parameter_filter.rb
|
|
75
80
|
- lib/sentry/rails/overrides/streaming_reporter.rb
|
|
76
81
|
- lib/sentry/rails/railtie.rb
|
|
77
82
|
- lib/sentry/rails/rescued_exception_interceptor.rb
|
|
83
|
+
- lib/sentry/rails/structured_logging.rb
|
|
78
84
|
- lib/sentry/rails/tracing.rb
|
|
79
85
|
- lib/sentry/rails/tracing/abstract_subscriber.rb
|
|
80
|
-
- lib/sentry/rails/tracing/action_controller_subscriber.rb
|
|
81
86
|
- lib/sentry/rails/tracing/action_view_subscriber.rb
|
|
82
87
|
- lib/sentry/rails/tracing/active_record_subscriber.rb
|
|
83
88
|
- lib/sentry/rails/tracing/active_storage_subscriber.rb
|
|
84
89
|
- lib/sentry/rails/tracing/active_support_subscriber.rb
|
|
85
90
|
- lib/sentry/rails/version.rb
|
|
86
91
|
- sentry-rails.gemspec
|
|
87
|
-
homepage: https://github.com/getsentry/sentry-ruby/tree/
|
|
92
|
+
homepage: https://github.com/getsentry/sentry-ruby/tree/6.0.0/sentry-rails
|
|
88
93
|
licenses:
|
|
89
94
|
- MIT
|
|
90
95
|
metadata:
|
|
91
|
-
homepage_uri: https://github.com/getsentry/sentry-ruby/tree/
|
|
92
|
-
source_code_uri: https://github.com/getsentry/sentry-ruby/tree/
|
|
93
|
-
changelog_uri: https://github.com/getsentry/sentry-ruby/blob/
|
|
96
|
+
homepage_uri: https://github.com/getsentry/sentry-ruby/tree/6.0.0/sentry-rails
|
|
97
|
+
source_code_uri: https://github.com/getsentry/sentry-ruby/tree/6.0.0/sentry-rails
|
|
98
|
+
changelog_uri: https://github.com/getsentry/sentry-ruby/blob/6.0.0/CHANGELOG.md
|
|
94
99
|
bug_tracker_uri: https://github.com/getsentry/sentry-ruby/issues
|
|
95
|
-
documentation_uri: http://www.rubydoc.info/gems/sentry-rails/
|
|
100
|
+
documentation_uri: http://www.rubydoc.info/gems/sentry-rails/6.0.0
|
|
96
101
|
rdoc_options: []
|
|
97
102
|
require_paths:
|
|
98
103
|
- lib
|
|
@@ -100,14 +105,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
100
105
|
requirements:
|
|
101
106
|
- - ">="
|
|
102
107
|
- !ruby/object:Gem::Version
|
|
103
|
-
version: '2.
|
|
108
|
+
version: '2.7'
|
|
104
109
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
105
110
|
requirements:
|
|
106
111
|
- - ">="
|
|
107
112
|
- !ruby/object:Gem::Version
|
|
108
113
|
version: '0'
|
|
109
114
|
requirements: []
|
|
110
|
-
rubygems_version: 3.6.
|
|
115
|
+
rubygems_version: 3.6.9
|
|
111
116
|
specification_version: 4
|
|
112
117
|
summary: A gem that provides Rails integration for the Sentry error logger
|
|
113
118
|
test_files: []
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require "sentry/rails/instrument_payload_cleanup_helper"
|
|
4
|
-
|
|
5
|
-
module Sentry
|
|
6
|
-
module Rails
|
|
7
|
-
module Breadcrumb
|
|
8
|
-
module MonotonicActiveSupportLogger
|
|
9
|
-
class << self
|
|
10
|
-
include InstrumentPayloadCleanupHelper
|
|
11
|
-
|
|
12
|
-
def add(name, started, _finished, _unique_id, data)
|
|
13
|
-
# skip Rails' internal events
|
|
14
|
-
return if name.start_with?("!")
|
|
15
|
-
|
|
16
|
-
if data.is_a?(Hash)
|
|
17
|
-
# we should only mutate the copy of the data
|
|
18
|
-
data = data.dup
|
|
19
|
-
cleanup_data(data)
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
crumb = Sentry::Breadcrumb.new(
|
|
23
|
-
data: data,
|
|
24
|
-
category: name,
|
|
25
|
-
timestamp: started.to_i
|
|
26
|
-
)
|
|
27
|
-
Sentry.add_breadcrumb(crumb)
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
def inject
|
|
31
|
-
@subscriber = ::ActiveSupport::Notifications.monotonic_subscribe(/.*/) do |name, started, finished, unique_id, data|
|
|
32
|
-
# we only record events that has a float as started timestamp
|
|
33
|
-
if started.is_a?(Float)
|
|
34
|
-
add(name, started, finished, unique_id, data)
|
|
35
|
-
end
|
|
36
|
-
end
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
def detach
|
|
40
|
-
::ActiveSupport::Notifications.unsubscribe(@subscriber)
|
|
41
|
-
end
|
|
42
|
-
end
|
|
43
|
-
end
|
|
44
|
-
end
|
|
45
|
-
end
|
|
46
|
-
end
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Sentry
|
|
4
|
-
module Rails
|
|
5
|
-
module InstrumentPayloadCleanupHelper
|
|
6
|
-
IGNORED_DATA_TYPES = [:request, :response, :headers, :exception, :exception_object, Tracing::START_TIMESTAMP_NAME]
|
|
7
|
-
|
|
8
|
-
def cleanup_data(data)
|
|
9
|
-
IGNORED_DATA_TYPES.each do |key|
|
|
10
|
-
data.delete(key) if data.key?(key)
|
|
11
|
-
end
|
|
12
|
-
end
|
|
13
|
-
end
|
|
14
|
-
end
|
|
15
|
-
end
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require "sentry/rails/tracing/abstract_subscriber"
|
|
4
|
-
require "sentry/rails/instrument_payload_cleanup_helper"
|
|
5
|
-
|
|
6
|
-
module Sentry
|
|
7
|
-
module Rails
|
|
8
|
-
module Tracing
|
|
9
|
-
class ActionControllerSubscriber < AbstractSubscriber
|
|
10
|
-
extend InstrumentPayloadCleanupHelper
|
|
11
|
-
|
|
12
|
-
EVENT_NAMES = ["process_action.action_controller"].freeze
|
|
13
|
-
OP_NAME = "view.process_action.action_controller"
|
|
14
|
-
SPAN_ORIGIN = "auto.view.rails"
|
|
15
|
-
|
|
16
|
-
def self.subscribe!
|
|
17
|
-
Sentry.sdk_logger.warn <<~MSG
|
|
18
|
-
DEPRECATION WARNING: sentry-rails has changed its approach on controller span recording and #{self.name} is now depreacted.
|
|
19
|
-
Please stop using or referencing #{self.name} as it will be removed in the next major release.
|
|
20
|
-
MSG
|
|
21
|
-
|
|
22
|
-
subscribe_to_event(EVENT_NAMES) do |event_name, duration, payload|
|
|
23
|
-
controller = payload[:controller]
|
|
24
|
-
action = payload[:action]
|
|
25
|
-
|
|
26
|
-
record_on_current_span(
|
|
27
|
-
op: OP_NAME,
|
|
28
|
-
origin: SPAN_ORIGIN,
|
|
29
|
-
start_timestamp: payload[START_TIMESTAMP_NAME],
|
|
30
|
-
description: "#{controller}##{action}",
|
|
31
|
-
duration: duration
|
|
32
|
-
) do |span|
|
|
33
|
-
payload = payload.dup
|
|
34
|
-
cleanup_data(payload)
|
|
35
|
-
span.set_data(:payload, payload)
|
|
36
|
-
span.set_http_status(payload[:status])
|
|
37
|
-
end
|
|
38
|
-
end
|
|
39
|
-
end
|
|
40
|
-
end
|
|
41
|
-
end
|
|
42
|
-
end
|
|
43
|
-
end
|