sentry-ruby 5.18.0 → 5.18.2

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: 60b2f077a84b2ebd81dd8db1113b550256994ab7561ea96e94dd9799d3f61b9f
4
- data.tar.gz: 4739ab8bca432f215b10747c4bc4caa031daa8f0751c90729b1a946554ea1875
3
+ metadata.gz: 866b4388eea19f9cc866f10e34f25abfb311a5877015df29f5dded5bfa182e7a
4
+ data.tar.gz: 2ba353d4fdbe545c8e76fbd2c3b0169f481965e8e55cc74ad3e4cd613b6c4f76
5
5
  SHA512:
6
- metadata.gz: 289e1be06a0d13f066881d3f1b2d0b674c3a61d576f4901b252872831263decb1af3ee7ff8201027ed1003231442680547e01a9f3e1130b773289770552ac10f
7
- data.tar.gz: f0e5d48799611bd5db4b0b759b18e2b7eea13052bf24a21b9641c4fd755647ee3b4f007ac778f694b63a2ee03d94f7bab6a57ae5c83a7ace58dab7714382aa5c
6
+ metadata.gz: c70d18ba79eb9c7a359d2d25cbd97bc8fa6472d89a422e57ebce7daee6f4b5cab0dd14bb35281bf22cbdfb1d4198800ebdf5a96baf044f202afae3c1a9ee0160
7
+ data.tar.gz: aebeeb641244f112b0957f409d0055379f168413354e25f19118744e79352b12159b693945c1bfc506e8d14ad076b115c9e7037be6d7bbe08114b3f6b7370df5
data/README.md CHANGED
@@ -106,3 +106,13 @@ To learn more about sampling transactions, please visit the [official documentat
106
106
  * [![Discord Chat](https://img.shields.io/discord/621778831602221064?logo=discord&logoColor=ffffff&color=7389D8)](https://discord.gg/PXa5Apfe7K)
107
107
  * [![Stack Overflow](https://img.shields.io/badge/stack%20overflow-sentry-green.svg)](https://stackoverflow.com/questions/tagged/sentry)
108
108
  * [![Twitter Follow](https://img.shields.io/twitter/follow/getsentry?label=getsentry&style=social)](https://twitter.com/intent/follow?screen_name=getsentry)
109
+
110
+ ## Contributing to the SDK
111
+
112
+ Please make sure to read the [CONTRIBUTING.md](https://github.com/getsentry/sentry-ruby/blob/master/CONTRIBUTING.md) before making a pull request.
113
+
114
+ Thanks to everyone who has contributed to this project so far.
115
+
116
+ <a href="https://github.com/getsentry/sentry-ruby/graphs/contributors">
117
+ <img src="https://contributors-img.web.app/image?repo=getsentry/sentry-ruby" />
118
+ </a>
data/lib/sentry/client.rb CHANGED
@@ -55,19 +55,29 @@ module Sentry
55
55
 
56
56
  event_type = event.is_a?(Event) ? event.type : event["type"]
57
57
  data_category = Envelope::Item.data_category(event_type)
58
+
59
+ is_transaction = event.is_a?(TransactionEvent)
60
+ spans_before = is_transaction ? event.spans.size : 0
61
+
58
62
  event = scope.apply_to_event(event, hint)
59
63
 
60
64
  if event.nil?
61
65
  log_debug("Discarded event because one of the event processors returned nil")
62
66
  transport.record_lost_event(:event_processor, data_category)
67
+ transport.record_lost_event(:event_processor, 'span', num: spans_before + 1) if is_transaction
63
68
  return
69
+ elsif is_transaction
70
+ spans_delta = spans_before - event.spans.size
71
+ transport.record_lost_event(:event_processor, 'span', num: spans_delta) if spans_delta > 0
64
72
  end
65
73
 
66
74
  if async_block = configuration.async
67
75
  dispatch_async_event(async_block, event, hint)
68
76
  elsif configuration.background_worker_threads != 0 && hint.fetch(:background, true)
69
- queued = dispatch_background_event(event, hint)
70
- transport.record_lost_event(:queue_overflow, data_category) unless queued
77
+ unless dispatch_background_event(event, hint)
78
+ transport.record_lost_event(:queue_overflow, data_category)
79
+ transport.record_lost_event(:queue_overflow, 'span', num: spans_before + 1) if is_transaction
80
+ end
71
81
  else
72
82
  send_event(event, hint)
73
83
  end
@@ -168,6 +178,7 @@ module Sentry
168
178
  def send_event(event, hint = nil)
169
179
  event_type = event.is_a?(Event) ? event.type : event["type"]
170
180
  data_category = Envelope::Item.data_category(event_type)
181
+ spans_before = event.is_a?(TransactionEvent) ? event.spans.size : 0
171
182
 
172
183
  if event_type != TransactionEvent::TYPE && configuration.before_send
173
184
  event = configuration.before_send.call(event, hint)
@@ -184,8 +195,13 @@ module Sentry
184
195
 
185
196
  if event.nil?
186
197
  log_debug("Discarded event because before_send_transaction returned nil")
187
- transport.record_lost_event(:before_send, data_category)
198
+ transport.record_lost_event(:before_send, 'transaction')
199
+ transport.record_lost_event(:before_send, 'span', num: spans_before + 1)
188
200
  return
201
+ else
202
+ spans_after = event.is_a?(TransactionEvent) ? event.spans.size : 0
203
+ spans_delta = spans_before - spans_after
204
+ transport.record_lost_event(:before_send, 'span', num: spans_delta) if spans_delta > 0
189
205
  end
190
206
  end
191
207
 
@@ -196,6 +212,7 @@ module Sentry
196
212
  rescue => e
197
213
  log_error("Event sending failed", e, debug: configuration.debug)
198
214
  transport.record_lost_event(:network_error, data_category)
215
+ transport.record_lost_event(:network_error, 'span', num: spans_before + 1) if event.is_a?(TransactionEvent)
199
216
  raise
200
217
  end
201
218
 
@@ -351,7 +351,7 @@ module Sentry
351
351
  def initialize
352
352
  self.app_dirs_pattern = nil
353
353
  self.debug = false
354
- self.background_worker_threads = (Concurrent.processor_count / 2.0).ceil
354
+ self.background_worker_threads = (processor_count / 2.0).ceil
355
355
  self.background_worker_max_queue = BackgroundWorker::DEFAULT_MAX_QUEUE
356
356
  self.backtrace_cleanup_callback = nil
357
357
  self.max_breadcrumbs = BreadcrumbBuffer::DEFAULT_SIZE
@@ -654,5 +654,13 @@ module Sentry
654
654
  instance_eval(&hook)
655
655
  end
656
656
  end
657
+
658
+ def processor_count
659
+ if Concurrent.respond_to?(:usable_processor_count)
660
+ Concurrent.usable_processor_count
661
+ else
662
+ Concurrent.processor_count
663
+ end
664
+ end
657
665
  end
658
666
  end
@@ -21,7 +21,7 @@ module Sentry
21
21
  # rate limits and client reports use the data_category rather than envelope item type
22
22
  def self.data_category(type)
23
23
  case type
24
- when 'session', 'attachment', 'transaction', 'profile' then type
24
+ when 'session', 'attachment', 'transaction', 'profile', 'span' then type
25
25
  when 'sessions' then 'session'
26
26
  when 'check_in' then 'monitor'
27
27
  when 'statsd', 'metric_meta' then 'metric_bucket'
data/lib/sentry/event.rb CHANGED
@@ -104,9 +104,7 @@ module Sentry
104
104
  unless request || env.empty?
105
105
  add_request_interface(env)
106
106
 
107
- if @send_default_pii
108
- user[:ip_address] = calculate_real_ip_from_rack(env)
109
- end
107
+ user[:ip_address] ||= calculate_real_ip_from_rack(env) if @send_default_pii
110
108
 
111
109
  if request_id = Utils::RequestId.read_from(env)
112
110
  tags[:request_id] = request_id
data/lib/sentry/hub.rb CHANGED
@@ -195,10 +195,12 @@ module Sentry
195
195
  elsif !options.empty?
196
196
  unsupported_option_keys = scope.update_from_options(**options)
197
197
 
198
- configuration.log_debug <<~MSG
199
- Options #{unsupported_option_keys} are not supported and will not be applied to the event.
200
- You may want to set them under the `extra` option.
201
- MSG
198
+ unless unsupported_option_keys.empty?
199
+ configuration.log_debug <<~MSG
200
+ Options #{unsupported_option_keys} are not supported and will not be applied to the event.
201
+ You may want to set them under the `extra` option.
202
+ MSG
203
+ end
202
204
  end
203
205
 
204
206
  event = current_client.capture_event(event, scope, hint)
@@ -50,6 +50,7 @@ module Sentry
50
50
  if Sentry.get_current_hub.instance_variable_get(:@stack).size > 1
51
51
  Sentry.get_current_hub.pop_scope
52
52
  end
53
+ Sentry::Scope.global_event_processors.clear
53
54
  end
54
55
 
55
56
  # @return [Transport]
@@ -266,6 +266,7 @@ module Sentry
266
266
  is_backpressure = Sentry.backpressure_monitor&.downsample_factor&.positive?
267
267
  reason = is_backpressure ? :backpressure : :sample_rate
268
268
  hub.current_client.transport.record_lost_event(reason, 'transaction')
269
+ hub.current_client.transport.record_lost_event(reason, 'span')
269
270
  end
270
271
  end
271
272
 
@@ -151,11 +151,11 @@ module Sentry
151
151
  envelope
152
152
  end
153
153
 
154
- def record_lost_event(reason, data_category)
154
+ def record_lost_event(reason, data_category, num: 1)
155
155
  return unless @send_client_reports
156
156
  return unless CLIENT_REPORT_REASONS.include?(reason)
157
157
 
158
- @discarded_events[[reason, data_category]] += 1
158
+ @discarded_events[[reason, data_category]] += num
159
159
  end
160
160
 
161
161
  def flush
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Sentry
4
- VERSION = "5.18.0"
4
+ VERSION = "5.18.2"
5
5
  end
data/sentry-ruby.gemspec CHANGED
@@ -7,16 +7,22 @@ Gem::Specification.new do |spec|
7
7
  spec.description = spec.summary = "A gem that provides a client interface for the Sentry error logger"
8
8
  spec.email = "accounts@sentry.io"
9
9
  spec.license = 'MIT'
10
- spec.homepage = "https://github.com/getsentry/sentry-ruby"
11
10
 
12
11
  spec.platform = Gem::Platform::RUBY
13
12
  spec.required_ruby_version = '>= 2.4'
14
13
  spec.extra_rdoc_files = ["README.md", "LICENSE.txt"]
15
14
  spec.files = `git ls-files | grep -Ev '^(spec|benchmarks|examples)'`.split("\n")
16
15
 
17
- spec.metadata["homepage_uri"] = spec.homepage
18
- spec.metadata["source_code_uri"] = spec.homepage
19
- spec.metadata["changelog_uri"] = "#{spec.homepage}/blob/master/CHANGELOG.md"
16
+ github_root_uri = 'https://github.com/getsentry/sentry-ruby'
17
+ spec.homepage = "#{github_root_uri}/tree/#{spec.version}/#{spec.name}"
18
+
19
+ spec.metadata = {
20
+ "homepage_uri" => spec.homepage,
21
+ "source_code_uri" => spec.homepage,
22
+ "changelog_uri" => "#{github_root_uri}/blob/#{spec.version}/CHANGELOG.md",
23
+ "bug_tracker_uri" => "#{github_root_uri}/issues",
24
+ "documentation_uri" => "http://www.rubydoc.info/gems/#{spec.name}/#{spec.version}"
25
+ }
20
26
 
21
27
  spec.require_paths = ["lib"]
22
28
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sentry-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.18.0
4
+ version: 5.18.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sentry Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-06-25 00:00:00.000000000 Z
11
+ date: 2024-07-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: concurrent-ruby
@@ -140,13 +140,15 @@ files:
140
140
  - lib/sentry/version.rb
141
141
  - sentry-ruby-core.gemspec
142
142
  - sentry-ruby.gemspec
143
- homepage: https://github.com/getsentry/sentry-ruby
143
+ homepage: https://github.com/getsentry/sentry-ruby/tree/5.18.2/sentry-ruby
144
144
  licenses:
145
145
  - MIT
146
146
  metadata:
147
- homepage_uri: https://github.com/getsentry/sentry-ruby
148
- source_code_uri: https://github.com/getsentry/sentry-ruby
149
- changelog_uri: https://github.com/getsentry/sentry-ruby/blob/master/CHANGELOG.md
147
+ homepage_uri: https://github.com/getsentry/sentry-ruby/tree/5.18.2/sentry-ruby
148
+ source_code_uri: https://github.com/getsentry/sentry-ruby/tree/5.18.2/sentry-ruby
149
+ changelog_uri: https://github.com/getsentry/sentry-ruby/blob/5.18.2/CHANGELOG.md
150
+ bug_tracker_uri: https://github.com/getsentry/sentry-ruby/issues
151
+ documentation_uri: http://www.rubydoc.info/gems/sentry-ruby/5.18.2
150
152
  post_install_message:
151
153
  rdoc_options: []
152
154
  require_paths:
@@ -162,7 +164,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
162
164
  - !ruby/object:Gem::Version
163
165
  version: '0'
164
166
  requirements: []
165
- rubygems_version: 3.1.6
167
+ rubygems_version: 3.5.11
166
168
  signing_key:
167
169
  specification_version: 4
168
170
  summary: A gem that provides a client interface for the Sentry error logger