sentry-ruby 5.22.1 → 5.22.3
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 +2 -0
- data/README.md +1 -1
- data/lib/sentry/backtrace.rb +4 -3
- data/lib/sentry/client.rb +29 -8
- data/lib/sentry/cron/monitor_check_ins.rb +3 -3
- data/lib/sentry/metrics/timing.rb +8 -0
- data/lib/sentry/net/http.rb +2 -1
- data/lib/sentry/version.rb +1 -1
- data/lib/sentry-ruby.rb +3 -0
- metadata +8 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6efd6e1590191762ede29567335f21b5e54ff63bb85c26e586ecc5e3ce8c5f2a
|
4
|
+
data.tar.gz: d7758ef8b065a2b772ccebec8eee4807683a002495ca55dab7e85f8c1b92768f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 126c7238fb1dbd17f80986824bbd73eab5fba5a70b1f39a87cc59ff7fafb52474b3eb5b9b8043af03b3049acdf2ac1b322c572c652edee015aa7cabeb1d5c61a
|
7
|
+
data.tar.gz: 5f6777c874b1544eab2e47359d61d1eb6cd725b6f1788e2595815e8340d1291e7da7632373c77635ebe717e8c75537a9157a0a904a90bdc1b518fb9819adb0e8
|
data/Gemfile
CHANGED
@@ -9,6 +9,8 @@ rack_version = ENV["RACK_VERSION"]
|
|
9
9
|
rack_version = "3.0.0" if rack_version.nil?
|
10
10
|
gem "rack", "~> #{Gem::Version.new(rack_version)}" unless rack_version == "0"
|
11
11
|
|
12
|
+
gem "ostruct" if RUBY_VERSION >= "3.4"
|
13
|
+
|
12
14
|
redis_rb_version = ENV.fetch("REDIS_RB_VERSION", "5.0")
|
13
15
|
gem "redis", "~> #{redis_rb_version}"
|
14
16
|
|
data/README.md
CHANGED
@@ -33,7 +33,7 @@ If you're using `sentry-raven`, we recommend you to migrate to this new SDK. You
|
|
33
33
|
|
34
34
|
## Requirements
|
35
35
|
|
36
|
-
We test from Ruby 2.4 to Ruby 3.
|
36
|
+
We test from Ruby 2.4 to Ruby 3.4 at the latest patchlevel/teeny version. We also support JRuby 9.0.
|
37
37
|
|
38
38
|
If you use self-hosted Sentry, please also make sure its version is above `20.6.0`.
|
39
39
|
|
data/lib/sentry/backtrace.rb
CHANGED
@@ -12,7 +12,7 @@ module Sentry
|
|
12
12
|
RUBY_INPUT_FORMAT = /
|
13
13
|
^ \s* (?: [a-zA-Z]: | uri:classloader: )? ([^:]+ | <.*>):
|
14
14
|
(\d+)
|
15
|
-
(?: :in\s('|`)([^']+)')?$
|
15
|
+
(?: :in\s('|`)(?:([\w:]+)\#)?([^']+)')?$
|
16
16
|
/x
|
17
17
|
|
18
18
|
# org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:170)
|
@@ -37,10 +37,11 @@ module Sentry
|
|
37
37
|
# @return [Line] The parsed backtrace line
|
38
38
|
def self.parse(unparsed_line, in_app_pattern = nil)
|
39
39
|
ruby_match = unparsed_line.match(RUBY_INPUT_FORMAT)
|
40
|
+
|
40
41
|
if ruby_match
|
41
|
-
_, file, number, _, method = ruby_match.to_a
|
42
|
+
_, file, number, _, module_name, method = ruby_match.to_a
|
42
43
|
file.sub!(/\.class$/, RB_EXTENSION)
|
43
|
-
module_name =
|
44
|
+
module_name = module_name
|
44
45
|
else
|
45
46
|
java_match = unparsed_line.match(JAVA_INPUT_FORMAT)
|
46
47
|
_, module_name, method, file, number = java_match.to_a
|
data/lib/sentry/client.rb
CHANGED
@@ -183,8 +183,19 @@ module Sentry
|
|
183
183
|
if event_type != TransactionEvent::TYPE && configuration.before_send
|
184
184
|
event = configuration.before_send.call(event, hint)
|
185
185
|
|
186
|
-
|
187
|
-
|
186
|
+
case event
|
187
|
+
when ErrorEvent
|
188
|
+
# do nothing
|
189
|
+
when Hash
|
190
|
+
log_debug(<<~MSG)
|
191
|
+
Returning a Hash from before_send is deprecated and will be removed in the next major version.
|
192
|
+
Please return a Sentry::ErrorEvent object instead.
|
193
|
+
MSG
|
194
|
+
else
|
195
|
+
# Avoid serializing the event object in this case because we aren't sure what it is and what it contains
|
196
|
+
log_debug(<<~MSG)
|
197
|
+
Discarded event because before_send didn't return a Sentry::ErrorEvent object but an instance of #{event.class}
|
198
|
+
MSG
|
188
199
|
transport.record_lost_event(:before_send, data_category)
|
189
200
|
return
|
190
201
|
end
|
@@ -193,15 +204,25 @@ module Sentry
|
|
193
204
|
if event_type == TransactionEvent::TYPE && configuration.before_send_transaction
|
194
205
|
event = configuration.before_send_transaction.call(event, hint)
|
195
206
|
|
196
|
-
if event.
|
197
|
-
log_debug("Discarded event because before_send_transaction returned nil")
|
198
|
-
transport.record_lost_event(:before_send, "transaction")
|
199
|
-
transport.record_lost_event(:before_send, "span", num: spans_before + 1)
|
200
|
-
return
|
201
|
-
else
|
207
|
+
if event.is_a?(TransactionEvent) || event.is_a?(Hash)
|
202
208
|
spans_after = event.is_a?(TransactionEvent) ? event.spans.size : 0
|
203
209
|
spans_delta = spans_before - spans_after
|
204
210
|
transport.record_lost_event(:before_send, "span", num: spans_delta) if spans_delta > 0
|
211
|
+
|
212
|
+
if event.is_a?(Hash)
|
213
|
+
log_debug(<<~MSG)
|
214
|
+
Returning a Hash from before_send_transaction is deprecated and will be removed in the next major version.
|
215
|
+
Please return a Sentry::TransactionEvent object instead.
|
216
|
+
MSG
|
217
|
+
end
|
218
|
+
else
|
219
|
+
# Avoid serializing the event object in this case because we aren't sure what it is and what it contains
|
220
|
+
log_debug(<<~MSG)
|
221
|
+
Discarded event because before_send_transaction didn't return a Sentry::TransactionEvent object but an instance of #{event.class}
|
222
|
+
MSG
|
223
|
+
transport.record_lost_event(:before_send, "transaction")
|
224
|
+
transport.record_lost_event(:before_send, "span", num: spans_before + 1)
|
225
|
+
return
|
205
226
|
end
|
206
227
|
end
|
207
228
|
|
@@ -14,12 +14,12 @@ module Sentry
|
|
14
14
|
:in_progress,
|
15
15
|
monitor_config: monitor_config)
|
16
16
|
|
17
|
-
start =
|
17
|
+
start = Metrics::Timing.duration_start
|
18
18
|
|
19
19
|
begin
|
20
20
|
# need to do this on ruby <= 2.6 sadly
|
21
21
|
ret = method(:perform).super_method.arity == 0 ? super() : super
|
22
|
-
duration =
|
22
|
+
duration = Metrics::Timing.duration_end(start)
|
23
23
|
|
24
24
|
Sentry.capture_check_in(slug,
|
25
25
|
:ok,
|
@@ -29,7 +29,7 @@ module Sentry
|
|
29
29
|
|
30
30
|
ret
|
31
31
|
rescue Exception
|
32
|
-
duration =
|
32
|
+
duration = Metrics::Timing.duration_end(start)
|
33
33
|
|
34
34
|
Sentry.capture_check_in(slug,
|
35
35
|
:error,
|
@@ -37,6 +37,14 @@ module Sentry
|
|
37
37
|
def week
|
38
38
|
Sentry.utc_now.to_i / (3600.0 * 24.0 * 7.0)
|
39
39
|
end
|
40
|
+
|
41
|
+
def duration_start
|
42
|
+
Process.clock_gettime(Process::CLOCK_MONOTONIC)
|
43
|
+
end
|
44
|
+
|
45
|
+
def duration_end(start)
|
46
|
+
Process.clock_gettime(Process::CLOCK_MONOTONIC) - start
|
47
|
+
end
|
40
48
|
end
|
41
49
|
end
|
42
50
|
end
|
data/lib/sentry/net/http.rb
CHANGED
@@ -13,6 +13,7 @@ module Sentry
|
|
13
13
|
OP_NAME = "http.client"
|
14
14
|
SPAN_ORIGIN = "auto.http.net_http"
|
15
15
|
BREADCRUMB_CATEGORY = "net.http"
|
16
|
+
URI_PARSER = URI.const_defined?("RFC2396_PARSER") ? URI::RFC2396_PARSER : URI::DEFAULT_PARSER
|
16
17
|
|
17
18
|
# To explain how the entire thing works, we need to know how the original Net::HTTP#request works
|
18
19
|
# Here's part of its definition. As you can see, it usually calls itself inside a #start block
|
@@ -66,7 +67,7 @@ module Sentry
|
|
66
67
|
# IPv6 url could look like '::1/path', and that won't parse without
|
67
68
|
# wrapping it in square brackets.
|
68
69
|
hostname = address =~ Resolv::IPv6::Regex ? "[#{address}]" : address
|
69
|
-
uri = req.uri || URI.parse(
|
70
|
+
uri = req.uri || URI.parse(URI_PARSER.escape("#{use_ssl? ? 'https' : 'http'}://#{hostname}#{req.path}"))
|
70
71
|
url = "#{uri.scheme}://#{uri.host}#{uri.path}" rescue uri.to_s
|
71
72
|
|
72
73
|
result = { method: req.method, url: url }
|
data/lib/sentry/version.rb
CHANGED
data/lib/sentry-ruby.rb
CHANGED
@@ -308,6 +308,9 @@ module Sentry
|
|
308
308
|
# @return [Hub]
|
309
309
|
def get_main_hub
|
310
310
|
MUTEX.synchronize { @main_hub }
|
311
|
+
rescue ThreadError
|
312
|
+
# In some rare cases this may be called in a trap context so we need to handle it gracefully
|
313
|
+
@main_hub
|
311
314
|
end
|
312
315
|
|
313
316
|
# Takes an instance of Sentry::Breadcrumb and stores it to the current active scope.
|
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sentry-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.22.
|
4
|
+
version: 5.22.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sentry Team
|
8
|
-
autorequire:
|
9
8
|
bindir: bin
|
10
9
|
cert_chain: []
|
11
|
-
date:
|
10
|
+
date: 2025-01-29 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
13
|
name: concurrent-ruby
|
@@ -151,16 +150,15 @@ files:
|
|
151
150
|
- lib/sentry/version.rb
|
152
151
|
- sentry-ruby-core.gemspec
|
153
152
|
- sentry-ruby.gemspec
|
154
|
-
homepage: https://github.com/getsentry/sentry-ruby/tree/5.22.
|
153
|
+
homepage: https://github.com/getsentry/sentry-ruby/tree/5.22.3/sentry-ruby
|
155
154
|
licenses:
|
156
155
|
- MIT
|
157
156
|
metadata:
|
158
|
-
homepage_uri: https://github.com/getsentry/sentry-ruby/tree/5.22.
|
159
|
-
source_code_uri: https://github.com/getsentry/sentry-ruby/tree/5.22.
|
160
|
-
changelog_uri: https://github.com/getsentry/sentry-ruby/blob/5.22.
|
157
|
+
homepage_uri: https://github.com/getsentry/sentry-ruby/tree/5.22.3/sentry-ruby
|
158
|
+
source_code_uri: https://github.com/getsentry/sentry-ruby/tree/5.22.3/sentry-ruby
|
159
|
+
changelog_uri: https://github.com/getsentry/sentry-ruby/blob/5.22.3/CHANGELOG.md
|
161
160
|
bug_tracker_uri: https://github.com/getsentry/sentry-ruby/issues
|
162
|
-
documentation_uri: http://www.rubydoc.info/gems/sentry-ruby/5.22.
|
163
|
-
post_install_message:
|
161
|
+
documentation_uri: http://www.rubydoc.info/gems/sentry-ruby/5.22.3
|
164
162
|
rdoc_options: []
|
165
163
|
require_paths:
|
166
164
|
- lib
|
@@ -175,8 +173,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
175
173
|
- !ruby/object:Gem::Version
|
176
174
|
version: '0'
|
177
175
|
requirements: []
|
178
|
-
rubygems_version: 3.
|
179
|
-
signing_key:
|
176
|
+
rubygems_version: 3.6.2
|
180
177
|
specification_version: 4
|
181
178
|
summary: A gem that provides a client interface for the Sentry error logger
|
182
179
|
test_files: []
|