sentry-ruby-core 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 +4 -4
- data/README.md +10 -0
- data/lib/sentry/client.rb +20 -3
- data/lib/sentry/configuration.rb +9 -1
- data/lib/sentry/envelope.rb +1 -1
- data/lib/sentry/event.rb +1 -3
- data/lib/sentry/hub.rb +6 -4
- data/lib/sentry/test_helper.rb +1 -0
- data/lib/sentry/transaction.rb +1 -0
- data/lib/sentry/transport.rb +2 -2
- data/lib/sentry/version.rb +1 -1
- data/sentry-ruby.gemspec +10 -4
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: afb4ea80437f41e79f4587ee2fa26d15840774a9b6381ade3d601b4669fad270
|
4
|
+
data.tar.gz: 2ba353d4fdbe545c8e76fbd2c3b0169f481965e8e55cc74ad3e4cd613b6c4f76
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 87d277ecb542c59d04b37c8ba28a20236cefde3e096ea01ad2d2ffa3127a3afb07737da494e8707650d7cd608f113754e51d33ade8404111b2bfb9cd03964f38
|
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
|
-
|
70
|
-
|
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,
|
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
|
|
data/lib/sentry/configuration.rb
CHANGED
@@ -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 = (
|
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
|
data/lib/sentry/envelope.rb
CHANGED
@@ -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
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
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)
|
data/lib/sentry/test_helper.rb
CHANGED
data/lib/sentry/transaction.rb
CHANGED
@@ -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
|
|
data/lib/sentry/transport.rb
CHANGED
@@ -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]] +=
|
158
|
+
@discarded_events[[reason, data_category]] += num
|
159
159
|
end
|
160
160
|
|
161
161
|
def flush
|
data/lib/sentry/version.rb
CHANGED
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
|
-
|
18
|
-
spec.
|
19
|
-
|
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-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.18.
|
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-
|
11
|
+
date: 2024-07-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sentry-ruby
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 5.18.
|
19
|
+
version: 5.18.2
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 5.18.
|
26
|
+
version: 5.18.2
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: concurrent-ruby
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -156,7 +156,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
156
156
|
- !ruby/object:Gem::Version
|
157
157
|
version: '0'
|
158
158
|
requirements: []
|
159
|
-
rubygems_version: 3.
|
159
|
+
rubygems_version: 3.5.11
|
160
160
|
signing_key:
|
161
161
|
specification_version: 4
|
162
162
|
summary: A gem that provides a client interface for the Sentry error logger
|