logstash-core 5.0.0.alpha3.snapshot2-java → 5.0.0.alpha3.snapshot4-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/version.rb +1 -1
- data/lib/logstash/agent.rb +49 -31
- data/lib/logstash/api/init.ru +3 -3
- data/lib/logstash/api/lib/app/service.rb +1 -1
- data/lib/logstash/config/config_ast.rb +23 -18
- data/lib/logstash/config/loader.rb +4 -4
- data/lib/logstash/config/mixin.rb +10 -21
- data/lib/logstash/environment.rb +30 -0
- data/lib/logstash/filters/base.rb +2 -2
- data/lib/logstash/inputs/base.rb +2 -2
- data/lib/logstash/instrument/collector.rb +1 -1
- data/lib/logstash/logging/json.rb +21 -0
- data/lib/logstash/output_delegator.rb +2 -2
- data/lib/logstash/patches/clamp.rb +69 -0
- data/lib/logstash/pipeline.rb +37 -62
- data/lib/logstash/plugin.rb +1 -1
- data/lib/logstash/runner.rb +155 -146
- data/lib/logstash/settings.rb +267 -0
- data/lib/logstash/util/decorators.rb +6 -6
- data/lib/logstash/util/java_version.rb +1 -10
- data/lib/logstash/util/worker_threads_default_printer.rb +2 -2
- data/lib/logstash/version.rb +1 -1
- data/locales/en.yml +17 -20
- data/logstash-core.gemspec +1 -1
- data/spec/api/spec_helper.rb +15 -16
- data/spec/conditionals_spec.rb +113 -113
- data/spec/logstash/agent_spec.rb +77 -68
- data/spec/logstash/config/config_ast_spec.rb +4 -2
- data/spec/logstash/config/mixin_spec.rb +33 -7
- data/spec/logstash/filters/base_spec.rb +16 -16
- data/spec/logstash/inputs/base_spec.rb +8 -8
- data/spec/logstash/output_delegator_spec.rb +2 -0
- data/spec/logstash/pipeline_spec.rb +60 -26
- data/spec/logstash/plugin_spec.rb +2 -2
- data/spec/logstash/runner_spec.rb +112 -25
- data/spec/logstash/setting_spec.rb +130 -0
- data/spec/logstash/settings_spec.rb +62 -0
- metadata +11 -9
- data/lib/logstash/util/defaults_printer.rb +0 -31
- data/spec/logstash/util/defaults_printer_spec.rb +0 -50
- data/spec/logstash/util/worker_threads_default_printer_spec.rb +0 -45
@@ -1,31 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
require "logstash/namespace"
|
3
|
-
require "logstash/util"
|
4
|
-
require "logstash/util/worker_threads_default_printer"
|
5
|
-
|
6
|
-
|
7
|
-
# This class exists to format the settings for defaults used
|
8
|
-
module LogStash module Util class DefaultsPrinter
|
9
|
-
def self.print(settings)
|
10
|
-
new(settings).print
|
11
|
-
end
|
12
|
-
|
13
|
-
def initialize(settings)
|
14
|
-
@settings = settings
|
15
|
-
@printers = [workers]
|
16
|
-
end
|
17
|
-
|
18
|
-
def print
|
19
|
-
collector = []
|
20
|
-
@printers.each do |printer|
|
21
|
-
printer.visit(collector)
|
22
|
-
end
|
23
|
-
"Settings: " + collector.join(', ')
|
24
|
-
end
|
25
|
-
|
26
|
-
private
|
27
|
-
|
28
|
-
def workers
|
29
|
-
WorkerThreadsDefaultPrinter.new(@settings)
|
30
|
-
end
|
31
|
-
end end end
|
@@ -1,50 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
require "spec_helper"
|
3
|
-
require "logstash/util/defaults_printer"
|
4
|
-
|
5
|
-
describe LogStash::Util::DefaultsPrinter do
|
6
|
-
shared_examples "a defaults printer" do
|
7
|
-
it 'the .print method returns a defaults description' do
|
8
|
-
expect(actual_block.call).to eq(expected)
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
12
|
-
let(:workers) { 1 }
|
13
|
-
let(:expected) { "Settings: User set pipeline workers: #{workers}" }
|
14
|
-
let(:settings) { {} }
|
15
|
-
|
16
|
-
describe 'class methods API' do
|
17
|
-
let(:actual_block) do
|
18
|
-
-> {described_class.print(settings)}
|
19
|
-
end
|
20
|
-
|
21
|
-
context 'when the settings hash is empty' do
|
22
|
-
let(:expected) { "Settings: " }
|
23
|
-
it_behaves_like "a defaults printer"
|
24
|
-
end
|
25
|
-
|
26
|
-
context 'when the settings hash has content' do
|
27
|
-
let(:worker_queue) { 42 }
|
28
|
-
let(:settings) { {:pipeline_workers => workers} }
|
29
|
-
it_behaves_like "a defaults printer"
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
describe 'instance method API' do
|
34
|
-
let(:actual_block) do
|
35
|
-
-> {described_class.new(settings).print}
|
36
|
-
end
|
37
|
-
|
38
|
-
context 'when the settings hash is empty' do
|
39
|
-
let(:expected) { "Settings: " }
|
40
|
-
it_behaves_like "a defaults printer"
|
41
|
-
end
|
42
|
-
|
43
|
-
context 'when the settings hash has content' do
|
44
|
-
let(:workers) { 13 }
|
45
|
-
let(:settings) { {:pipeline_workers => workers} }
|
46
|
-
|
47
|
-
it_behaves_like "a defaults printer"
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
@@ -1,45 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
require "spec_helper"
|
3
|
-
require "logstash/util/worker_threads_default_printer"
|
4
|
-
|
5
|
-
describe LogStash::Util::WorkerThreadsDefaultPrinter do
|
6
|
-
let(:settings) { {} }
|
7
|
-
let(:collector) { [] }
|
8
|
-
|
9
|
-
subject { described_class.new(settings) }
|
10
|
-
|
11
|
-
before { subject.visit(collector) }
|
12
|
-
|
13
|
-
describe "the #visit method" do
|
14
|
-
context 'when the settings hash is empty' do
|
15
|
-
it 'adds nothing to the collector' do
|
16
|
-
subject.visit(collector)
|
17
|
-
expect(collector).to eq([])
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
context 'when the settings hash has both user and default content' do
|
22
|
-
let(:settings) { {:pipeline_workers => 42, :default_pipeline_workers => 5} }
|
23
|
-
|
24
|
-
it 'adds two strings' do
|
25
|
-
expect(collector).to eq(["User set pipeline workers: 42", "Default pipeline workers: 5"])
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
context 'when the settings hash has only user content' do
|
30
|
-
let(:settings) { {:pipeline_workers => 42} }
|
31
|
-
|
32
|
-
it 'adds a string with user set pipeline workers' do
|
33
|
-
expect(collector.first).to eq("User set pipeline workers: 42")
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
context 'when the settings hash has only default content' do
|
38
|
-
let(:settings) { {:default_pipeline_workers => 5} }
|
39
|
-
|
40
|
-
it 'adds a string with default pipeline workers' do
|
41
|
-
expect(collector.first).to eq("Default pipeline workers: 5")
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|