sentry-ruby-core 4.7.3 → 4.8.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/.yardopts +2 -0
- data/Gemfile +6 -2
- data/README.md +7 -7
- data/bin/console +5 -1
- data/lib/sentry/background_worker.rb +30 -2
- data/lib/sentry/backtrace.rb +1 -0
- data/lib/sentry/breadcrumb/sentry_logger.rb +2 -0
- data/lib/sentry/breadcrumb.rb +2 -0
- data/lib/sentry/breadcrumb_buffer.rb +2 -0
- data/lib/sentry/client.rb +13 -1
- data/lib/sentry/configuration.rb +136 -112
- data/lib/sentry/core_ext/object/deep_dup.rb +2 -0
- data/lib/sentry/core_ext/object/duplicable.rb +1 -0
- data/lib/sentry/dsn.rb +2 -0
- data/lib/sentry/envelope.rb +26 -0
- data/lib/sentry/event.rb +5 -0
- data/lib/sentry/exceptions.rb +2 -0
- data/lib/sentry/hub.rb +7 -0
- data/lib/sentry/integrable.rb +2 -0
- data/lib/sentry/interface.rb +2 -0
- data/lib/sentry/interfaces/exception.rb +2 -0
- data/lib/sentry/interfaces/single_exception.rb +31 -0
- data/lib/sentry/interfaces/stacktrace.rb +10 -0
- data/lib/sentry/interfaces/stacktrace_builder.rb +2 -0
- data/lib/sentry/interfaces/threads.rb +2 -0
- data/lib/sentry/linecache.rb +3 -0
- data/lib/sentry/net/http.rb +3 -0
- data/lib/sentry/rack/capture_exceptions.rb +2 -0
- data/lib/sentry/rack.rb +2 -0
- data/lib/sentry/rake.rb +16 -6
- data/lib/sentry/release_detector.rb +39 -0
- data/lib/sentry/scope.rb +8 -4
- data/lib/sentry/span.rb +1 -0
- data/lib/sentry/transaction.rb +6 -1
- data/lib/sentry/transport/configuration.rb +2 -0
- data/lib/sentry/transport/dummy_transport.rb +2 -0
- data/lib/sentry/transport/http_transport.rb +6 -4
- data/lib/sentry/transport.rb +77 -19
- data/lib/sentry/utils/argument_checking_helper.rb +2 -0
- data/lib/sentry/utils/custom_inspection.rb +14 -0
- data/lib/sentry/utils/exception_cause_chain.rb +10 -10
- data/lib/sentry/utils/logging_helper.rb +2 -0
- data/lib/sentry/utils/real_ip.rb +2 -0
- data/lib/sentry/utils/request_id.rb +2 -0
- data/lib/sentry/version.rb +3 -1
- data/lib/sentry-ruby.rb +102 -28
- data/sentry-ruby.gemspec +1 -1
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8b41956862e17f8b60319bac7a72b253889aad50b0518b4dd119bcc5da246c2c
|
4
|
+
data.tar.gz: 8e37db5f09d89bf1382e89744ae2a4c3a5112d4d0a5aa3f105b754974cb5d1a7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9603b5d16ee470d52fa2052a7f9156c7a2e709d906e7299e661648bec6ab56b1c076de19c8b9ea37a97dafc0f21f59dc12898e2b1bde02d14de4e725d5aa1120
|
7
|
+
data.tar.gz: 2c511329f550a6d9c495b55d9e40731d55e953ffc9632dcdcbfcc88266edc95287fc7d912161b853421ec0e281e9dc6dc1574d4523939b92d1c08cca569e7185
|
data/.yardopts
ADDED
data/Gemfile
CHANGED
@@ -10,13 +10,17 @@ gem "rspec", "~> 3.0"
|
|
10
10
|
gem "rspec-retry"
|
11
11
|
gem "webmock"
|
12
12
|
gem "timecop"
|
13
|
-
gem
|
13
|
+
gem 'simplecov'
|
14
|
+
gem "simplecov-cobertura", "~> 1.4"
|
15
|
+
gem "rexml"
|
14
16
|
|
15
17
|
gem "object_tracer"
|
16
|
-
gem "debug", github: "ruby/debug" if RUBY_VERSION.to_f >= 2.6
|
18
|
+
gem "debug", github: "ruby/debug", platform: :ruby if RUBY_VERSION.to_f >= 2.6
|
17
19
|
gem "pry"
|
18
20
|
|
19
21
|
gem "benchmark-ips"
|
20
22
|
gem "benchmark_driver"
|
21
23
|
gem "benchmark-ipsa"
|
22
24
|
gem "benchmark-memory"
|
25
|
+
|
26
|
+
gem "yard", "~> 0.9.27"
|
data/README.md
CHANGED
@@ -10,13 +10,13 @@ _Bad software is everywhere, and we're tired of it. Sentry is on a mission to he
|
|
10
10
|
Sentry SDK for Ruby
|
11
11
|
===========
|
12
12
|
|
13
|
-
| current version | build | coverage | downloads |
|
14
|
-
| --- | ----- | -------- | --------- |
|
15
|
-
| [](https://rubygems.org/gems/sentry-ruby) | [](https://github.com/getsentry/sentry-ruby/actions/workflows/sentry_ruby_test.yml) | [](https://codecov.io/gh/getsentry/sentry-ruby/branch/master) | [](https://rubygems.org/gems/sentry-ruby/) |
|
16
|
-
| [](https://rubygems.org/gems/sentry-rails) | [](https://github.com/getsentry/sentry-ruby/actions/workflows/sentry_rails_test.yml) | [](https://codecov.io/gh/getsentry/sentry-ruby/branch/master) | [](https://rubygems.org/gems/sentry-rails/) |
|
17
|
-
| [](https://rubygems.org/gems/sentry-sidekiq) | [](https://github.com/getsentry/sentry-ruby/actions/workflows/sentry_sidekiq_test.yml) | [](https://codecov.io/gh/getsentry/sentry-ruby/branch/master) | [](https://rubygems.org/gems/sentry-sidekiq/) |
|
18
|
-
| [](https://rubygems.org/gems/sentry-delayed_job) | [](https://github.com/getsentry/sentry-ruby/actions/workflows/sentry_delayed_job_test.yml) | [](https://codecov.io/gh/getsentry/sentry-ruby/branch/master) | [](https://rubygems.org/gems/sentry-delayed_job/) |
|
19
|
-
| [](https://rubygems.org/gems/sentry-resque) | [](https://github.com/getsentry/sentry-ruby/actions/workflows/sentry_resque_test.yml) | [](https://codecov.io/gh/getsentry/sentry-ruby/branch/master) | [](https://rubygems.org/gems/sentry-resque/) |
|
13
|
+
| current version | build | coverage | downloads |
|
14
|
+
| --- | ----- | -------- | --------- |
|
15
|
+
| [](https://rubygems.org/gems/sentry-ruby) | [](https://github.com/getsentry/sentry-ruby/actions/workflows/sentry_ruby_test.yml) | [](https://codecov.io/gh/getsentry/sentry-ruby/branch/master) | [](https://rubygems.org/gems/sentry-ruby/) |
|
16
|
+
| [](https://rubygems.org/gems/sentry-rails) | [](https://github.com/getsentry/sentry-ruby/actions/workflows/sentry_rails_test.yml) | [](https://codecov.io/gh/getsentry/sentry-ruby/branch/master) | [](https://rubygems.org/gems/sentry-rails/) |
|
17
|
+
| [](https://rubygems.org/gems/sentry-sidekiq) | [](https://github.com/getsentry/sentry-ruby/actions/workflows/sentry_sidekiq_test.yml) | [](https://codecov.io/gh/getsentry/sentry-ruby/branch/master) | [](https://rubygems.org/gems/sentry-sidekiq/) |
|
18
|
+
| [](https://rubygems.org/gems/sentry-delayed_job) | [](https://github.com/getsentry/sentry-ruby/actions/workflows/sentry_delayed_job_test.yml) | [](https://codecov.io/gh/getsentry/sentry-ruby/branch/master) | [](https://rubygems.org/gems/sentry-delayed_job/) |
|
19
|
+
| [](https://rubygems.org/gems/sentry-resque) | [](https://github.com/getsentry/sentry-ruby/actions/workflows/sentry_resque_test.yml) | [](https://codecov.io/gh/getsentry/sentry-ruby/branch/master) | [](https://rubygems.org/gems/sentry-resque/) |
|
20
20
|
|
21
21
|
|
22
22
|
|
data/bin/console
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
require "bundler/setup"
|
4
|
-
require "sentry
|
4
|
+
require "sentry-ruby"
|
5
5
|
|
6
6
|
# You can add fixtures and/or initialization code here to make experimenting
|
7
7
|
# with your gem easier. You can also use a different console, if you like.
|
@@ -10,5 +10,9 @@ require "sentry/ruby"
|
|
10
10
|
# require "pry"
|
11
11
|
# Pry.start
|
12
12
|
|
13
|
+
# Sentry.init do |config|
|
14
|
+
# config.dsn = 'https://2fb45f003d054a7ea47feb45898f7649@o447951.ingest.sentry.io/5434472'
|
15
|
+
# end
|
16
|
+
|
13
17
|
require "irb"
|
14
18
|
IRB.start(__FILE__)
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require "concurrent/executor/thread_pool_executor"
|
2
4
|
require "concurrent/executor/immediate_executor"
|
3
5
|
require "concurrent/configuration"
|
@@ -7,11 +9,15 @@ module Sentry
|
|
7
9
|
include LoggingHelper
|
8
10
|
|
9
11
|
attr_reader :max_queue, :number_of_threads, :logger
|
12
|
+
attr_accessor :shutdown_timeout
|
10
13
|
|
11
14
|
def initialize(configuration)
|
12
15
|
@max_queue = 30
|
16
|
+
@shutdown_timeout = 1
|
13
17
|
@number_of_threads = configuration.background_worker_threads
|
14
18
|
@logger = configuration.logger
|
19
|
+
@debug = configuration.debug
|
20
|
+
@shutdown_callback = nil
|
15
21
|
|
16
22
|
@executor =
|
17
23
|
if configuration.async
|
@@ -23,19 +29,41 @@ module Sentry
|
|
23
29
|
else
|
24
30
|
log_debug("initialized a background worker with #{@number_of_threads} threads")
|
25
31
|
|
26
|
-
Concurrent::ThreadPoolExecutor.new(
|
32
|
+
executor = Concurrent::ThreadPoolExecutor.new(
|
27
33
|
min_threads: 0,
|
28
34
|
max_threads: @number_of_threads,
|
29
35
|
max_queue: @max_queue,
|
30
36
|
fallback_policy: :discard
|
31
37
|
)
|
38
|
+
|
39
|
+
@shutdown_callback = proc do
|
40
|
+
executor.shutdown
|
41
|
+
executor.wait_for_termination(@shutdown_timeout)
|
42
|
+
end
|
43
|
+
|
44
|
+
executor
|
32
45
|
end
|
33
46
|
end
|
34
47
|
|
48
|
+
# if you want to monkey-patch this method, please override `_perform` instead
|
35
49
|
def perform(&block)
|
36
50
|
@executor.post do
|
37
|
-
|
51
|
+
begin
|
52
|
+
_perform(&block)
|
53
|
+
rescue Exception => e
|
54
|
+
log_error("exception happened in background worker", e, debug: @debug)
|
55
|
+
end
|
38
56
|
end
|
39
57
|
end
|
58
|
+
|
59
|
+
def shutdown
|
60
|
+
@shutdown_callback&.call
|
61
|
+
end
|
62
|
+
|
63
|
+
private
|
64
|
+
|
65
|
+
def _perform(&block)
|
66
|
+
block.call
|
67
|
+
end
|
40
68
|
end
|
41
69
|
end
|
data/lib/sentry/backtrace.rb
CHANGED
data/lib/sentry/breadcrumb.rb
CHANGED
data/lib/sentry/client.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require "sentry/transport"
|
2
4
|
|
3
5
|
module Sentry
|
@@ -26,17 +28,25 @@ module Sentry
|
|
26
28
|
def capture_event(event, scope, hint = {})
|
27
29
|
return unless configuration.sending_allowed?
|
28
30
|
|
31
|
+
unless event.is_a?(TransactionEvent) || configuration.sample_allowed?
|
32
|
+
transport.record_lost_event(:sample_rate, 'event')
|
33
|
+
return
|
34
|
+
end
|
35
|
+
|
36
|
+
event_type = event.is_a?(Event) ? event.type : event["type"]
|
29
37
|
event = scope.apply_to_event(event, hint)
|
30
38
|
|
31
39
|
if event.nil?
|
32
40
|
log_info("Discarded event because one of the event processors returned nil")
|
41
|
+
transport.record_lost_event(:event_processor, event_type)
|
33
42
|
return
|
34
43
|
end
|
35
44
|
|
36
45
|
if async_block = configuration.async
|
37
46
|
dispatch_async_event(async_block, event, hint)
|
38
47
|
elsif configuration.background_worker_threads != 0 && hint.fetch(:background, true)
|
39
|
-
dispatch_background_event(event, hint)
|
48
|
+
queued = dispatch_background_event(event, hint)
|
49
|
+
transport.record_lost_event(:queue_overflow, event_type) unless queued
|
40
50
|
else
|
41
51
|
send_event(event, hint)
|
42
52
|
end
|
@@ -84,6 +94,7 @@ module Sentry
|
|
84
94
|
|
85
95
|
if event.nil?
|
86
96
|
log_info("Discarded event because before_send returned nil")
|
97
|
+
transport.record_lost_event(:before_send, 'event')
|
87
98
|
return
|
88
99
|
end
|
89
100
|
end
|
@@ -97,6 +108,7 @@ module Sentry
|
|
97
108
|
|
98
109
|
event_info = Event.get_log_message(event.to_hash)
|
99
110
|
log_info("Unreported #{loggable_event_type}: #{event_info}")
|
111
|
+
transport.record_lost_event(:network_error, event_type)
|
100
112
|
raise
|
101
113
|
end
|
102
114
|
|