airbrake-ruby 4.13.1-java → 4.13.2-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/airbrake-ruby.rb +0 -1
- data/lib/airbrake-ruby/async_sender.rb +6 -29
- data/lib/airbrake-ruby/notice.rb +1 -1
- data/lib/airbrake-ruby/notice_notifier.rb +1 -1
- data/lib/airbrake-ruby/thread_pool.rb +9 -1
- data/lib/airbrake-ruby/version.rb +1 -1
- data/spec/async_sender_spec.rb +0 -9
- data/spec/thread_pool_spec.rb +9 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8d2c5667a0276760d3b310122a798f99a8bbdde299048cab9e36de60939794ed
|
4
|
+
data.tar.gz: a5b264fb9ac50c258bd7f239af074b20b8bd1515a9a94241f98c602d700d5255
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bea1b4da4930c3c1a700d016c64e6484bc4213f09950ba13434da8035979fed165f664d52c610ffbf31b6e35a2a6133e165a4244a6c0f17c4364b0ba37f6f28c
|
7
|
+
data.tar.gz: 39b6d21b0007e6e14f31903a82d8871f45a47a6d27ecef6df65cff7ba6db95ae2b4e81a8bb84e227b2f65cf7ed2cc6fe06bf1b3c2dc880f3423232a25d39224a
|
data/lib/airbrake-ruby.rb
CHANGED
@@ -7,12 +7,6 @@ module Airbrake
|
|
7
7
|
class AsyncSender
|
8
8
|
include Loggable
|
9
9
|
|
10
|
-
# @return [String]
|
11
|
-
WILL_NOT_DELIVER_MSG =
|
12
|
-
"%<log_label>s AsyncSender has reached its capacity of %<capacity>s " \
|
13
|
-
"and the following notice will not be delivered " \
|
14
|
-
"Error: %<type>s - %<message>s\nBacktrace: %<backtrace>s\n".freeze
|
15
|
-
|
16
10
|
def initialize(method = :post)
|
17
11
|
@config = Airbrake::Config.instance
|
18
12
|
@method = method
|
@@ -20,12 +14,13 @@ module Airbrake
|
|
20
14
|
|
21
15
|
# Asynchronously sends a notice to Airbrake.
|
22
16
|
#
|
23
|
-
# @param [
|
24
|
-
# library
|
17
|
+
# @param [Hash] payload Whatever needs to be sent
|
25
18
|
# @return [Airbrake::Promise]
|
26
|
-
def send(
|
27
|
-
unless thread_pool << [
|
28
|
-
return
|
19
|
+
def send(payload, promise, endpoint = @config.endpoint)
|
20
|
+
unless thread_pool << [payload, promise, endpoint]
|
21
|
+
return promise.reject(
|
22
|
+
"AsyncSender has reached its capacity of #{@config.queue_size}",
|
23
|
+
)
|
29
24
|
end
|
30
25
|
|
31
26
|
promise
|
@@ -58,23 +53,5 @@ module Airbrake
|
|
58
53
|
)
|
59
54
|
end
|
60
55
|
end
|
61
|
-
|
62
|
-
def will_not_deliver(notice, promise)
|
63
|
-
error = notice[:errors].first
|
64
|
-
|
65
|
-
logger.error(
|
66
|
-
format(
|
67
|
-
WILL_NOT_DELIVER_MSG,
|
68
|
-
log_label: LOG_LABEL,
|
69
|
-
capacity: @config.queue_size,
|
70
|
-
type: error[:type],
|
71
|
-
message: error[:message],
|
72
|
-
backtrace: error[:backtrace].map do |line|
|
73
|
-
"#{line[:file]}:#{line[:line]} in `#{line[:function]}'"
|
74
|
-
end.join("\n"),
|
75
|
-
),
|
76
|
-
)
|
77
|
-
promise.reject("AsyncSender has reached its capacity of #{@config.queue_size}")
|
78
|
-
end
|
79
56
|
end
|
80
57
|
end
|
data/lib/airbrake-ruby/notice.rb
CHANGED
@@ -9,7 +9,7 @@ module Airbrake
|
|
9
9
|
# @return [Array<Class>] filters to be executed first
|
10
10
|
DEFAULT_FILTERS = [
|
11
11
|
Airbrake::Filters::SystemExitFilter,
|
12
|
-
Airbrake::Filters::GemRootFilter
|
12
|
+
Airbrake::Filters::GemRootFilter,
|
13
13
|
|
14
14
|
# Optional filters (must be included by users):
|
15
15
|
# Airbrake::Filters::ThreadFilter
|
@@ -45,7 +45,15 @@ module Airbrake
|
|
45
45
|
# @return [Boolean] true if the message was successfully sent to the pool,
|
46
46
|
# false if the queue is full
|
47
47
|
def <<(message)
|
48
|
-
|
48
|
+
if backlog >= @queue_size
|
49
|
+
logger.error(
|
50
|
+
"#{LOG_LABEL} ThreadPool has reached its capacity of " \
|
51
|
+
"#{@queue_size} and the following message will not be " \
|
52
|
+
"processed: #{message.inspect}",
|
53
|
+
)
|
54
|
+
return false
|
55
|
+
end
|
56
|
+
|
49
57
|
@queue << message
|
50
58
|
true
|
51
59
|
end
|
data/spec/async_sender_spec.rb
CHANGED
@@ -58,15 +58,6 @@ RSpec.describe Airbrake::AsyncSender do
|
|
58
58
|
'error' => "AsyncSender has reached its capacity of 1",
|
59
59
|
)
|
60
60
|
end
|
61
|
-
|
62
|
-
it "logs discarded notice" do
|
63
|
-
expect(Airbrake::Loggable.instance).to receive(:error).with(
|
64
|
-
/reached its capacity/,
|
65
|
-
).at_least(:once)
|
66
|
-
|
67
|
-
15.times { subject.send(notice, Airbrake::Promise.new) }
|
68
|
-
subject.close
|
69
|
-
end
|
70
61
|
end
|
71
62
|
end
|
72
63
|
end
|
data/spec/thread_pool_spec.rb
CHANGED
@@ -51,6 +51,15 @@ RSpec.describe Airbrake::ThreadPool do
|
|
51
51
|
|
52
52
|
expect(tasks.size).to be_zero
|
53
53
|
end
|
54
|
+
|
55
|
+
it "logs discarded tasks" do
|
56
|
+
expect(Airbrake::Loggable.instance).to receive(:error).with(
|
57
|
+
/reached its capacity/,
|
58
|
+
).exactly(15).times
|
59
|
+
|
60
|
+
15.times { subject << 1 }
|
61
|
+
subject.close
|
62
|
+
end
|
54
63
|
end
|
55
64
|
end
|
56
65
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: airbrake-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.13.
|
4
|
+
version: 4.13.2
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Airbrake Technologies, Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-02-
|
11
|
+
date: 2020-02-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rbtree-jruby
|