sentry-rails 5.28.0 → 6.1.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/.rspec +1 -1
- data/Gemfile +9 -19
- data/bin/test +1 -1
- data/lib/sentry/rails/active_job.rb +7 -11
- data/lib/sentry/rails/configuration.rb +0 -1
- data/lib/sentry/rails/log_subscriber.rb +1 -1
- data/lib/sentry/rails/log_subscribers/action_controller_subscriber.rb +2 -0
- data/lib/sentry/rails/log_subscribers/action_mailer_subscriber.rb +4 -0
- data/lib/sentry/rails/log_subscribers/active_job_subscriber.rb +8 -0
- data/lib/sentry/rails/log_subscribers/active_record_subscriber.rb +22 -0
- data/lib/sentry/rails/overrides/streaming_reporter.rb +0 -11
- data/lib/sentry/rails/railtie.rb +3 -8
- data/lib/sentry/rails/version.rb +1 -1
- data/sentry-rails.gemspec +3 -3
- metadata +11 -14
- 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
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d0b45b14487fb54357f496eea076b669d064b0f38bbd1960014960ecaf9214df
|
|
4
|
+
data.tar.gz: 1cd430829a299cdd9b357c940e17aa0c3984e6dc30d5f888f50a28b75accff9c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ebba56359ebb4c5ac43076f10b069864a61004ba33ddf893ba2a5eba825f8da1f12d18ad685a900a3b253ee8521566a983e83508809b33e02f2d634ff078f181
|
|
7
|
+
data.tar.gz: e01b630f88aa297426743f96635e837d6de0fd888c3dec63b8382affae263c8764f6c92a9972a765d38d5aa8252629c1a568a3edde98e26b3368f530010009f6
|
data/.rspec
CHANGED
data/Gemfile
CHANGED
|
@@ -21,10 +21,8 @@ rails_version = ENV.fetch("RAILS_VERSION") do
|
|
|
21
21
|
"8.0"
|
|
22
22
|
elsif ruby_version >= Gem::Version.new("3.1")
|
|
23
23
|
"7.2"
|
|
24
|
-
|
|
24
|
+
else
|
|
25
25
|
"7.1"
|
|
26
|
-
elsif ruby_version >= Gem::Version.new("2.4")
|
|
27
|
-
"5.2"
|
|
28
26
|
end
|
|
29
27
|
end
|
|
30
28
|
|
|
@@ -32,21 +30,19 @@ rails_version = Gem::Version.new(rails_version)
|
|
|
32
30
|
|
|
33
31
|
gem "rails", "~> #{rails_version}"
|
|
34
32
|
|
|
35
|
-
if rails_version >= Gem::Version.new("8.
|
|
36
|
-
gem "rspec-rails"
|
|
33
|
+
if rails_version >= Gem::Version.new("8.1.0")
|
|
34
|
+
gem "rspec-rails", "~> 8.0.0"
|
|
35
|
+
gem "sqlite3", "~> 2.1.1", platform: :ruby
|
|
36
|
+
elsif rails_version >= Gem::Version.new("8.0.0")
|
|
37
|
+
gem "rspec-rails", "~> 8.0.0"
|
|
37
38
|
gem "sqlite3", "~> 2.1.1", platform: :ruby
|
|
38
39
|
elsif rails_version >= Gem::Version.new("7.1.0")
|
|
39
40
|
gem "psych", "~> 4.0.0"
|
|
40
|
-
gem "rspec-rails"
|
|
41
|
+
gem "rspec-rails", "~> 7.0"
|
|
41
42
|
gem "sqlite3", "~> 1.7.3", platform: :ruby
|
|
42
43
|
elsif rails_version >= Gem::Version.new("6.1.0")
|
|
43
|
-
gem "rspec-rails", "~>
|
|
44
|
-
|
|
45
|
-
if ruby_version >= Gem::Version.new("2.7.0")
|
|
46
|
-
gem "sqlite3", "~> 1.7.3", platform: :ruby
|
|
47
|
-
else
|
|
48
|
-
gem "sqlite3", "~> 1.6.9", platform: :ruby
|
|
49
|
-
end
|
|
44
|
+
gem "rspec-rails", "~> 6.0"
|
|
45
|
+
gem "sqlite3", "~> 1.7.3", platform: :ruby
|
|
50
46
|
else
|
|
51
47
|
gem "psych", "~> 3.0.0"
|
|
52
48
|
gem "rspec-rails", "~> 4.0"
|
|
@@ -58,12 +54,6 @@ else
|
|
|
58
54
|
end
|
|
59
55
|
end
|
|
60
56
|
|
|
61
|
-
if ruby_version < Gem::Version.new("2.5.0")
|
|
62
|
-
# https://github.com/flavorjones/loofah/pull/267
|
|
63
|
-
# loofah changed the required ruby version in a patch so we need to explicitly pin it
|
|
64
|
-
gem "loofah", "2.20.0"
|
|
65
|
-
end
|
|
66
|
-
|
|
67
57
|
gem "mini_magick"
|
|
68
58
|
|
|
69
59
|
gem "sprockets-rails"
|
data/bin/test
CHANGED
|
@@ -32,17 +32,13 @@ module Sentry
|
|
|
32
32
|
Sentry.with_scope do |scope|
|
|
33
33
|
begin
|
|
34
34
|
scope.set_transaction_name(job.class.name, source: :task)
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
op: OP_NAME,
|
|
43
|
-
origin: SPAN_ORIGIN
|
|
44
|
-
)
|
|
45
|
-
end
|
|
35
|
+
|
|
36
|
+
transaction = Sentry.start_transaction(
|
|
37
|
+
name: scope.transaction_name,
|
|
38
|
+
source: scope.transaction_source,
|
|
39
|
+
op: OP_NAME,
|
|
40
|
+
origin: SPAN_ORIGIN
|
|
41
|
+
)
|
|
46
42
|
|
|
47
43
|
scope.set_span(transaction) if transaction
|
|
48
44
|
|
|
@@ -26,6 +26,8 @@ module Sentry
|
|
|
26
26
|
#
|
|
27
27
|
# @param event [ActiveSupport::Notifications::Event] The email delivery event
|
|
28
28
|
def deliver(event)
|
|
29
|
+
return unless Sentry.initialized?
|
|
30
|
+
|
|
29
31
|
payload = event.payload
|
|
30
32
|
|
|
31
33
|
mailer = payload[:mailer]
|
|
@@ -57,6 +59,8 @@ module Sentry
|
|
|
57
59
|
#
|
|
58
60
|
# @param event [ActiveSupport::Notifications::Event] The email processing event
|
|
59
61
|
def process(event)
|
|
62
|
+
return unless Sentry.initialized?
|
|
63
|
+
|
|
60
64
|
payload = event.payload
|
|
61
65
|
|
|
62
66
|
mailer = payload[:mailer]
|
|
@@ -26,6 +26,8 @@ module Sentry
|
|
|
26
26
|
#
|
|
27
27
|
# @param event [ActiveSupport::Notifications::Event] The job performance event
|
|
28
28
|
def perform(event)
|
|
29
|
+
return unless Sentry.initialized?
|
|
30
|
+
|
|
29
31
|
job = event.payload[:job]
|
|
30
32
|
duration = duration_ms(event)
|
|
31
33
|
|
|
@@ -63,6 +65,8 @@ module Sentry
|
|
|
63
65
|
#
|
|
64
66
|
# @param event [ActiveSupport::Notifications::Event] The job enqueue event
|
|
65
67
|
def enqueue(event)
|
|
68
|
+
return unless Sentry.initialized?
|
|
69
|
+
|
|
66
70
|
job = event.payload[:job]
|
|
67
71
|
|
|
68
72
|
attributes = {
|
|
@@ -89,6 +93,8 @@ module Sentry
|
|
|
89
93
|
end
|
|
90
94
|
|
|
91
95
|
def retry_stopped(event)
|
|
96
|
+
return unless Sentry.initialized?
|
|
97
|
+
|
|
92
98
|
job = event.payload[:job]
|
|
93
99
|
error = event.payload[:error]
|
|
94
100
|
|
|
@@ -111,6 +117,8 @@ module Sentry
|
|
|
111
117
|
end
|
|
112
118
|
|
|
113
119
|
def discard(event)
|
|
120
|
+
return unless Sentry.initialized?
|
|
121
|
+
|
|
114
122
|
job = event.payload[:job]
|
|
115
123
|
error = event.payload[:error]
|
|
116
124
|
|
|
@@ -29,6 +29,7 @@ module Sentry
|
|
|
29
29
|
#
|
|
30
30
|
# @param event [ActiveSupport::Notifications::Event] The SQL event
|
|
31
31
|
def sql(event)
|
|
32
|
+
return unless Sentry.initialized?
|
|
32
33
|
return if EXCLUDED_NAMES.include?(event.payload[:name])
|
|
33
34
|
|
|
34
35
|
sql = event.payload[:sql]
|
|
@@ -46,6 +47,17 @@ module Sentry
|
|
|
46
47
|
cached: cached
|
|
47
48
|
}
|
|
48
49
|
|
|
50
|
+
binds = event.payload[:binds]
|
|
51
|
+
|
|
52
|
+
if Sentry.configuration.send_default_pii && !binds&.empty?
|
|
53
|
+
type_casted_binds = type_casted_binds(event)
|
|
54
|
+
|
|
55
|
+
binds.each_with_index do |bind, index|
|
|
56
|
+
name = bind.is_a?(Symbol) ? bind : bind.name
|
|
57
|
+
attributes["db.query.parameter.#{name}"] = type_casted_binds[index].to_s
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
|
|
49
61
|
attributes[:statement_name] = statement_name if statement_name && statement_name != "SQL"
|
|
50
62
|
attributes[:connection_id] = connection_id if connection_id
|
|
51
63
|
|
|
@@ -60,6 +72,16 @@ module Sentry
|
|
|
60
72
|
)
|
|
61
73
|
end
|
|
62
74
|
|
|
75
|
+
if RUBY_ENGINE == "jruby"
|
|
76
|
+
def type_casted_binds(event)
|
|
77
|
+
event.payload[:type_casted_binds].call
|
|
78
|
+
end
|
|
79
|
+
else
|
|
80
|
+
def type_casted_binds(event)
|
|
81
|
+
event.payload[:type_casted_binds]
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
|
|
63
85
|
private
|
|
64
86
|
|
|
65
87
|
def build_log_message(statement_name)
|
|
@@ -9,17 +9,6 @@ module Sentry
|
|
|
9
9
|
super
|
|
10
10
|
end
|
|
11
11
|
end
|
|
12
|
-
|
|
13
|
-
module OldStreamingReporter
|
|
14
|
-
def self.included(base)
|
|
15
|
-
base.send(:alias_method_chain, :log_error, :raven)
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
def log_error_with_raven(exception)
|
|
19
|
-
Sentry::Rails.capture_exception(exception)
|
|
20
|
-
log_error_without_raven(exception)
|
|
21
|
-
end
|
|
22
|
-
end
|
|
23
12
|
end
|
|
24
13
|
end
|
|
25
14
|
end
|
data/lib/sentry/rails/railtie.rb
CHANGED
|
@@ -101,17 +101,12 @@ module Sentry
|
|
|
101
101
|
end
|
|
102
102
|
|
|
103
103
|
def inject_breadcrumbs_logger
|
|
104
|
-
if Sentry.configuration.breadcrumbs_logger.include?(:active_support_logger)
|
|
104
|
+
if Sentry.configuration.breadcrumbs_logger.include?(:active_support_logger) ||
|
|
105
|
+
## legacy name redirected for backwards compat
|
|
106
|
+
Sentry.configuration.breadcrumbs_logger.include?(:monotonic_active_support_logger)
|
|
105
107
|
require "sentry/rails/breadcrumb/active_support_logger"
|
|
106
108
|
Sentry::Rails::Breadcrumb::ActiveSupportLogger.inject(Sentry.configuration.rails.active_support_logger_subscription_items)
|
|
107
109
|
end
|
|
108
|
-
|
|
109
|
-
if Sentry.configuration.breadcrumbs_logger.include?(:monotonic_active_support_logger)
|
|
110
|
-
return warn "Usage of `monotonic_active_support_logger` require a version of Rails >= 6.1, please upgrade your Rails version or use another logger" if ::Rails.version.to_f < 6.1
|
|
111
|
-
|
|
112
|
-
require "sentry/rails/breadcrumb/monotonic_active_support_logger"
|
|
113
|
-
Sentry::Rails::Breadcrumb::MonotonicActiveSupportLogger.inject
|
|
114
|
-
end
|
|
115
110
|
end
|
|
116
111
|
|
|
117
112
|
def setup_backtrace_cleanup_callback
|
data/lib/sentry/rails/version.rb
CHANGED
data/sentry-rails.gemspec
CHANGED
|
@@ -11,7 +11,7 @@ Gem::Specification.new do |spec|
|
|
|
11
11
|
spec.license = 'MIT'
|
|
12
12
|
|
|
13
13
|
spec.platform = Gem::Platform::RUBY
|
|
14
|
-
spec.required_ruby_version = '>= 2.
|
|
14
|
+
spec.required_ruby_version = '>= 2.7'
|
|
15
15
|
spec.extra_rdoc_files = ["README.md", "LICENSE.txt"]
|
|
16
16
|
spec.files = `git ls-files | grep -Ev '^(spec|benchmarks|examples|\.rubocop\.yml)'`.split("\n")
|
|
17
17
|
|
|
@@ -30,6 +30,6 @@ Gem::Specification.new do |spec|
|
|
|
30
30
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
31
31
|
spec.require_paths = ["lib"]
|
|
32
32
|
|
|
33
|
-
spec.add_dependency "railties", ">= 5.0"
|
|
34
|
-
spec.add_dependency "sentry-ruby", "~>
|
|
33
|
+
spec.add_dependency "railties", ">= 5.2.0"
|
|
34
|
+
spec.add_dependency "sentry-ruby", "~> 6.1.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:
|
|
4
|
+
version: 6.1.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.1.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.1.0
|
|
40
40
|
description: A gem that provides Rails integration for the Sentry error logger
|
|
41
41
|
email: accounts@sentry.io
|
|
42
42
|
executables: []
|
|
@@ -65,14 +65,12 @@ files:
|
|
|
65
65
|
- lib/sentry/rails/background_worker.rb
|
|
66
66
|
- lib/sentry/rails/backtrace_cleaner.rb
|
|
67
67
|
- lib/sentry/rails/breadcrumb/active_support_logger.rb
|
|
68
|
-
- lib/sentry/rails/breadcrumb/monotonic_active_support_logger.rb
|
|
69
68
|
- lib/sentry/rails/capture_exceptions.rb
|
|
70
69
|
- lib/sentry/rails/configuration.rb
|
|
71
70
|
- lib/sentry/rails/controller_methods.rb
|
|
72
71
|
- lib/sentry/rails/controller_transaction.rb
|
|
73
72
|
- lib/sentry/rails/engine.rb
|
|
74
73
|
- lib/sentry/rails/error_subscriber.rb
|
|
75
|
-
- lib/sentry/rails/instrument_payload_cleanup_helper.rb
|
|
76
74
|
- lib/sentry/rails/log_subscriber.rb
|
|
77
75
|
- lib/sentry/rails/log_subscribers/action_controller_subscriber.rb
|
|
78
76
|
- lib/sentry/rails/log_subscribers/action_mailer_subscriber.rb
|
|
@@ -85,22 +83,21 @@ files:
|
|
|
85
83
|
- lib/sentry/rails/structured_logging.rb
|
|
86
84
|
- lib/sentry/rails/tracing.rb
|
|
87
85
|
- lib/sentry/rails/tracing/abstract_subscriber.rb
|
|
88
|
-
- lib/sentry/rails/tracing/action_controller_subscriber.rb
|
|
89
86
|
- lib/sentry/rails/tracing/action_view_subscriber.rb
|
|
90
87
|
- lib/sentry/rails/tracing/active_record_subscriber.rb
|
|
91
88
|
- lib/sentry/rails/tracing/active_storage_subscriber.rb
|
|
92
89
|
- lib/sentry/rails/tracing/active_support_subscriber.rb
|
|
93
90
|
- lib/sentry/rails/version.rb
|
|
94
91
|
- sentry-rails.gemspec
|
|
95
|
-
homepage: https://github.com/getsentry/sentry-ruby/tree/
|
|
92
|
+
homepage: https://github.com/getsentry/sentry-ruby/tree/6.1.0/sentry-rails
|
|
96
93
|
licenses:
|
|
97
94
|
- MIT
|
|
98
95
|
metadata:
|
|
99
|
-
homepage_uri: https://github.com/getsentry/sentry-ruby/tree/
|
|
100
|
-
source_code_uri: https://github.com/getsentry/sentry-ruby/tree/
|
|
101
|
-
changelog_uri: https://github.com/getsentry/sentry-ruby/blob/
|
|
96
|
+
homepage_uri: https://github.com/getsentry/sentry-ruby/tree/6.1.0/sentry-rails
|
|
97
|
+
source_code_uri: https://github.com/getsentry/sentry-ruby/tree/6.1.0/sentry-rails
|
|
98
|
+
changelog_uri: https://github.com/getsentry/sentry-ruby/blob/6.1.0/CHANGELOG.md
|
|
102
99
|
bug_tracker_uri: https://github.com/getsentry/sentry-ruby/issues
|
|
103
|
-
documentation_uri: http://www.rubydoc.info/gems/sentry-rails/
|
|
100
|
+
documentation_uri: http://www.rubydoc.info/gems/sentry-rails/6.1.0
|
|
104
101
|
rdoc_options: []
|
|
105
102
|
require_paths:
|
|
106
103
|
- lib
|
|
@@ -108,7 +105,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
108
105
|
requirements:
|
|
109
106
|
- - ">="
|
|
110
107
|
- !ruby/object:Gem::Version
|
|
111
|
-
version: '2.
|
|
108
|
+
version: '2.7'
|
|
112
109
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
113
110
|
requirements:
|
|
114
111
|
- - ">="
|
|
@@ -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
|