logstash-core 6.0.0.alpha1-java → 6.0.0.alpha2-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (75) hide show
  1. checksums.yaml +4 -4
  2. data/lib/logstash-core/logstash-core.jar +0 -0
  3. data/lib/logstash-core/version.rb +1 -1
  4. data/lib/logstash/agent.rb +81 -45
  5. data/lib/logstash/api/commands/hot_threads_reporter.rb +3 -3
  6. data/lib/logstash/api/commands/node.rb +13 -6
  7. data/lib/logstash/api/commands/stats.rb +18 -6
  8. data/lib/logstash/api/modules/node.rb +7 -0
  9. data/lib/logstash/api/modules/node_stats.rb +12 -5
  10. data/lib/logstash/bootstrap_check/default_config.rb +3 -7
  11. data/lib/logstash/compiler.rb +33 -15
  12. data/lib/logstash/compiler/lscl.rb +16 -8
  13. data/lib/logstash/config/mixin.rb +5 -42
  14. data/lib/logstash/config/pipeline_config.rb +1 -1
  15. data/lib/logstash/config/source/local.rb +28 -13
  16. data/lib/logstash/config/source/multi_local.rb +72 -0
  17. data/lib/logstash/config/source_loader.rb +1 -2
  18. data/lib/logstash/environment.rb +12 -3
  19. data/lib/logstash/execution_context.rb +7 -3
  20. data/lib/logstash/inputs/base.rb +2 -0
  21. data/lib/logstash/instrument/metric_type.rb +0 -2
  22. data/lib/logstash/instrument/periodic_poller/jvm.rb +5 -5
  23. data/lib/logstash/instrument/periodic_poller/pq.rb +1 -1
  24. data/lib/logstash/outputs/base.rb +2 -0
  25. data/lib/logstash/pipeline.rb +31 -14
  26. data/lib/logstash/pipeline_action/create.rb +1 -2
  27. data/lib/logstash/pipeline_action/reload.rb +2 -1
  28. data/lib/logstash/pipeline_settings.rb +50 -0
  29. data/lib/logstash/plugin.rb +1 -0
  30. data/lib/logstash/runner.rb +7 -5
  31. data/lib/logstash/settings.rb +11 -3
  32. data/lib/logstash/shutdown_watcher.rb +26 -0
  33. data/lib/logstash/state_resolver.rb +1 -3
  34. data/lib/logstash/util/dead_letter_queue_manager.rb +61 -0
  35. data/lib/logstash/util/environment_variables.rb +43 -0
  36. data/lib/logstash/util/thread_dump.rb +3 -1
  37. data/lib/logstash/version.rb +1 -1
  38. data/locales/en.yml +4 -0
  39. data/logstash-core.gemspec +4 -1
  40. data/spec/logstash/agent/converge_spec.rb +36 -35
  41. data/spec/logstash/agent_spec.rb +48 -177
  42. data/spec/{api/lib/commands/stats.rb → logstash/api/commands/stats_spec.rb} +7 -2
  43. data/spec/{api/lib → logstash/api}/errors_spec.rb +1 -1
  44. data/spec/{api/lib/api → logstash/api/modules}/logging_spec.rb +1 -10
  45. data/spec/{api/lib/api → logstash/api/modules}/node_plugins_spec.rb +1 -2
  46. data/spec/{api/lib/api → logstash/api/modules}/node_spec.rb +9 -8
  47. data/spec/{api/lib/api → logstash/api/modules}/node_stats_spec.rb +11 -9
  48. data/spec/{api/lib/api → logstash/api/modules}/plugins_spec.rb +4 -3
  49. data/spec/{api/lib/api → logstash/api/modules}/root_spec.rb +2 -2
  50. data/spec/{api/lib → logstash/api}/rack_app_spec.rb +0 -0
  51. data/spec/logstash/compiler/compiler_spec.rb +72 -9
  52. data/spec/logstash/config/source/local_spec.rb +20 -4
  53. data/spec/logstash/config/source/multi_local_spec.rb +113 -0
  54. data/spec/logstash/execution_context_spec.rb +14 -4
  55. data/spec/logstash/inputs/base_spec.rb +1 -1
  56. data/spec/logstash/instrument/wrapped_write_client_spec.rb +34 -19
  57. data/spec/logstash/output_delegator_spec.rb +1 -1
  58. data/spec/logstash/outputs/base_spec.rb +1 -1
  59. data/spec/logstash/pipeline_action/reload_spec.rb +1 -1
  60. data/spec/logstash/pipeline_action/stop_spec.rb +1 -1
  61. data/spec/logstash/pipeline_dlq_commit_spec.rb +107 -0
  62. data/spec/logstash/pipeline_pq_file_spec.rb +3 -1
  63. data/spec/logstash/pipeline_reporter_spec.rb +2 -1
  64. data/spec/logstash/pipeline_spec.rb +54 -43
  65. data/spec/logstash/runner_spec.rb +27 -36
  66. data/spec/logstash/settings/array_coercible_spec.rb +65 -0
  67. data/spec/logstash/settings_spec.rb +91 -0
  68. data/spec/logstash/shutdown_watcher_spec.rb +10 -16
  69. data/spec/logstash/state_resolver_spec.rb +6 -4
  70. data/spec/support/helpers.rb +16 -3
  71. data/spec/support/shared_contexts.rb +26 -2
  72. metadata +42 -39
  73. data/lib/logstash/instrument/metric_type/mean.rb +0 -33
  74. data/spec/api/lib/api/support/resource_dsl_methods.rb +0 -87
  75. data/spec/api/spec_helper.rb +0 -106
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.0.0.alpha1
4
+ version: 6.0.0.alpha2
5
5
  platform: java
6
6
  authors:
7
7
  - Elastic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-05-05 00:00:00.000000000 Z
11
+ date: 2017-06-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -94,6 +94,20 @@ dependencies:
94
94
  - - '='
95
95
  - !ruby/object:Gem::Version
96
96
  version: 1.0.0
97
+ - !ruby/object:Gem::Dependency
98
+ requirement: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - '='
101
+ - !ruby/object:Gem::Version
102
+ version: 1.6.6
103
+ name: rack
104
+ prerelease: false
105
+ type: :runtime
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - '='
109
+ - !ruby/object:Gem::Version
110
+ version: 1.6.6
97
111
  - !ruby/object:Gem::Dependency
98
112
  requirement: !ruby/object:Gem::Requirement
99
113
  requirements:
@@ -156,20 +170,6 @@ dependencies:
156
170
  - - '='
157
171
  - !ruby/object:Gem::Version
158
172
  version: 0.10.6
159
- - !ruby/object:Gem::Dependency
160
- requirement: !ruby/object:Gem::Requirement
161
- requirements:
162
- - - "~>"
163
- - !ruby/object:Gem::Version
164
- version: 0.4.2
165
- name: jrmonitor
166
- prerelease: false
167
- type: :runtime
168
- version_requirements: !ruby/object:Gem::Requirement
169
- requirements:
170
- - - "~>"
171
- - !ruby/object:Gem::Version
172
- version: 0.4.2
173
173
  - !ruby/object:Gem::Dependency
174
174
  requirement: !ruby/object:Gem::Requirement
175
175
  requirements:
@@ -333,6 +333,7 @@ files:
333
333
  - lib/logstash/config/pipeline_config.rb
334
334
  - lib/logstash/config/source/base.rb
335
335
  - lib/logstash/config/source/local.rb
336
+ - lib/logstash/config/source/multi_local.rb
336
337
  - lib/logstash/config/source_loader.rb
337
338
  - lib/logstash/converge_result.rb
338
339
  - lib/logstash/environment.rb
@@ -351,7 +352,6 @@ files:
351
352
  - lib/logstash/instrument/metric_type/base.rb
352
353
  - lib/logstash/instrument/metric_type/counter.rb
353
354
  - lib/logstash/instrument/metric_type/gauge.rb
354
- - lib/logstash/instrument/metric_type/mean.rb
355
355
  - lib/logstash/instrument/namespaced_metric.rb
356
356
  - lib/logstash/instrument/namespaced_null_metric.rb
357
357
  - lib/logstash/instrument/null_metric.rb
@@ -392,6 +392,7 @@ files:
392
392
  - lib/logstash/pipeline_action/reload.rb
393
393
  - lib/logstash/pipeline_action/stop.rb
394
394
  - lib/logstash/pipeline_reporter.rb
395
+ - lib/logstash/pipeline_settings.rb
395
396
  - lib/logstash/plugin.rb
396
397
  - lib/logstash/plugins/hooks_registry.rb
397
398
  - lib/logstash/plugins/registry.rb
@@ -408,8 +409,10 @@ files:
408
409
  - lib/logstash/util/buftok.rb
409
410
  - lib/logstash/util/byte_value.rb
410
411
  - lib/logstash/util/charset.rb
412
+ - lib/logstash/util/dead_letter_queue_manager.rb
411
413
  - lib/logstash/util/decorators.rb
412
414
  - lib/logstash/util/duration_formatter.rb
415
+ - lib/logstash/util/environment_variables.rb
413
416
  - lib/logstash/util/filetools.rb
414
417
  - lib/logstash/util/java_version.rb
415
418
  - lib/logstash/util/loggable.rb
@@ -429,22 +432,20 @@ files:
429
432
  - lib/logstash/webserver.rb
430
433
  - locales/en.yml
431
434
  - logstash-core.gemspec
432
- - spec/api/lib/api/logging_spec.rb
433
- - spec/api/lib/api/node_plugins_spec.rb
434
- - spec/api/lib/api/node_spec.rb
435
- - spec/api/lib/api/node_stats_spec.rb
436
- - spec/api/lib/api/plugins_spec.rb
437
- - spec/api/lib/api/root_spec.rb
438
- - spec/api/lib/api/support/resource_dsl_methods.rb
439
- - spec/api/lib/commands/stats.rb
440
- - spec/api/lib/errors_spec.rb
441
- - spec/api/lib/rack_app_spec.rb
442
- - spec/api/spec_helper.rb
443
435
  - spec/conditionals_spec.rb
444
436
  - spec/logstash/acked_queue_concurrent_stress_spec.rb
445
437
  - spec/logstash/agent/converge_spec.rb
446
438
  - spec/logstash/agent/metrics_spec.rb
447
439
  - spec/logstash/agent_spec.rb
440
+ - spec/logstash/api/commands/stats_spec.rb
441
+ - spec/logstash/api/errors_spec.rb
442
+ - spec/logstash/api/modules/logging_spec.rb
443
+ - spec/logstash/api/modules/node_plugins_spec.rb
444
+ - spec/logstash/api/modules/node_spec.rb
445
+ - spec/logstash/api/modules/node_stats_spec.rb
446
+ - spec/logstash/api/modules/plugins_spec.rb
447
+ - spec/logstash/api/modules/root_spec.rb
448
+ - spec/logstash/api/rack_app_spec.rb
448
449
  - spec/logstash/codecs/base_spec.rb
449
450
  - spec/logstash/compiler/compiler_spec.rb
450
451
  - spec/logstash/config/config_ast_spec.rb
@@ -453,6 +454,7 @@ files:
453
454
  - spec/logstash/config/mixin_spec.rb
454
455
  - spec/logstash/config/pipeline_config_spec.rb
455
456
  - spec/logstash/config/source/local_spec.rb
457
+ - spec/logstash/config/source/multi_local_spec.rb
456
458
  - spec/logstash/config/source_loader_spec.rb
457
459
  - spec/logstash/converge_result_spec.rb
458
460
  - spec/logstash/environment_spec.rb
@@ -486,6 +488,7 @@ files:
486
488
  - spec/logstash/pipeline_action/create_spec.rb
487
489
  - spec/logstash/pipeline_action/reload_spec.rb
488
490
  - spec/logstash/pipeline_action/stop_spec.rb
491
+ - spec/logstash/pipeline_dlq_commit_spec.rb
489
492
  - spec/logstash/pipeline_pq_file_spec.rb
490
493
  - spec/logstash/pipeline_reporter_spec.rb
491
494
  - spec/logstash/pipeline_spec.rb
@@ -557,22 +560,20 @@ signing_key:
557
560
  specification_version: 4
558
561
  summary: logstash-core - The core components of logstash
559
562
  test_files:
560
- - spec/api/lib/api/logging_spec.rb
561
- - spec/api/lib/api/node_plugins_spec.rb
562
- - spec/api/lib/api/node_spec.rb
563
- - spec/api/lib/api/node_stats_spec.rb
564
- - spec/api/lib/api/plugins_spec.rb
565
- - spec/api/lib/api/root_spec.rb
566
- - spec/api/lib/api/support/resource_dsl_methods.rb
567
- - spec/api/lib/commands/stats.rb
568
- - spec/api/lib/errors_spec.rb
569
- - spec/api/lib/rack_app_spec.rb
570
- - spec/api/spec_helper.rb
571
563
  - spec/conditionals_spec.rb
572
564
  - spec/logstash/acked_queue_concurrent_stress_spec.rb
573
565
  - spec/logstash/agent/converge_spec.rb
574
566
  - spec/logstash/agent/metrics_spec.rb
575
567
  - spec/logstash/agent_spec.rb
568
+ - spec/logstash/api/commands/stats_spec.rb
569
+ - spec/logstash/api/errors_spec.rb
570
+ - spec/logstash/api/modules/logging_spec.rb
571
+ - spec/logstash/api/modules/node_plugins_spec.rb
572
+ - spec/logstash/api/modules/node_spec.rb
573
+ - spec/logstash/api/modules/node_stats_spec.rb
574
+ - spec/logstash/api/modules/plugins_spec.rb
575
+ - spec/logstash/api/modules/root_spec.rb
576
+ - spec/logstash/api/rack_app_spec.rb
576
577
  - spec/logstash/codecs/base_spec.rb
577
578
  - spec/logstash/compiler/compiler_spec.rb
578
579
  - spec/logstash/config/config_ast_spec.rb
@@ -581,6 +582,7 @@ test_files:
581
582
  - spec/logstash/config/mixin_spec.rb
582
583
  - spec/logstash/config/pipeline_config_spec.rb
583
584
  - spec/logstash/config/source/local_spec.rb
585
+ - spec/logstash/config/source/multi_local_spec.rb
584
586
  - spec/logstash/config/source_loader_spec.rb
585
587
  - spec/logstash/converge_result_spec.rb
586
588
  - spec/logstash/environment_spec.rb
@@ -614,6 +616,7 @@ test_files:
614
616
  - spec/logstash/pipeline_action/create_spec.rb
615
617
  - spec/logstash/pipeline_action/reload_spec.rb
616
618
  - spec/logstash/pipeline_action/stop_spec.rb
619
+ - spec/logstash/pipeline_dlq_commit_spec.rb
617
620
  - spec/logstash/pipeline_pq_file_spec.rb
618
621
  - spec/logstash/pipeline_reporter_spec.rb
619
622
  - spec/logstash/pipeline_spec.rb
@@ -1,33 +0,0 @@
1
- # encoding: utf-8
2
- require "logstash/instrument/metric_type/base"
3
- require "concurrent"
4
-
5
- module LogStash module Instrument module MetricType
6
- class Mean < Base
7
- def initialize(namespaces, key)
8
- super(namespaces, key)
9
-
10
- @counter = Concurrent::AtomicFixnum.new
11
- @sum = Concurrent::AtomicFixnum.new
12
- end
13
-
14
- def increment(value = 1)
15
- @counter.increment
16
- @sum.increment(value)
17
- end
18
-
19
- def decrement(value = 1)
20
- @counter.decrement
21
- @sum.decrement(value)
22
- end
23
-
24
- def mean
25
- if @counter > 0
26
- @sum.value / @counter.value
27
- else
28
- 0
29
- end
30
- end
31
- alias_method :value, :mean
32
- end
33
- end; end; end
@@ -1,87 +0,0 @@
1
- # Ruby doesn't have common class for boolean,
2
- # And to simplify the ResourceDSLMethods check it make sense to have it.
3
- module Boolean; end
4
- class TrueClass
5
- include Boolean
6
- end
7
- class FalseClass
8
- include Boolean
9
- end
10
-
11
- module ResourceDSLMethods
12
- # Convert a nested hash to a mapping of key paths to expected classes
13
- def hash_to_mapping(h, path=[], mapping={})
14
- h.each do |k,v|
15
- if v.is_a?(Hash)
16
- hash_to_mapping(v, path + [k], mapping)
17
- else
18
- full_path = path + [k]
19
- mapping[full_path] = v
20
- end
21
- end
22
- mapping
23
- end
24
-
25
- def test_api(expected, path)
26
- context "GET #{path}" do
27
- let(:payload) { LogStash::Json.load(last_response.body) }
28
-
29
- before(:all) do
30
- get path
31
- end
32
-
33
- it "should respond OK" do
34
- expect(last_response).to be_ok
35
- end
36
-
37
-
38
- describe "the default metadata" do
39
- it "should include the host" do
40
- expect(payload["host"]).to eql(Socket.gethostname)
41
- end
42
-
43
- it "should include the version" do
44
- expect(payload["version"]).to eql(LOGSTASH_CORE_VERSION)
45
- end
46
-
47
- it "should include the http address" do
48
- expect(payload["http_address"]).to eql("#{Socket.gethostname}:#{::LogStash::WebServer::DEFAULT_PORTS.first}")
49
- end
50
-
51
- it "should include the node name" do
52
- expect(payload["name"]).to eql(@runner.agent.name)
53
- end
54
-
55
- it "should include the node id" do
56
- expect(payload["id"]).to eql(@runner.agent.id)
57
- end
58
- end
59
-
60
- hash_to_mapping(expected).each do |resource_path,klass|
61
- dotted = resource_path.join(".")
62
-
63
- it "should set '#{dotted}' at '#{path}' to be a '#{klass}'" do
64
- expect(last_response).to be_ok # fail early if need be
65
- resource_path_value = resource_path.reduce(payload) do |acc,v|
66
- expect(acc.has_key?(v)).to eql(true), "Expected to find value '#{v}' in structure '#{acc}', but could not. Payload was '#{payload}'"
67
- acc[v]
68
- end
69
- expect(resource_path_value).to be_a(klass), "could not find '#{dotted}' in #{payload}"
70
- end
71
- end
72
- end
73
-
74
- yield if block_given? # Add custom expectations
75
- end
76
-
77
- def test_api_and_resources(expected, xopts={})
78
- xopts[:exclude_from_root] ||= []
79
- root_expectation = expected.clone
80
- xopts[:exclude_from_root].each {|k| root_expectation.delete(k)}
81
- test_api(root_expectation, "/")
82
-
83
- expected.keys.each do |key|
84
- test_api({key => expected[key]}, "/#{key}")
85
- end
86
- end
87
- end
@@ -1,106 +0,0 @@
1
- # encoding: utf-8
2
- API_ROOT = File.expand_path(File.join(File.dirname(__FILE__), "..", "..", "lib", "logstash", "api"))
3
-
4
- require "stud/task"
5
- require "logstash/devutils/rspec/spec_helper"
6
- $LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__)))
7
- require "lib/api/support/resource_dsl_methods"
8
- require_relative "../support/mocks_classes"
9
- require_relative "../support/helpers"
10
- require 'rspec/expectations'
11
- require "logstash/settings"
12
- require 'rack/test'
13
- require 'rspec'
14
- require "json"
15
-
16
- def read_fixture(name)
17
- path = File.join(File.dirname(__FILE__), "fixtures", name)
18
- File.read(path)
19
- end
20
-
21
- module LogStash
22
- class DummyAgent < Agent
23
- def start_webserver
24
- http_address = "#{Socket.gethostname}:#{::LogStash::WebServer::DEFAULT_PORTS.first}"
25
- @webserver = Struct.new(:address).new(http_address)
26
- self.metric.gauge([], :http_address, http_address)
27
- end
28
-
29
- def stop_webserver; end
30
- end
31
- end
32
-
33
- ##
34
- # Class used to wrap and manage the execution of an agent for test,
35
- # this helps a lot in order to have a more integrated test for the
36
- # web api, could be also used for other use cases if generalized enough
37
- ##
38
- class LogStashRunner
39
-
40
- attr_reader :config_str, :agent, :pipeline_settings
41
-
42
- def initialize
43
-
44
- require "securerandom"
45
- id = SecureRandom.uuid
46
-
47
- @config_str = "input { generator {id => 'api-generator-pipeline-#{id}' count => 100 } } output { dummyoutput {} }"
48
-
49
- args = {
50
- "config.reload.automatic" => false,
51
- "metric.collect" => true,
52
- "log.level" => "debug",
53
- "node.name" => "test_agent",
54
- "http.port" => rand(9600..9700),
55
- "http.environment" => "test",
56
- "config.string" => @config_str,
57
- "pipeline.batch.size" => 1,
58
- "pipeline.workers" => 1
59
- }
60
-
61
- @settings = ::LogStash::SETTINGS.clone.merge(args)
62
- source_loader = LogStash::Config::SourceLoader.new
63
- source_loader.configure_sources(LogStash::Config::Source::Local.new(@settings))
64
- @agent = LogStash::DummyAgent.new(@settings, source_loader)
65
- end
66
-
67
- def start
68
- # We start a pipeline that will generate a finite number of events
69
- # before starting the expectations
70
- @agent_task = Stud::Task.new { agent.execute }
71
- @agent_task.wait
72
- end
73
-
74
- def stop
75
- agent.shutdown
76
- end
77
- end
78
-
79
- RSpec::Matchers.define :be_available? do
80
- match do |plugin|
81
- begin
82
- Gem::Specification.find_by_name(plugin["name"])
83
- true
84
- rescue
85
- false
86
- end
87
- end
88
- end
89
-
90
- shared_context "api setup" do
91
- before :all do
92
- clear_data_dir
93
- @runner = LogStashRunner.new
94
- @runner.start
95
- end
96
-
97
- after :all do
98
- @runner.stop
99
- end
100
-
101
- include Rack::Test::Methods
102
-
103
- def app()
104
- described_class.new(nil, @runner.agent)
105
- end
106
- end