sentry-ruby 5.22.1 → 5.23.0
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 +6 -3
- data/README.md +1 -1
- data/lib/sentry/backtrace.rb +5 -4
- data/lib/sentry/breadcrumb.rb +1 -1
- data/lib/sentry/client.rb +29 -8
- data/lib/sentry/configuration.rb +64 -8
- data/lib/sentry/cron/monitor_check_ins.rb +3 -3
- data/lib/sentry/hub.rb +31 -1
- data/lib/sentry/linecache.rb +3 -3
- data/lib/sentry/metrics/timing.rb +8 -0
- data/lib/sentry/net/http.rb +2 -1
- data/lib/sentry/test_helper.rb +13 -0
- data/lib/sentry/transaction.rb +8 -2
- data/lib/sentry/transaction_event.rb +4 -1
- data/lib/sentry/transport/http_transport.rb +0 -1
- data/lib/sentry/utils/http_tracing.rb +15 -1
- data/lib/sentry/vernier/profiler.rb +3 -2
- data/lib/sentry/version.rb +1 -1
- data/lib/sentry-ruby.rb +17 -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: '09ca0c97390e688d58572ffe3ae022523a1003a48ccea319857b302b3e1ebb95'
|
4
|
+
data.tar.gz: 28f154fb38f21c50090dc8ae3c2bc7b335f288a298e97d934a24db1b8e7ac372
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5f170fe27327a1753f4a6f2d62b5a694f30c91f1f86c4e2caa837d70467298ea2af261475a2da1045e3513257f3a9be4bb66a0c2e0dba271e43a1478ecd42c0b
|
7
|
+
data.tar.gz: 32a7f13e8eee4f7c8958dfd1a083aecf7ee306fec695703c5dbeff810e4ae5ebd84a1435e7edaef8a61d94eaf64910442422d2142007d77c5be31080ad32f244
|
data/Gemfile
CHANGED
@@ -3,12 +3,16 @@
|
|
3
3
|
source "https://rubygems.org"
|
4
4
|
git_source(:github) { |name| "https://github.com/#{name}.git" }
|
5
5
|
|
6
|
+
eval_gemfile "../Gemfile"
|
7
|
+
|
6
8
|
gem "sentry-ruby", path: "./"
|
7
9
|
|
8
10
|
rack_version = ENV["RACK_VERSION"]
|
9
11
|
rack_version = "3.0.0" if rack_version.nil?
|
10
12
|
gem "rack", "~> #{Gem::Version.new(rack_version)}" unless rack_version == "0"
|
11
13
|
|
14
|
+
gem "ostruct" if RUBY_VERSION >= "3.4"
|
15
|
+
|
12
16
|
redis_rb_version = ENV.fetch("REDIS_RB_VERSION", "5.0")
|
13
17
|
gem "redis", "~> #{redis_rb_version}"
|
14
18
|
|
@@ -25,9 +29,8 @@ gem "benchmark_driver"
|
|
25
29
|
gem "benchmark-ipsa"
|
26
30
|
gem "benchmark-memory"
|
27
31
|
|
28
|
-
gem "yard"
|
32
|
+
gem "yard"
|
29
33
|
gem "webrick"
|
30
34
|
gem "faraday"
|
31
35
|
gem "excon"
|
32
|
-
|
33
|
-
eval_gemfile File.expand_path("../Gemfile", __dir__)
|
36
|
+
gem "webmock"
|
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,11 +12,11 @@ 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)
|
19
|
-
JAVA_INPUT_FORMAT = /^(
|
19
|
+
JAVA_INPUT_FORMAT = /^([\w$.]+)\.([\w$]+)\(([\w$.]+):(\d+)\)$/
|
20
20
|
|
21
21
|
# The file portion of the line (such as app/models/user.rb)
|
22
22
|
attr_reader :file
|
@@ -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/breadcrumb.rb
CHANGED
@@ -47,7 +47,7 @@ module Sentry
|
|
47
47
|
# @param message [String]
|
48
48
|
# @return [void]
|
49
49
|
def message=(message)
|
50
|
-
@message =
|
50
|
+
@message = message ? message.byteslice(0..Event::MAX_MESSAGE_SIZE_IN_BYTES) : ""
|
51
51
|
end
|
52
52
|
|
53
53
|
# @param level [String]
|
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, CheckInEvent
|
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
|
|
data/lib/sentry/configuration.rb
CHANGED
@@ -264,6 +264,7 @@ module Sentry
|
|
264
264
|
|
265
265
|
# Easier way to use performance tracing
|
266
266
|
# If set to true, will set traces_sample_rate to 1.0
|
267
|
+
# @deprecated It will be removed in the next major release.
|
267
268
|
# @return [Boolean, nil]
|
268
269
|
attr_reader :enable_tracing
|
269
270
|
|
@@ -360,8 +361,47 @@ module Sentry
|
|
360
361
|
def add_post_initialization_callback(&block)
|
361
362
|
post_initialization_callbacks << block
|
362
363
|
end
|
364
|
+
|
365
|
+
def validations
|
366
|
+
@validations ||= {}
|
367
|
+
end
|
368
|
+
|
369
|
+
def validate(attribute, optional: false, type: nil)
|
370
|
+
validations[attribute] = {
|
371
|
+
optional: optional,
|
372
|
+
type: type,
|
373
|
+
proc: build_validation_proc(optional, type)
|
374
|
+
}
|
375
|
+
end
|
376
|
+
|
377
|
+
private
|
378
|
+
|
379
|
+
def build_validation_proc(optional, type)
|
380
|
+
case type
|
381
|
+
when :numeric
|
382
|
+
->(value) do
|
383
|
+
if optional && value.nil?
|
384
|
+
true
|
385
|
+
else
|
386
|
+
unless value.is_a?(Numeric)
|
387
|
+
message = "must be a Numeric"
|
388
|
+
message += " or nil" if optional
|
389
|
+
|
390
|
+
{ error: message, value: value }
|
391
|
+
else
|
392
|
+
true
|
393
|
+
end
|
394
|
+
end
|
395
|
+
end
|
396
|
+
else
|
397
|
+
->(value) { true }
|
398
|
+
end
|
399
|
+
end
|
363
400
|
end
|
364
401
|
|
402
|
+
validate :traces_sample_rate, optional: true, type: :numeric
|
403
|
+
validate :profiles_sample_rate, optional: true, type: :numeric
|
404
|
+
|
365
405
|
def initialize
|
366
406
|
self.app_dirs_pattern = APP_DIRS_PATTERN
|
367
407
|
self.debug = Sentry::Utils::EnvHelper.env_to_bool(ENV["SENTRY_DEBUG"])
|
@@ -417,6 +457,24 @@ module Sentry
|
|
417
457
|
run_post_initialization_callbacks
|
418
458
|
end
|
419
459
|
|
460
|
+
def validate
|
461
|
+
if profiler_class == Sentry::Profiler && profiles_sample_rate && !Sentry.dependency_installed?(:StackProf)
|
462
|
+
log_warn("Please add the 'stackprof' gem to your Gemfile to use the StackProf profiler with Sentry.")
|
463
|
+
end
|
464
|
+
|
465
|
+
if profiler_class == Sentry::Vernier::Profiler && profiles_sample_rate && !Sentry.dependency_installed?(:Vernier)
|
466
|
+
log_warn("Please add the 'vernier' gem to your Gemfile to use the Vernier profiler with Sentry.")
|
467
|
+
end
|
468
|
+
|
469
|
+
self.class.validations.each do |attribute, validation|
|
470
|
+
value = public_send(attribute)
|
471
|
+
|
472
|
+
next if (result = validation[:proc].call(value)) === true
|
473
|
+
|
474
|
+
raise ArgumentError, result[:error]
|
475
|
+
end
|
476
|
+
end
|
477
|
+
|
420
478
|
def dsn=(value)
|
421
479
|
@dsn = init_dsn(value)
|
422
480
|
end
|
@@ -485,22 +543,21 @@ module Sentry
|
|
485
543
|
end
|
486
544
|
|
487
545
|
def enable_tracing=(enable_tracing)
|
546
|
+
unless enable_tracing.nil?
|
547
|
+
log_warn <<~MSG
|
548
|
+
`enable_tracing` is now deprecated in favor of `traces_sample_rate = 1.0`.
|
549
|
+
MSG
|
550
|
+
end
|
551
|
+
|
488
552
|
@enable_tracing = enable_tracing
|
489
553
|
@traces_sample_rate ||= 1.0 if enable_tracing
|
490
554
|
end
|
491
555
|
|
492
|
-
def is_numeric_or_nil?(value)
|
493
|
-
value.is_a?(Numeric) || value.nil?
|
494
|
-
end
|
495
|
-
|
496
556
|
def traces_sample_rate=(traces_sample_rate)
|
497
|
-
raise ArgumentError, "traces_sample_rate must be a Numeric or nil" unless is_numeric_or_nil?(traces_sample_rate)
|
498
557
|
@traces_sample_rate = traces_sample_rate
|
499
558
|
end
|
500
559
|
|
501
560
|
def profiles_sample_rate=(profiles_sample_rate)
|
502
|
-
raise ArgumentError, "profiles_sample_rate must be a Numeric or nil" unless is_numeric_or_nil?(profiles_sample_rate)
|
503
|
-
log_warn("Please make sure to include the 'stackprof' gem in your Gemfile to use Profiling with Sentry.") unless defined?(StackProf)
|
504
561
|
@profiles_sample_rate = profiles_sample_rate
|
505
562
|
end
|
506
563
|
|
@@ -509,7 +566,6 @@ module Sentry
|
|
509
566
|
begin
|
510
567
|
require "vernier"
|
511
568
|
rescue LoadError
|
512
|
-
raise ArgumentError, "Please add the 'vernier' gem to your Gemfile to use the Vernier profiler with Sentry."
|
513
569
|
end
|
514
570
|
end
|
515
571
|
|
@@ -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,
|
data/lib/sentry/hub.rb
CHANGED
@@ -8,12 +8,42 @@ module Sentry
|
|
8
8
|
class Hub
|
9
9
|
include ArgumentCheckingHelper
|
10
10
|
|
11
|
+
MUTEX = Mutex.new
|
12
|
+
|
11
13
|
attr_reader :last_event_id
|
12
14
|
|
15
|
+
attr_reader :current_profiler
|
16
|
+
|
13
17
|
def initialize(client, scope)
|
14
18
|
first_layer = Layer.new(client, scope)
|
15
19
|
@stack = [first_layer]
|
16
20
|
@last_event_id = nil
|
21
|
+
@current_profiler = {}
|
22
|
+
end
|
23
|
+
|
24
|
+
# This is an internal private method
|
25
|
+
# @api private
|
26
|
+
def start_profiler!(transaction)
|
27
|
+
MUTEX.synchronize do
|
28
|
+
transaction.start_profiler!
|
29
|
+
@current_profiler[transaction.__id__] = transaction.profiler
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
# This is an internal private method
|
34
|
+
# @api private
|
35
|
+
def stop_profiler!(transaction)
|
36
|
+
MUTEX.synchronize do
|
37
|
+
@current_profiler.delete(transaction.__id__)&.stop
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
# This is an internal private method
|
42
|
+
# @api private
|
43
|
+
def profiler_running?
|
44
|
+
MUTEX.synchronize do
|
45
|
+
!@current_profiler.empty?
|
46
|
+
end
|
17
47
|
end
|
18
48
|
|
19
49
|
def new_from_top
|
@@ -96,7 +126,7 @@ module Sentry
|
|
96
126
|
sampling_context.merge!(custom_sampling_context)
|
97
127
|
transaction.set_initial_sample_decision(sampling_context: sampling_context)
|
98
128
|
|
99
|
-
|
129
|
+
start_profiler!(transaction)
|
100
130
|
|
101
131
|
transaction
|
102
132
|
end
|
data/lib/sentry/linecache.rb
CHANGED
@@ -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/test_helper.rb
CHANGED
@@ -83,5 +83,18 @@ module Sentry
|
|
83
83
|
def extract_sentry_exceptions(event)
|
84
84
|
event&.exception&.values || []
|
85
85
|
end
|
86
|
+
|
87
|
+
def reset_sentry_globals!
|
88
|
+
Sentry::MUTEX.synchronize do
|
89
|
+
# Don't check initialized? because sometimes we stub it in tests
|
90
|
+
if Sentry.instance_variable_defined?(:@main_hub)
|
91
|
+
Sentry::GLOBALS.each do |var|
|
92
|
+
Sentry.instance_variable_set(:"@#{var}", nil)
|
93
|
+
end
|
94
|
+
|
95
|
+
Thread.current.thread_variable_set(Sentry::THREAD_LOCAL, nil)
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
86
99
|
end
|
87
100
|
end
|
data/lib/sentry/transaction.rb
CHANGED
@@ -85,7 +85,11 @@ module Sentry
|
|
85
85
|
@effective_sample_rate = nil
|
86
86
|
@contexts = {}
|
87
87
|
@measurements = {}
|
88
|
-
|
88
|
+
|
89
|
+
unless @hub.profiler_running?
|
90
|
+
@profiler = @configuration.profiler_class.new(@configuration)
|
91
|
+
end
|
92
|
+
|
89
93
|
init_span_recorder
|
90
94
|
end
|
91
95
|
|
@@ -257,7 +261,7 @@ module Sentry
|
|
257
261
|
@name = UNLABELD_NAME
|
258
262
|
end
|
259
263
|
|
260
|
-
@
|
264
|
+
@hub.stop_profiler!(self)
|
261
265
|
|
262
266
|
if @sampled
|
263
267
|
event = hub.current_client.event_from_transaction(self)
|
@@ -299,6 +303,8 @@ module Sentry
|
|
299
303
|
# Start the profiler.
|
300
304
|
# @return [void]
|
301
305
|
def start_profiler!
|
306
|
+
return unless profiler
|
307
|
+
|
302
308
|
profiler.set_initial_sample_decision(sampled)
|
303
309
|
profiler.start
|
304
310
|
end
|
@@ -59,8 +59,11 @@ module Sentry
|
|
59
59
|
|
60
60
|
private
|
61
61
|
|
62
|
+
EMPTY_PROFILE = {}.freeze
|
63
|
+
|
62
64
|
def populate_profile(transaction)
|
63
|
-
profile_hash = transaction.profiler
|
65
|
+
profile_hash = transaction.profiler&.to_hash || EMPTY_PROFILE
|
66
|
+
|
64
67
|
return if profile_hash.empty?
|
65
68
|
|
66
69
|
profile_hash.merge!(
|
@@ -17,7 +17,7 @@ module Sentry
|
|
17
17
|
|
18
18
|
def record_sentry_breadcrumb(request_info, response_status)
|
19
19
|
crumb = Sentry::Breadcrumb.new(
|
20
|
-
level:
|
20
|
+
level: get_level(response_status),
|
21
21
|
category: self.class::BREADCRUMB_CATEGORY,
|
22
22
|
type: "info",
|
23
23
|
data: { status: response_status, **request_info }
|
@@ -55,6 +55,20 @@ module Sentry
|
|
55
55
|
"#{URI.encode_www_form_component(prefix)}=#{URI.encode_www_form_component(value)}"
|
56
56
|
end
|
57
57
|
end
|
58
|
+
|
59
|
+
private
|
60
|
+
|
61
|
+
def get_level(status)
|
62
|
+
return :info unless status && status.is_a?(Integer)
|
63
|
+
|
64
|
+
if status >= 500
|
65
|
+
:error
|
66
|
+
elsif status >= 400
|
67
|
+
:warning
|
68
|
+
else
|
69
|
+
:info
|
70
|
+
end
|
71
|
+
end
|
58
72
|
end
|
59
73
|
end
|
60
74
|
end
|
@@ -74,6 +74,7 @@ module Sentry
|
|
74
74
|
return unless @started
|
75
75
|
|
76
76
|
@result = ::Vernier.stop_profile
|
77
|
+
@started = false
|
77
78
|
|
78
79
|
log("Stopped")
|
79
80
|
rescue RuntimeError => e
|
@@ -89,13 +90,13 @@ module Sentry
|
|
89
90
|
end
|
90
91
|
|
91
92
|
def to_hash
|
92
|
-
return EMPTY_RESULT unless @started
|
93
|
-
|
94
93
|
unless @sampled
|
95
94
|
record_lost_event(:sample_rate)
|
96
95
|
return EMPTY_RESULT
|
97
96
|
end
|
98
97
|
|
98
|
+
return EMPTY_RESULT unless result
|
99
|
+
|
99
100
|
{ **profile_meta, profile: output.to_h }
|
100
101
|
end
|
101
102
|
|
data/lib/sentry/version.rb
CHANGED
data/lib/sentry-ruby.rb
CHANGED
@@ -52,6 +52,14 @@ module Sentry
|
|
52
52
|
|
53
53
|
MUTEX = Mutex.new
|
54
54
|
|
55
|
+
GLOBALS = %i[
|
56
|
+
main_hub
|
57
|
+
session_flusher
|
58
|
+
backpressure_monitor
|
59
|
+
metrics_aggregator
|
60
|
+
exception_locals_tp
|
61
|
+
].freeze
|
62
|
+
|
55
63
|
class << self
|
56
64
|
# @!visibility private
|
57
65
|
def exception_locals_tp
|
@@ -232,6 +240,7 @@ module Sentry
|
|
232
240
|
yield(config) if block_given?
|
233
241
|
config.detect_release
|
234
242
|
apply_patches(config)
|
243
|
+
config.validate
|
235
244
|
client = Client.new(config)
|
236
245
|
scope = Scope.new(max_breadcrumbs: config.max_breadcrumbs)
|
237
246
|
hub = Hub.new(client, scope)
|
@@ -308,6 +317,9 @@ module Sentry
|
|
308
317
|
# @return [Hub]
|
309
318
|
def get_main_hub
|
310
319
|
MUTEX.synchronize { @main_hub }
|
320
|
+
rescue ThreadError
|
321
|
+
# In some rare cases this may be called in a trap context so we need to handle it gracefully
|
322
|
+
@main_hub
|
311
323
|
end
|
312
324
|
|
313
325
|
# Takes an instance of Sentry::Breadcrumb and stores it to the current active scope.
|
@@ -605,6 +617,11 @@ module Sentry
|
|
605
617
|
def utc_now
|
606
618
|
Time.now.utc
|
607
619
|
end
|
620
|
+
|
621
|
+
# @!visibility private
|
622
|
+
def dependency_installed?(name)
|
623
|
+
Object.const_defined?(name)
|
624
|
+
end
|
608
625
|
end
|
609
626
|
end
|
610
627
|
|
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.
|
4
|
+
version: 5.23.0
|
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-03-11 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.
|
153
|
+
homepage: https://github.com/getsentry/sentry-ruby/tree/5.23.0/sentry-ruby
|
155
154
|
licenses:
|
156
155
|
- MIT
|
157
156
|
metadata:
|
158
|
-
homepage_uri: https://github.com/getsentry/sentry-ruby/tree/5.
|
159
|
-
source_code_uri: https://github.com/getsentry/sentry-ruby/tree/5.
|
160
|
-
changelog_uri: https://github.com/getsentry/sentry-ruby/blob/5.
|
157
|
+
homepage_uri: https://github.com/getsentry/sentry-ruby/tree/5.23.0/sentry-ruby
|
158
|
+
source_code_uri: https://github.com/getsentry/sentry-ruby/tree/5.23.0/sentry-ruby
|
159
|
+
changelog_uri: https://github.com/getsentry/sentry-ruby/blob/5.23.0/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.
|
163
|
-
post_install_message:
|
161
|
+
documentation_uri: http://www.rubydoc.info/gems/sentry-ruby/5.23.0
|
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: []
|