sentry-rails 5.12.0 → 5.13.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b7ddebe5d3603e4e463a85c866633a8efc2c9a4e559450b29a1a23f9e62862d7
4
- data.tar.gz: a4e5938fd4d4ca9af782e1934edb6818c9bb5d033fbd52e6181f808c72e7be80
3
+ metadata.gz: 500c760aca4cc420df9f10a1bf920e3bd4dd03ff1667a80019b2660c95ad803b
4
+ data.tar.gz: 15aeba9d0fbd870fe8c562f7105df10f45ba8973f49f8fbf4b044b31f4711a43
5
5
  SHA512:
6
- metadata.gz: 7a480ba7bf4e4c0a5790b7debdc1a35b2fc5c6c707804530acfd0699fd2cb0f45c8df4ae933c37d5e18d1fa24e6e7a23954f71aada985031111d4aa863f5c986
7
- data.tar.gz: 69aab97414157f65969b57bd2585d123f5dd3ba87268c86d61f1d9ae77d42efd8c8b969ee0a10392037210d873f188ecc359a467573e174391d324feadc6540c
6
+ metadata.gz: 6bb7d84aade0f54a4e77ebbf0f7e24d6bb41f7a0ea417e8e22d24542f2e5bb8c5c4480f029ef33602b3ebd67dd2a8af2fc3093460f669c4b89d51b964d8846a8
7
+ data.tar.gz: 2c7410b417f20976b18d85c9e08588be14523473d07481b6407670f9ba27358098fd543eca38bd87aff8ab053e13cffecc5431d4dab4af7639d28175805c6968
@@ -2,75 +2,13 @@ module Sentry
2
2
  module Rails
3
3
  module Breadcrumb
4
4
  module ActiveSupportLogger
5
- ALLOWED_LIST = {
6
- # action_controller
7
- "write_fragment.action_controller" => %i[key],
8
- "read_fragment.action_controller" => %i[key],
9
- "exist_fragment?.action_controller" => %i[key],
10
- "expire_fragment.action_controller" => %i[key],
11
- "start_processing.action_controller" => %i[controller action params format method path],
12
- "process_action.action_controller" => %i[controller action params format method path status view_runtime db_runtime],
13
- "send_file.action_controller" => %i[path],
14
- "redirect_to.action_controller" => %i[status location],
15
- "halted_callback.action_controller" => %i[filter],
16
- # action_dispatch
17
- "process_middleware.action_dispatch" => %i[middleware],
18
- # action_view
19
- "render_template.action_view" => %i[identifier layout],
20
- "render_partial.action_view" => %i[identifier],
21
- "render_collection.action_view" => %i[identifier count cache_hits],
22
- "render_layout.action_view" => %i[identifier],
23
- # active_record
24
- "sql.active_record" => %i[sql name statement_name cached],
25
- "instantiation.active_record" => %i[record_count class_name],
26
- # action_mailer
27
- # not including to, from, or subject..etc. because of PII concern
28
- "deliver.action_mailer" => %i[mailer date perform_deliveries],
29
- "process.action_mailer" => %i[mailer action params],
30
- # active_support
31
- "cache_read.active_support" => %i[key store hit],
32
- "cache_generate.active_support" => %i[key store],
33
- "cache_fetch_hit.active_support" => %i[key store],
34
- "cache_write.active_support" => %i[key store],
35
- "cache_delete.active_support" => %i[key store],
36
- "cache_exist?.active_support" => %i[key store],
37
- # active_job
38
- "enqueue_at.active_job" => %i[],
39
- "enqueue.active_job" => %i[],
40
- "enqueue_retry.active_job" => %i[],
41
- "perform_start.active_job" => %i[],
42
- "perform.active_job" => %i[],
43
- "retry_stopped.active_job" => %i[],
44
- "discard.active_job" => %i[],
45
- # action_cable
46
- "perform_action.action_cable" => %i[channel_class action],
47
- "transmit.action_cable" => %i[channel_class],
48
- "transmit_subscription_confirmation.action_cable" => %i[channel_class],
49
- "transmit_subscription_rejection.action_cable" => %i[channel_class],
50
- "broadcast.action_cable" => %i[broadcasting],
51
- # active_storage
52
- "service_upload.active_storage" => %i[service key checksum],
53
- "service_streaming_download.active_storage" => %i[service key],
54
- "service_download_chunk.active_storage" => %i[service key],
55
- "service_download.active_storage" => %i[service key],
56
- "service_delete.active_storage" => %i[service key],
57
- "service_delete_prefixed.active_storage" => %i[service prefix],
58
- "service_exist.active_storage" => %i[service key exist],
59
- "service_url.active_storage" => %i[service key url],
60
- "service_update_metadata.active_storage" => %i[service key],
61
- "preview.active_storage" => %i[key],
62
- "analyze.active_storage" => %i[analyzer],
63
- }.freeze
64
-
65
5
  class << self
66
6
  def add(name, started, _finished, _unique_id, data)
67
7
  # skip Rails' internal events
68
8
  return if name.start_with?("!")
69
9
 
70
- allowed_keys = ALLOWED_LIST[name]
71
-
72
10
  if data.is_a?(Hash)
73
- data = data.slice(*allowed_keys)
11
+ data = data.slice(*@allowed_keys[name])
74
12
  end
75
13
 
76
14
  crumb = Sentry::Breadcrumb.new(
@@ -81,7 +19,9 @@ module Sentry
81
19
  Sentry.add_breadcrumb(crumb)
82
20
  end
83
21
 
84
- def inject
22
+ def inject(allowed_keys)
23
+ @allowed_keys = allowed_keys
24
+
85
25
  @subscriber = ::ActiveSupport::Notifications.subscribe(/.*/) do |name, started, finished, unique_id, data|
86
26
  # we only record events that has a started timestamp
87
27
  if started.is_a?(Time)
@@ -46,6 +46,67 @@ module Sentry
46
46
  'ActionDispatch::Http::Parameters::ParseError',
47
47
  'ActiveRecord::RecordNotFound'
48
48
  ].freeze
49
+
50
+ ACTIVE_SUPPORT_LOGGER_SUBSCRIPTION_ITEMS_DEFAULT = {
51
+ # action_controller
52
+ "write_fragment.action_controller" => %i[key],
53
+ "read_fragment.action_controller" => %i[key],
54
+ "exist_fragment?.action_controller" => %i[key],
55
+ "expire_fragment.action_controller" => %i[key],
56
+ "start_processing.action_controller" => %i[controller action params format method path],
57
+ "process_action.action_controller" => %i[controller action params format method path status view_runtime db_runtime],
58
+ "send_file.action_controller" => %i[path],
59
+ "redirect_to.action_controller" => %i[status location],
60
+ "halted_callback.action_controller" => %i[filter],
61
+ # action_dispatch
62
+ "process_middleware.action_dispatch" => %i[middleware],
63
+ # action_view
64
+ "render_template.action_view" => %i[identifier layout],
65
+ "render_partial.action_view" => %i[identifier],
66
+ "render_collection.action_view" => %i[identifier count cache_hits],
67
+ "render_layout.action_view" => %i[identifier],
68
+ # active_record
69
+ "sql.active_record" => %i[sql name statement_name cached],
70
+ "instantiation.active_record" => %i[record_count class_name],
71
+ # action_mailer
72
+ # not including to, from, or subject..etc. because of PII concern
73
+ "deliver.action_mailer" => %i[mailer date perform_deliveries],
74
+ "process.action_mailer" => %i[mailer action params],
75
+ # active_support
76
+ "cache_read.active_support" => %i[key store hit],
77
+ "cache_generate.active_support" => %i[key store],
78
+ "cache_fetch_hit.active_support" => %i[key store],
79
+ "cache_write.active_support" => %i[key store],
80
+ "cache_delete.active_support" => %i[key store],
81
+ "cache_exist?.active_support" => %i[key store],
82
+ # active_job
83
+ "enqueue_at.active_job" => %i[],
84
+ "enqueue.active_job" => %i[],
85
+ "enqueue_retry.active_job" => %i[],
86
+ "perform_start.active_job" => %i[],
87
+ "perform.active_job" => %i[],
88
+ "retry_stopped.active_job" => %i[],
89
+ "discard.active_job" => %i[],
90
+ # action_cable
91
+ "perform_action.action_cable" => %i[channel_class action],
92
+ "transmit.action_cable" => %i[channel_class],
93
+ "transmit_subscription_confirmation.action_cable" => %i[channel_class],
94
+ "transmit_subscription_rejection.action_cable" => %i[channel_class],
95
+ "broadcast.action_cable" => %i[broadcasting],
96
+ # active_storage
97
+ "service_upload.active_storage" => %i[service key checksum],
98
+ "service_streaming_download.active_storage" => %i[service key],
99
+ "service_download_chunk.active_storage" => %i[service key],
100
+ "service_download.active_storage" => %i[service key],
101
+ "service_delete.active_storage" => %i[service key],
102
+ "service_delete_prefixed.active_storage" => %i[service prefix],
103
+ "service_exist.active_storage" => %i[service key exist],
104
+ "service_url.active_storage" => %i[service key url],
105
+ "service_update_metadata.active_storage" => %i[service key],
106
+ "preview.active_storage" => %i[key],
107
+ "analyze.active_storage" => %i[analyzer],
108
+ }.freeze
109
+
49
110
  class Configuration
50
111
  # Rails 7.0 introduced a new error reporter feature, which the SDK once opted-in by default.
51
112
  # But after receiving multiple issue reports, the integration seemed to cause serious troubles to some users.
@@ -80,6 +141,10 @@ module Sentry
80
141
  # ```
81
142
  attr_accessor :assets_regexp
82
143
 
144
+ # Hash of subscription items that will be shown in breadcrumbs active support logger.
145
+ # @return [Hash<String, Array<Symbol>>]
146
+ attr_accessor :active_support_logger_subscription_items
147
+
83
148
  def initialize
84
149
  @register_error_subscriber = false
85
150
  @report_rescued_exceptions = true
@@ -92,6 +157,7 @@ module Sentry
92
157
  Sentry::Rails::Tracing::ActiveRecordSubscriber,
93
158
  Sentry::Rails::Tracing::ActiveStorageSubscriber
94
159
  ])
160
+ @active_support_logger_subscription_items = Sentry::Rails::ACTIVE_SUPPORT_LOGGER_SUBSCRIPTION_ITEMS_DEFAULT.dup
95
161
  end
96
162
  end
97
163
  end
@@ -89,7 +89,7 @@ module Sentry
89
89
  def inject_breadcrumbs_logger
90
90
  if Sentry.configuration.breadcrumbs_logger.include?(:active_support_logger)
91
91
  require 'sentry/rails/breadcrumb/active_support_logger'
92
- Sentry::Rails::Breadcrumb::ActiveSupportLogger.inject
92
+ Sentry::Rails::Breadcrumb::ActiveSupportLogger.inject(Sentry.configuration.rails.active_support_logger_subscription_items)
93
93
  end
94
94
 
95
95
  if Sentry.configuration.breadcrumbs_logger.include?(:monotonic_active_support_logger)
@@ -1,5 +1,5 @@
1
1
  module Sentry
2
2
  module Rails
3
- VERSION = "5.12.0"
3
+ VERSION = "5.13.0"
4
4
  end
5
5
  end
data/sentry-rails.gemspec CHANGED
@@ -23,5 +23,5 @@ Gem::Specification.new do |spec|
23
23
  spec.require_paths = ["lib"]
24
24
 
25
25
  spec.add_dependency "railties", ">= 5.0"
26
- spec.add_dependency "sentry-ruby", "~> 5.12.0"
26
+ spec.add_dependency "sentry-ruby", "~> 5.13.0"
27
27
  end
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: 5.12.0
4
+ version: 5.13.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: 2023-10-10 00:00:00.000000000 Z
11
+ date: 2023-11-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 5.12.0
33
+ version: 5.13.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: 5.12.0
40
+ version: 5.13.0
41
41
  description: A gem that provides Rails integration for the Sentry error logger
42
42
  email: accounts@sentry.io
43
43
  executables: []