logstash-core 2.1.3-java → 2.2.0-java
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of logstash-core might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/lib/logstash-core.rb +1 -3
- data/lib/logstash-core/logstash-core.rb +3 -0
- data/lib/logstash-core/version.rb +8 -0
- data/lib/logstash/agent.rb +48 -20
- data/lib/logstash/codecs/base.rb +2 -2
- data/lib/logstash/config/config_ast.rb +8 -3
- data/lib/logstash/environment.rb +0 -16
- data/lib/logstash/filters/base.rb +9 -5
- data/lib/logstash/inputs/base.rb +1 -1
- data/lib/logstash/output_delegator.rb +150 -0
- data/lib/logstash/outputs/base.rb +37 -40
- data/lib/logstash/pipeline.rb +259 -178
- data/lib/logstash/pipeline_reporter.rb +114 -0
- data/lib/logstash/plugin.rb +1 -1
- data/lib/logstash/{shutdown_controller.rb → shutdown_watcher.rb} +10 -37
- data/lib/logstash/util.rb +17 -0
- data/lib/logstash/util/decorators.rb +14 -7
- data/lib/logstash/util/worker_threads_default_printer.rb +4 -4
- data/lib/logstash/util/wrapped_synchronous_queue.rb +41 -0
- data/lib/logstash/version.rb +10 -2
- data/locales/en.yml +8 -3
- data/logstash-core.gemspec +5 -3
- data/spec/{core/conditionals_spec.rb → conditionals_spec.rb} +0 -0
- data/spec/{core/config_spec.rb → logstash/config/config_ast_spec.rb} +0 -0
- data/spec/{core/config_cpu_core_strategy_spec.rb → logstash/config/cpu_core_strategy_spec.rb} +0 -0
- data/spec/{core/config_defaults_spec.rb → logstash/config/defaults_spec.rb} +0 -0
- data/spec/{core/config_mixin_spec.rb → logstash/config/mixin_spec.rb} +0 -0
- data/spec/{core → logstash}/environment_spec.rb +0 -0
- data/spec/{filters → logstash/filters}/base_spec.rb +0 -0
- data/spec/{inputs → logstash/inputs}/base_spec.rb +0 -0
- data/spec/{lib/logstash → logstash}/java_integration_spec.rb +0 -0
- data/spec/{util → logstash}/json_spec.rb +0 -0
- data/spec/logstash/output_delegator_spec.rb +126 -0
- data/spec/logstash/outputs/base_spec.rb +40 -0
- data/spec/logstash/pipeline_reporter_spec.rb +85 -0
- data/spec/{core → logstash}/pipeline_spec.rb +128 -16
- data/spec/{core → logstash}/plugin_spec.rb +47 -1
- data/spec/logstash/runner_spec.rb +68 -0
- data/spec/{core/shutdown_controller_spec.rb → logstash/shutdown_watcher_spec.rb} +17 -11
- data/spec/{util → logstash/util}/buftok_spec.rb +0 -0
- data/spec/{util → logstash/util}/charset_spec.rb +0 -0
- data/spec/{util → logstash/util}/defaults_printer_spec.rb +4 -4
- data/spec/{util → logstash/util}/java_version_spec.rb +0 -0
- data/spec/{util → logstash/util}/plugin_version_spec.rb +0 -0
- data/spec/{util → logstash/util}/unicode_trimmer_spec.rb +0 -0
- data/spec/{util → logstash/util}/worker_threads_default_printer_spec.rb +8 -8
- data/spec/logstash/util/wrapped_synchronous_queue_spec.rb +28 -0
- data/spec/{util_spec.rb → logstash/util_spec.rb} +0 -0
- metadata +74 -81
- data/lib/logstash/event.rb +0 -275
- data/lib/logstash/patches/bundler.rb +0 -36
- data/lib/logstash/sized_queue.rb +0 -8
- data/lib/logstash/string_interpolation.rb +0 -140
- data/lib/logstash/timestamp.rb +0 -97
- data/lib/logstash/util/accessors.rb +0 -123
- data/spec/core/event_spec.rb +0 -518
- data/spec/core/runner_spec.rb +0 -40
- data/spec/core/timestamp_spec.rb +0 -84
- data/spec/coverage_helper.rb +0 -24
- data/spec/lib/logstash/bundler_spec.rb +0 -121
- data/spec/license_spec.rb +0 -67
- data/spec/outputs/base_spec.rb +0 -26
- data/spec/plugin_manager/install_spec.rb +0 -28
- data/spec/plugin_manager/update_spec.rb +0 -39
- data/spec/plugin_manager/util_spec.rb +0 -71
- data/spec/spec_helper.rb +0 -11
- data/spec/util/accessors_spec.rb +0 -170
- data/spec/util/compress_spec.rb +0 -121
- data/spec/util/gemfile_spec.rb +0 -212
- data/spec/util/retryable_spec.rb +0 -139
data/spec/util/retryable_spec.rb
DELETED
@@ -1,139 +0,0 @@
|
|
1
|
-
require "logstash/util/retryable"
|
2
|
-
|
3
|
-
describe LogStash::Retryable do
|
4
|
-
class C
|
5
|
-
include LogStash::Retryable
|
6
|
-
end
|
7
|
-
|
8
|
-
class E < StandardError; end;
|
9
|
-
class F < StandardError; end;
|
10
|
-
|
11
|
-
subject {C.new}
|
12
|
-
|
13
|
-
context "with default fixed 1 second retry sleep" do
|
14
|
-
|
15
|
-
it "should execute once" do
|
16
|
-
expect(subject).to receive(:sleep).never
|
17
|
-
expect(subject.retryable(:rescue => nil){|i| expect(i).to eq(0); "foo"}).to eq("foo")
|
18
|
-
end
|
19
|
-
|
20
|
-
it "should not retry on non rescued exceptions" do
|
21
|
-
i = 0
|
22
|
-
expect(subject).to receive(:sleep).never
|
23
|
-
expect{subject.retryable(:rescue => E){i += 1; raise F}}.to raise_error(F)
|
24
|
-
expect(i).to eq(1)
|
25
|
-
end
|
26
|
-
|
27
|
-
it "should execute once and retry once by default" do
|
28
|
-
i = 0
|
29
|
-
expect(subject).to receive(:sleep).once.with(1)
|
30
|
-
expect{subject.retryable{i += 1; raise E}}.to raise_error(E)
|
31
|
-
expect(i).to eq(2)
|
32
|
-
end
|
33
|
-
|
34
|
-
it "should retry on rescued exceptions" do
|
35
|
-
i = 0
|
36
|
-
expect(subject).to receive(:sleep).once.with(1)
|
37
|
-
expect{subject.retryable(:rescue => E){i += 1; raise E}}.to raise_error(E)
|
38
|
-
expect(i).to eq(2)
|
39
|
-
end
|
40
|
-
|
41
|
-
it "should retry indefinitely" do
|
42
|
-
i = 0
|
43
|
-
expect(subject).to receive(:sleep).exactly(50).times.with(1)
|
44
|
-
expect{subject.retryable(:tries => 0, :rescue => E){i += 1; raise i <= 50 ? E : F}}.to raise_error(F)
|
45
|
-
end
|
46
|
-
|
47
|
-
it "should execute once and retry once by default and execute on_retry callback" do
|
48
|
-
i = 0
|
49
|
-
callback_values = []
|
50
|
-
|
51
|
-
callback = lambda do |retry_count, e|
|
52
|
-
callback_values << [retry_count, e]
|
53
|
-
end
|
54
|
-
|
55
|
-
expect(subject).to receive(:sleep).once.with(1)
|
56
|
-
|
57
|
-
expect do
|
58
|
-
subject.retryable(:on_retry => callback){i += 1; raise E}
|
59
|
-
end.to raise_error
|
60
|
-
|
61
|
-
expect(i).to eq(2)
|
62
|
-
|
63
|
-
expect(callback_values.size).to eq(1)
|
64
|
-
expect(callback_values[0][0]).to eq(1)
|
65
|
-
expect(callback_values[0][1]).to be_a(E)
|
66
|
-
end
|
67
|
-
|
68
|
-
it "should execute once and retry n times" do
|
69
|
-
i = 0
|
70
|
-
n = 3
|
71
|
-
expect(subject).to receive(:sleep).exactly(n).times.with(1)
|
72
|
-
expect{subject.retryable(:tries => n){i += 1; raise E}}.to raise_error(E)
|
73
|
-
expect(i).to eq(n + 1)
|
74
|
-
end
|
75
|
-
|
76
|
-
it "should execute once and retry n times and execute on_retry callback" do
|
77
|
-
i = 0
|
78
|
-
n = 3
|
79
|
-
callback_values = []
|
80
|
-
|
81
|
-
callback = lambda do |retry_count, e|
|
82
|
-
callback_values << [retry_count, e]
|
83
|
-
end
|
84
|
-
|
85
|
-
expect(subject).to receive(:sleep).exactly(n).times.with(1)
|
86
|
-
|
87
|
-
expect do
|
88
|
-
subject.retryable(:tries => n, :on_retry => callback){i += 1; raise E}
|
89
|
-
end.to raise_error
|
90
|
-
|
91
|
-
expect(i).to eq(n + 1)
|
92
|
-
|
93
|
-
expect(callback_values.size).to eq(n)
|
94
|
-
n.times.each do |j|
|
95
|
-
expect(callback_values[j].first).to eq(j + 1)
|
96
|
-
expect(callback_values[j].last).to be_a(E)
|
97
|
-
end
|
98
|
-
end
|
99
|
-
end
|
100
|
-
|
101
|
-
context "with exponential backoff" do
|
102
|
-
|
103
|
-
it "should execute once and retry once with base sleep by default" do
|
104
|
-
expect(subject).to receive(:sleep).once.with(2)
|
105
|
-
expect do
|
106
|
-
subject.retryable(:base_sleep => 2, :max_sleep => 10){raise E}
|
107
|
-
end.to raise_error(E)
|
108
|
-
end
|
109
|
-
|
110
|
-
it "should execute once and retry n times with exponential backoff sleep" do
|
111
|
-
n = 3
|
112
|
-
s = 0.5
|
113
|
-
|
114
|
-
n.times.each do |i|
|
115
|
-
expect(subject).to receive(:sleep).once.with(s * (2 ** i)).ordered
|
116
|
-
end
|
117
|
-
expect do
|
118
|
-
subject.retryable(:tries => n, :base_sleep => s, :max_sleep => 100){raise E}
|
119
|
-
end.to raise_error(E)
|
120
|
-
end
|
121
|
-
|
122
|
-
it "should execute once and retry n times with exponential backoff sleep capping at max_sleep" do
|
123
|
-
n = 20
|
124
|
-
base_sleep = 0.1
|
125
|
-
max_sleep = 1
|
126
|
-
|
127
|
-
expect(subject).to receive(:sleep).once.with(0.1).ordered
|
128
|
-
expect(subject).to receive(:sleep).once.with(0.2).ordered
|
129
|
-
expect(subject).to receive(:sleep).once.with(0.4).ordered
|
130
|
-
expect(subject).to receive(:sleep).once.with(0.8).ordered
|
131
|
-
(n - 4).times.each do |i|
|
132
|
-
expect(subject).to receive(:sleep).once.with(1).ordered
|
133
|
-
end
|
134
|
-
expect do
|
135
|
-
subject.retryable(:tries => n, :base_sleep => base_sleep, :max_sleep => max_sleep){raise E}
|
136
|
-
end.to raise_error(E)
|
137
|
-
end
|
138
|
-
end
|
139
|
-
end
|