sentry-ruby 5.22.3 → 5.22.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/sentry/client.rb +1 -1
- data/lib/sentry/configuration.rb +57 -8
- data/lib/sentry/version.rb +1 -1
- data/lib/sentry-ruby.rb +6 -0
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ccdc435e6c9cc7602051e6ae33794509604f6a6973e8098acb3b39cdaa727056
|
4
|
+
data.tar.gz: 7963e284f23ac79656f94eccbed48840be1746927bcae3ae18a66c60aea923c5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: da82afec03f9100f4d1389ac96069328a61f658b3ebf39b982aa8eb1284fbc19bd00168d4d89b3b4e8b0a0d82b98e161a4d38f4e5afbc88bdbbcfa3b7aadd958
|
7
|
+
data.tar.gz: 1711020af1887f806b3cc01a9e1d2540b616e5f3e5d77da85cb252e85ae90af9062de51eb9e552a434595345d0978a10b6002cd2944e0baaf4414275e58fd399
|
data/lib/sentry/client.rb
CHANGED
data/lib/sentry/configuration.rb
CHANGED
@@ -360,8 +360,47 @@ module Sentry
|
|
360
360
|
def add_post_initialization_callback(&block)
|
361
361
|
post_initialization_callbacks << block
|
362
362
|
end
|
363
|
+
|
364
|
+
def validations
|
365
|
+
@validations ||= {}
|
366
|
+
end
|
367
|
+
|
368
|
+
def validate(attribute, optional: false, type: nil)
|
369
|
+
validations[attribute] = {
|
370
|
+
optional: optional,
|
371
|
+
type: type,
|
372
|
+
proc: build_validation_proc(optional, type)
|
373
|
+
}
|
374
|
+
end
|
375
|
+
|
376
|
+
private
|
377
|
+
|
378
|
+
def build_validation_proc(optional, type)
|
379
|
+
case type
|
380
|
+
when :numeric
|
381
|
+
->(value) do
|
382
|
+
if optional && value.nil?
|
383
|
+
true
|
384
|
+
else
|
385
|
+
unless value.is_a?(Numeric)
|
386
|
+
message = "must be a Numeric"
|
387
|
+
message += " or nil" if optional
|
388
|
+
|
389
|
+
{ error: message, value: value }
|
390
|
+
else
|
391
|
+
true
|
392
|
+
end
|
393
|
+
end
|
394
|
+
end
|
395
|
+
else
|
396
|
+
->(value) { true }
|
397
|
+
end
|
398
|
+
end
|
363
399
|
end
|
364
400
|
|
401
|
+
validate :traces_sample_rate, optional: true, type: :numeric
|
402
|
+
validate :profiles_sample_rate, optional: true, type: :numeric
|
403
|
+
|
365
404
|
def initialize
|
366
405
|
self.app_dirs_pattern = APP_DIRS_PATTERN
|
367
406
|
self.debug = Sentry::Utils::EnvHelper.env_to_bool(ENV["SENTRY_DEBUG"])
|
@@ -417,6 +456,24 @@ module Sentry
|
|
417
456
|
run_post_initialization_callbacks
|
418
457
|
end
|
419
458
|
|
459
|
+
def validate
|
460
|
+
if profiler_class == Sentry::Profiler && profiles_sample_rate && !Sentry.dependency_installed?(:StackProf)
|
461
|
+
log_warn("Please add the 'stackprof' gem to your Gemfile to use the StackProf profiler with Sentry.")
|
462
|
+
end
|
463
|
+
|
464
|
+
if profiler_class == Sentry::Vernier::Profiler && profiles_sample_rate && !Sentry.dependency_installed?(:Vernier)
|
465
|
+
log_warn("Please add the 'vernier' gem to your Gemfile to use the Vernier profiler with Sentry.")
|
466
|
+
end
|
467
|
+
|
468
|
+
self.class.validations.each do |attribute, validation|
|
469
|
+
value = public_send(attribute)
|
470
|
+
|
471
|
+
next if (result = validation[:proc].call(value)) === true
|
472
|
+
|
473
|
+
raise ArgumentError, result[:error]
|
474
|
+
end
|
475
|
+
end
|
476
|
+
|
420
477
|
def dsn=(value)
|
421
478
|
@dsn = init_dsn(value)
|
422
479
|
end
|
@@ -489,18 +546,11 @@ module Sentry
|
|
489
546
|
@traces_sample_rate ||= 1.0 if enable_tracing
|
490
547
|
end
|
491
548
|
|
492
|
-
def is_numeric_or_nil?(value)
|
493
|
-
value.is_a?(Numeric) || value.nil?
|
494
|
-
end
|
495
|
-
|
496
549
|
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
550
|
@traces_sample_rate = traces_sample_rate
|
499
551
|
end
|
500
552
|
|
501
553
|
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
554
|
@profiles_sample_rate = profiles_sample_rate
|
505
555
|
end
|
506
556
|
|
@@ -509,7 +559,6 @@ module Sentry
|
|
509
559
|
begin
|
510
560
|
require "vernier"
|
511
561
|
rescue LoadError
|
512
|
-
raise ArgumentError, "Please add the 'vernier' gem to your Gemfile to use the Vernier profiler with Sentry."
|
513
562
|
end
|
514
563
|
end
|
515
564
|
|
data/lib/sentry/version.rb
CHANGED
data/lib/sentry-ruby.rb
CHANGED
@@ -232,6 +232,7 @@ module Sentry
|
|
232
232
|
yield(config) if block_given?
|
233
233
|
config.detect_release
|
234
234
|
apply_patches(config)
|
235
|
+
config.validate
|
235
236
|
client = Client.new(config)
|
236
237
|
scope = Scope.new(max_breadcrumbs: config.max_breadcrumbs)
|
237
238
|
hub = Hub.new(client, scope)
|
@@ -608,6 +609,11 @@ module Sentry
|
|
608
609
|
def utc_now
|
609
610
|
Time.now.utc
|
610
611
|
end
|
612
|
+
|
613
|
+
# @!visibility private
|
614
|
+
def dependency_installed?(name)
|
615
|
+
Object.const_defined?(name)
|
616
|
+
end
|
611
617
|
end
|
612
618
|
end
|
613
619
|
|
metadata
CHANGED
@@ -1,13 +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.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sentry Team
|
8
8
|
bindir: bin
|
9
9
|
cert_chain: []
|
10
|
-
date: 2025-
|
10
|
+
date: 2025-02-06 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: concurrent-ruby
|
@@ -150,15 +150,15 @@ files:
|
|
150
150
|
- lib/sentry/version.rb
|
151
151
|
- sentry-ruby-core.gemspec
|
152
152
|
- sentry-ruby.gemspec
|
153
|
-
homepage: https://github.com/getsentry/sentry-ruby/tree/5.22.
|
153
|
+
homepage: https://github.com/getsentry/sentry-ruby/tree/5.22.4/sentry-ruby
|
154
154
|
licenses:
|
155
155
|
- MIT
|
156
156
|
metadata:
|
157
|
-
homepage_uri: https://github.com/getsentry/sentry-ruby/tree/5.22.
|
158
|
-
source_code_uri: https://github.com/getsentry/sentry-ruby/tree/5.22.
|
159
|
-
changelog_uri: https://github.com/getsentry/sentry-ruby/blob/5.22.
|
157
|
+
homepage_uri: https://github.com/getsentry/sentry-ruby/tree/5.22.4/sentry-ruby
|
158
|
+
source_code_uri: https://github.com/getsentry/sentry-ruby/tree/5.22.4/sentry-ruby
|
159
|
+
changelog_uri: https://github.com/getsentry/sentry-ruby/blob/5.22.4/CHANGELOG.md
|
160
160
|
bug_tracker_uri: https://github.com/getsentry/sentry-ruby/issues
|
161
|
-
documentation_uri: http://www.rubydoc.info/gems/sentry-ruby/5.22.
|
161
|
+
documentation_uri: http://www.rubydoc.info/gems/sentry-ruby/5.22.4
|
162
162
|
rdoc_options: []
|
163
163
|
require_paths:
|
164
164
|
- lib
|