sentry-ruby 5.22.1 → 5.22.2
Sign up to get free protection for your applications and to get access to all the features.
- 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 +14 -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: f8b76c7e3289d19422a8ab07bdc53a2ac0fd907d3e55fd86c18ee1eb37daa7d7
|
4
|
+
data.tar.gz: a560347120c4a0781e7ef67d9252e90dacf37c6d32f36a3c41da01110e0cbdc9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2b04dafc81567da6edc9dc86436b1815db4001962c0dc8bea82fcced79c8f95ec23f22122b1eb127fc278edcd39da0c91569284f5a170db4ef9c19827ba4cbc8
|
7
|
+
data.tar.gz: 7ee0819a7f3ea956a96123fb813731c440ffacbfc73e5ae37b47b650f8dded96dc4379321d1b714505c8f87a34c1b93a1ca6849a4a59697ad35f9eee5b827934
|
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,11 @@ 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
|
+
unless event.is_a?(ErrorEvent)
|
187
|
+
# Avoid serializing the event object in this case because we aren't sure what it is and what it contains
|
188
|
+
log_debug(<<~MSG)
|
189
|
+
Discarded event because before_send didn't return a Sentry::ErrorEvent object but an instance of #{event.class}
|
190
|
+
MSG
|
188
191
|
transport.record_lost_event(:before_send, data_category)
|
189
192
|
return
|
190
193
|
end
|
@@ -193,15 +196,18 @@ module Sentry
|
|
193
196
|
if event_type == TransactionEvent::TYPE && configuration.before_send_transaction
|
194
197
|
event = configuration.before_send_transaction.call(event, hint)
|
195
198
|
|
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
|
199
|
+
if event.is_a?(TransactionEvent)
|
202
200
|
spans_after = event.is_a?(TransactionEvent) ? event.spans.size : 0
|
203
201
|
spans_delta = spans_before - spans_after
|
204
202
|
transport.record_lost_event(:before_send, "span", num: spans_delta) if spans_delta > 0
|
203
|
+
else
|
204
|
+
# Avoid serializing the event object in this case because we aren't sure what it is and what it contains
|
205
|
+
log_debug(<<~MSG)
|
206
|
+
Discarded event because before_send_transaction didn't return a Sentry::TransactionEvent object but an instance of #{event.class}
|
207
|
+
MSG
|
208
|
+
transport.record_lost_event(:before_send, "transaction")
|
209
|
+
transport.record_lost_event(:before_send, "span", num: spans_before + 1)
|
210
|
+
return
|
205
211
|
end
|
206
212
|
end
|
207
213
|
|
@@ -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.2
|
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-24 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.2/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.2/sentry-ruby
|
158
|
+
source_code_uri: https://github.com/getsentry/sentry-ruby/tree/5.22.2/sentry-ruby
|
159
|
+
changelog_uri: https://github.com/getsentry/sentry-ruby/blob/5.22.2/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.2
|
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: []
|