sentry-ruby 5.10.0 → 5.16.1
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 -13
- data/README.md +9 -9
- data/lib/sentry/background_worker.rb +8 -1
- data/lib/sentry/backpressure_monitor.rb +75 -0
- data/lib/sentry/breadcrumb.rb +8 -2
- data/lib/sentry/check_in_event.rb +60 -0
- data/lib/sentry/client.rb +48 -10
- data/lib/sentry/configuration.rb +50 -4
- data/lib/sentry/cron/configuration.rb +23 -0
- data/lib/sentry/cron/monitor_check_ins.rb +75 -0
- data/lib/sentry/cron/monitor_config.rb +53 -0
- data/lib/sentry/cron/monitor_schedule.rb +42 -0
- data/lib/sentry/envelope.rb +1 -1
- data/lib/sentry/event.rb +6 -28
- data/lib/sentry/hub.rb +69 -1
- data/lib/sentry/integrable.rb +6 -0
- data/lib/sentry/interfaces/single_exception.rb +5 -3
- data/lib/sentry/net/http.rb +25 -22
- data/lib/sentry/profiler.rb +18 -7
- data/lib/sentry/propagation_context.rb +134 -0
- data/lib/sentry/puma.rb +11 -4
- data/lib/sentry/rack/capture_exceptions.rb +1 -4
- data/lib/sentry/rake.rb +0 -13
- data/lib/sentry/redis.rb +8 -3
- data/lib/sentry/release_detector.rb +1 -1
- data/lib/sentry/scope.rb +29 -13
- data/lib/sentry/span.rb +39 -2
- data/lib/sentry/test_helper.rb +18 -12
- data/lib/sentry/transaction.rb +18 -19
- data/lib/sentry/transaction_event.rb +0 -3
- data/lib/sentry/transport/configuration.rb +74 -1
- data/lib/sentry/transport/http_transport.rb +68 -37
- data/lib/sentry/transport/spotlight_transport.rb +50 -0
- data/lib/sentry/transport.rb +21 -17
- data/lib/sentry/utils/argument_checking_helper.rb +6 -0
- data/lib/sentry/version.rb +1 -1
- data/lib/sentry-ruby.rb +83 -25
- metadata +10 -2
data/lib/sentry/version.rb
CHANGED
data/lib/sentry-ruby.rb
CHANGED
|
@@ -15,11 +15,14 @@ require "sentry/logger"
|
|
|
15
15
|
require "sentry/event"
|
|
16
16
|
require "sentry/error_event"
|
|
17
17
|
require "sentry/transaction_event"
|
|
18
|
+
require "sentry/check_in_event"
|
|
18
19
|
require "sentry/span"
|
|
19
20
|
require "sentry/transaction"
|
|
20
21
|
require "sentry/hub"
|
|
21
22
|
require "sentry/background_worker"
|
|
22
23
|
require "sentry/session_flusher"
|
|
24
|
+
require "sentry/backpressure_monitor"
|
|
25
|
+
require "sentry/cron/monitor_check_ins"
|
|
23
26
|
|
|
24
27
|
[
|
|
25
28
|
"sentry/rake",
|
|
@@ -63,25 +66,29 @@ module Sentry
|
|
|
63
66
|
end
|
|
64
67
|
|
|
65
68
|
# @!attribute [rw] background_worker
|
|
66
|
-
# @return [BackgroundWorker
|
|
69
|
+
# @return [BackgroundWorker]
|
|
67
70
|
attr_accessor :background_worker
|
|
68
71
|
|
|
69
72
|
# @!attribute [r] session_flusher
|
|
70
73
|
# @return [SessionFlusher, nil]
|
|
71
74
|
attr_reader :session_flusher
|
|
72
75
|
|
|
76
|
+
# @!attribute [r] backpressure_monitor
|
|
77
|
+
# @return [BackpressureMonitor, nil]
|
|
78
|
+
attr_reader :backpressure_monitor
|
|
79
|
+
|
|
73
80
|
##### Patch Registration #####
|
|
74
81
|
|
|
75
82
|
# @!visibility private
|
|
76
|
-
def register_patch(patch = nil, target = nil, &block)
|
|
83
|
+
def register_patch(key, patch = nil, target = nil, &block)
|
|
77
84
|
if patch && block
|
|
78
85
|
raise ArgumentError.new("Please provide either a patch and its target OR a block, but not both")
|
|
79
86
|
end
|
|
80
87
|
|
|
81
88
|
if block
|
|
82
|
-
registered_patches
|
|
89
|
+
registered_patches[key] = block
|
|
83
90
|
else
|
|
84
|
-
registered_patches
|
|
91
|
+
registered_patches[key] = proc do
|
|
85
92
|
target.send(:prepend, patch) unless target.ancestors.include?(patch)
|
|
86
93
|
end
|
|
87
94
|
end
|
|
@@ -89,14 +96,14 @@ module Sentry
|
|
|
89
96
|
|
|
90
97
|
# @!visibility private
|
|
91
98
|
def apply_patches(config)
|
|
92
|
-
registered_patches.each do |patch|
|
|
93
|
-
patch.call(config)
|
|
99
|
+
registered_patches.each do |key, patch|
|
|
100
|
+
patch.call(config) if config.enabled_patches.include?(key)
|
|
94
101
|
end
|
|
95
102
|
end
|
|
96
103
|
|
|
97
104
|
# @!visibility private
|
|
98
105
|
def registered_patches
|
|
99
|
-
@registered_patches ||=
|
|
106
|
+
@registered_patches ||= {}
|
|
100
107
|
end
|
|
101
108
|
|
|
102
109
|
##### Integrations #####
|
|
@@ -215,17 +222,9 @@ module Sentry
|
|
|
215
222
|
Thread.current.thread_variable_set(THREAD_LOCAL, hub)
|
|
216
223
|
@main_hub = hub
|
|
217
224
|
@background_worker = Sentry::BackgroundWorker.new(config)
|
|
218
|
-
|
|
219
|
-
@
|
|
220
|
-
|
|
221
|
-
else
|
|
222
|
-
nil
|
|
223
|
-
end
|
|
224
|
-
|
|
225
|
-
if config.include_local_variables
|
|
226
|
-
exception_locals_tp.enable
|
|
227
|
-
end
|
|
228
|
-
|
|
225
|
+
@session_flusher = config.auto_session_tracking ? Sentry::SessionFlusher.new(config, client) : nil
|
|
226
|
+
@backpressure_monitor = config.enable_backpressure_handling ? Sentry::BackpressureMonitor.new(config, client) : nil
|
|
227
|
+
exception_locals_tp.enable if config.include_local_variables
|
|
229
228
|
at_exit { close }
|
|
230
229
|
end
|
|
231
230
|
|
|
@@ -234,20 +233,27 @@ module Sentry
|
|
|
234
233
|
#
|
|
235
234
|
# @return [void]
|
|
236
235
|
def close
|
|
237
|
-
if @background_worker
|
|
238
|
-
@background_worker.shutdown
|
|
239
|
-
@background_worker = nil
|
|
240
|
-
end
|
|
241
|
-
|
|
242
236
|
if @session_flusher
|
|
237
|
+
@session_flusher.flush
|
|
243
238
|
@session_flusher.kill
|
|
244
239
|
@session_flusher = nil
|
|
245
240
|
end
|
|
246
241
|
|
|
247
|
-
if
|
|
248
|
-
|
|
242
|
+
if @backpressure_monitor
|
|
243
|
+
@backpressure_monitor.kill
|
|
244
|
+
@backpressure_monitor = nil
|
|
249
245
|
end
|
|
250
246
|
|
|
247
|
+
if client = get_current_client
|
|
248
|
+
client.transport.flush
|
|
249
|
+
|
|
250
|
+
if client.configuration.include_local_variables
|
|
251
|
+
exception_locals_tp.disable
|
|
252
|
+
end
|
|
253
|
+
end
|
|
254
|
+
|
|
255
|
+
@background_worker.shutdown
|
|
256
|
+
|
|
251
257
|
@main_hub = nil
|
|
252
258
|
Thread.current.thread_variable_set(THREAD_LOCAL, nil)
|
|
253
259
|
end
|
|
@@ -430,6 +436,22 @@ module Sentry
|
|
|
430
436
|
get_current_hub.capture_event(event)
|
|
431
437
|
end
|
|
432
438
|
|
|
439
|
+
# Captures a check-in and sends it to Sentry via the currently active hub.
|
|
440
|
+
#
|
|
441
|
+
# @param slug [String] identifier of this monitor
|
|
442
|
+
# @param status [Symbol] status of this check-in, one of {CheckInEvent::VALID_STATUSES}
|
|
443
|
+
#
|
|
444
|
+
# @param [Hash] options extra check-in options
|
|
445
|
+
# @option options [String] check_in_id for updating the status of an existing monitor
|
|
446
|
+
# @option options [Integer] duration seconds elapsed since this monitor started
|
|
447
|
+
# @option options [Cron::MonitorConfig] monitor_config configuration for this monitor
|
|
448
|
+
#
|
|
449
|
+
# @return [String, nil] The {CheckInEvent#check_in_id} to use for later updates on the same slug
|
|
450
|
+
def capture_check_in(slug, status, **options)
|
|
451
|
+
return unless initialized?
|
|
452
|
+
get_current_hub.capture_check_in(slug, status, **options)
|
|
453
|
+
end
|
|
454
|
+
|
|
433
455
|
# Takes or initializes a new Sentry::Transaction and makes a sampling decision for it.
|
|
434
456
|
#
|
|
435
457
|
# @return [Transaction, nil]
|
|
@@ -489,6 +511,42 @@ module Sentry
|
|
|
489
511
|
Scope.add_global_event_processor(&block)
|
|
490
512
|
end
|
|
491
513
|
|
|
514
|
+
# Returns the traceparent (sentry-trace) header for distributed tracing.
|
|
515
|
+
# Can be either from the currently active span or the propagation context.
|
|
516
|
+
#
|
|
517
|
+
# @return [String, nil]
|
|
518
|
+
def get_traceparent
|
|
519
|
+
return nil unless initialized?
|
|
520
|
+
get_current_hub.get_traceparent
|
|
521
|
+
end
|
|
522
|
+
|
|
523
|
+
# Returns the baggage header for distributed tracing.
|
|
524
|
+
# Can be either from the currently active span or the propagation context.
|
|
525
|
+
#
|
|
526
|
+
# @return [String, nil]
|
|
527
|
+
def get_baggage
|
|
528
|
+
return nil unless initialized?
|
|
529
|
+
get_current_hub.get_baggage
|
|
530
|
+
end
|
|
531
|
+
|
|
532
|
+
# Returns the a Hash containing sentry-trace and baggage.
|
|
533
|
+
# Can be either from the currently active span or the propagation context.
|
|
534
|
+
#
|
|
535
|
+
# @return [Hash, nil]
|
|
536
|
+
def get_trace_propagation_headers
|
|
537
|
+
return nil unless initialized?
|
|
538
|
+
get_current_hub.get_trace_propagation_headers
|
|
539
|
+
end
|
|
540
|
+
|
|
541
|
+
# Continue an incoming trace from a rack env like hash.
|
|
542
|
+
#
|
|
543
|
+
# @param env [Hash]
|
|
544
|
+
# @return [Transaction, nil]
|
|
545
|
+
def continue_trace(env, **options)
|
|
546
|
+
return nil unless initialized?
|
|
547
|
+
get_current_hub.continue_trace(env, **options)
|
|
548
|
+
end
|
|
549
|
+
|
|
492
550
|
##### Helpers #####
|
|
493
551
|
|
|
494
552
|
# @!visibility private
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: sentry-ruby
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 5.
|
|
4
|
+
version: 5.16.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Sentry Team
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2024-01-09 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: concurrent-ruby
|
|
@@ -51,15 +51,21 @@ files:
|
|
|
51
51
|
- bin/setup
|
|
52
52
|
- lib/sentry-ruby.rb
|
|
53
53
|
- lib/sentry/background_worker.rb
|
|
54
|
+
- lib/sentry/backpressure_monitor.rb
|
|
54
55
|
- lib/sentry/backtrace.rb
|
|
55
56
|
- lib/sentry/baggage.rb
|
|
56
57
|
- lib/sentry/breadcrumb.rb
|
|
57
58
|
- lib/sentry/breadcrumb/sentry_logger.rb
|
|
58
59
|
- lib/sentry/breadcrumb_buffer.rb
|
|
60
|
+
- lib/sentry/check_in_event.rb
|
|
59
61
|
- lib/sentry/client.rb
|
|
60
62
|
- lib/sentry/configuration.rb
|
|
61
63
|
- lib/sentry/core_ext/object/deep_dup.rb
|
|
62
64
|
- lib/sentry/core_ext/object/duplicable.rb
|
|
65
|
+
- lib/sentry/cron/configuration.rb
|
|
66
|
+
- lib/sentry/cron/monitor_check_ins.rb
|
|
67
|
+
- lib/sentry/cron/monitor_config.rb
|
|
68
|
+
- lib/sentry/cron/monitor_schedule.rb
|
|
63
69
|
- lib/sentry/dsn.rb
|
|
64
70
|
- lib/sentry/envelope.rb
|
|
65
71
|
- lib/sentry/error_event.rb
|
|
@@ -78,6 +84,7 @@ files:
|
|
|
78
84
|
- lib/sentry/logger.rb
|
|
79
85
|
- lib/sentry/net/http.rb
|
|
80
86
|
- lib/sentry/profiler.rb
|
|
87
|
+
- lib/sentry/propagation_context.rb
|
|
81
88
|
- lib/sentry/puma.rb
|
|
82
89
|
- lib/sentry/rack.rb
|
|
83
90
|
- lib/sentry/rack/capture_exceptions.rb
|
|
@@ -95,6 +102,7 @@ files:
|
|
|
95
102
|
- lib/sentry/transport/configuration.rb
|
|
96
103
|
- lib/sentry/transport/dummy_transport.rb
|
|
97
104
|
- lib/sentry/transport/http_transport.rb
|
|
105
|
+
- lib/sentry/transport/spotlight_transport.rb
|
|
98
106
|
- lib/sentry/utils/argument_checking_helper.rb
|
|
99
107
|
- lib/sentry/utils/custom_inspection.rb
|
|
100
108
|
- lib/sentry/utils/encoding_helper.rb
|