logstash-core 5.0.0.alpha4.snapshot3-java → 5.0.0.alpha5.snapshot1-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.

Files changed (48) hide show
  1. checksums.yaml +4 -4
  2. data/lib/logstash/agent.rb +6 -2
  3. data/lib/logstash/api/app_helpers.rb +15 -0
  4. data/lib/logstash/api/command_factory.rb +3 -1
  5. data/lib/logstash/api/commands/base.rb +3 -5
  6. data/lib/logstash/api/commands/default_metadata.rb +27 -0
  7. data/lib/logstash/api/commands/hot_threads_reporter.rb +61 -0
  8. data/lib/logstash/api/commands/node.rb +9 -63
  9. data/lib/logstash/api/commands/stats.rb +5 -61
  10. data/lib/logstash/api/commands/system/basicinfo_command.rb +3 -6
  11. data/lib/logstash/api/modules/base.rb +3 -1
  12. data/lib/logstash/api/modules/node.rb +8 -18
  13. data/lib/logstash/api/modules/node_stats.rb +5 -41
  14. data/lib/logstash/api/modules/stats.rb +13 -33
  15. data/lib/logstash/build.rb +6 -0
  16. data/lib/logstash/environment.rb +9 -0
  17. data/lib/logstash/filter_delegator.rb +1 -1
  18. data/lib/logstash/instrument/metric.rb +7 -6
  19. data/lib/logstash/instrument/metric_type/base.rb +1 -4
  20. data/lib/logstash/instrument/namespaced_metric.rb +1 -1
  21. data/lib/logstash/instrument/null_metric.rb +6 -1
  22. data/lib/logstash/output_delegator.rb +2 -0
  23. data/lib/logstash/pipeline.rb +62 -93
  24. data/lib/logstash/pipeline_reporter.rb +14 -13
  25. data/lib/logstash/plugin.rb +8 -2
  26. data/lib/logstash/runner.rb +7 -1
  27. data/lib/logstash/settings.rb +17 -7
  28. data/lib/logstash/util/wrapped_synchronous_queue.rb +220 -0
  29. data/lib/logstash/version.rb +1 -1
  30. data/lib/logstash/webserver.rb +4 -0
  31. data/lib/logstash-core/version.rb +1 -1
  32. data/locales/en.yml +4 -0
  33. data/logstash-core.gemspec +2 -2
  34. data/spec/api/lib/api/node_spec.rb +0 -1
  35. data/spec/api/lib/api/node_stats_spec.rb +36 -34
  36. data/spec/api/lib/api/support/resource_dsl_methods.rb +15 -0
  37. data/spec/api/spec_helper.rb +5 -2
  38. data/spec/logstash/inputs/metrics_spec.rb +1 -1
  39. data/spec/logstash/instrument/metric_type/counter_spec.rb +1 -6
  40. data/spec/logstash/instrument/metric_type/gauge_spec.rb +1 -4
  41. data/spec/logstash/instrument/namespaced_metric_spec.rb +61 -2
  42. data/spec/logstash/instrument/null_metric_spec.rb +7 -9
  43. data/spec/logstash/pipeline_spec.rb +7 -7
  44. data/spec/logstash/plugin_spec.rb +73 -0
  45. data/spec/logstash/settings/string_spec.rb +21 -0
  46. data/spec/logstash/util/wrapped_synchronous_queue_spec.rb +70 -22
  47. data/spec/support/shared_examples.rb +98 -0
  48. metadata +11 -4
@@ -0,0 +1,21 @@
1
+ # encoding: utf-8
2
+ require "spec_helper"
3
+ require "logstash/settings"
4
+
5
+ describe LogStash::Setting::String do
6
+ let(:possible_values) { ["a", "b", "c"] }
7
+ subject { described_class.new("mytext", nil, false, possible_values) }
8
+ describe "#set" do
9
+ context "when a value is given outside of possible_values" do
10
+ it "should raise an ArgumentError" do
11
+ expect { subject.set("d") }.to raise_error(ArgumentError)
12
+ end
13
+ end
14
+ context "when a value is given within possible_values" do
15
+ it "should set the value" do
16
+ expect { subject.set("a") }.to_not raise_error
17
+ expect(subject.value).to eq("a")
18
+ end
19
+ end
20
+ end
21
+ end
@@ -3,26 +3,74 @@ require "spec_helper"
3
3
  require "logstash/util/wrapped_synchronous_queue"
4
4
 
5
5
  describe LogStash::Util::WrappedSynchronousQueue do
6
- context "#offer" do
7
- context "queue is blocked" do
8
- it "fails and give feedback" do
9
- expect(subject.offer("Bonjour", 2)).to be_falsey
10
- end
11
- end
12
-
13
- context "queue is not blocked" do
14
- before do
15
- @consumer = Thread.new { loop { subject.take } }
16
- sleep(0.1)
17
- end
18
-
19
- after do
20
- @consumer.kill
21
- end
22
-
23
- it "inserts successfully" do
24
- expect(subject.offer("Bonjour", 20)).to be_truthy
25
- end
26
- end
27
- end
6
+ context "#offer" do
7
+ context "queue is blocked" do
8
+ it "fails and give feedback" do
9
+ expect(subject.offer("Bonjour", 2)).to be_falsey
10
+ end
11
+ end
12
+
13
+ context "queue is not blocked" do
14
+ before do
15
+ @consumer = Thread.new { loop { subject.take } }
16
+ sleep(0.1)
17
+ end
18
+
19
+ after do
20
+ @consumer.kill
21
+ end
22
+
23
+ it "inserts successfully" do
24
+ expect(subject.offer("Bonjour", 20)).to be_truthy
25
+ end
26
+ end
27
+ end
28
+
29
+ describe "queue clients" do
30
+ context "when requesting a write client" do
31
+ it "returns a client" do
32
+ expect(subject.write_client).to be_a(LogStash::Util::WrappedSynchronousQueue::WriteClient)
33
+ end
34
+ end
35
+
36
+ context "when requesting a read client" do
37
+ it "returns a client" do
38
+ expect(subject.read_client).to be_a(LogStash::Util::WrappedSynchronousQueue::ReadClient)
39
+ end
40
+ end
41
+
42
+ class DummyQueue < Array
43
+ def take() shift(); end
44
+ def poll(*) shift(); end
45
+ end
46
+
47
+ describe "WriteClient | ReadClient" do
48
+ context "when writing to the queue" do
49
+ let(:queue) { DummyQueue.new }
50
+ let(:write_client) { LogStash::Util::WrappedSynchronousQueue::WriteClient.new(queue)}
51
+ let(:read_client) { LogStash::Util::WrappedSynchronousQueue::ReadClient.new(queue)}
52
+ it "appends batches to the queue" do
53
+ batch = write_client.get_new_batch
54
+ 5.times {|i| batch.push("value-#{i}")}
55
+ write_client.push_batch(batch)
56
+ read_batch = read_client.take_batch
57
+ expect(read_batch.size).to eq(5)
58
+ i = 0
59
+ read_batch.each do |data|
60
+ expect(data).to eq("value-#{i}")
61
+ read_batch.cancel("value-#{i}") if i > 2
62
+ read_batch.merge("generated-#{i}") if i > 2
63
+ i += 1
64
+ end
65
+ expect(read_batch.cancelled_size).to eq(2)
66
+ i = 0
67
+ read_batch.each do |data|
68
+ expect(data).to eq("value-#{i}") if i < 3
69
+ expect(data).to eq("generated-#{i}") if i > 2
70
+ i += 1
71
+ end
72
+ end
73
+ end
74
+ end
75
+ end
28
76
  end
@@ -0,0 +1,98 @@
1
+ # encoding: utf-8
2
+ # Define the common operation that both the `NullMetric` class and the Namespaced class should answer.
3
+ shared_examples "metrics commons operations" do
4
+ let(:key) { "galaxy" }
5
+
6
+ describe "#increment" do
7
+ it "allows to increment a key with no amount" do
8
+ expect { subject.increment(key, 100) }.not_to raise_error
9
+ end
10
+
11
+ it "allow to increment a key" do
12
+ expect { subject.increment(key) }.not_to raise_error
13
+ end
14
+
15
+ it "raises an exception if the key is an empty string" do
16
+ expect { subject.increment("", 20) }.to raise_error(LogStash::Instrument::MetricNoKeyProvided)
17
+ end
18
+
19
+ it "raise an exception if the key is nil" do
20
+ expect { subject.increment(nil, 20) }.to raise_error(LogStash::Instrument::MetricNoKeyProvided)
21
+ end
22
+ end
23
+
24
+ describe "#decrement" do
25
+ it "allows to decrement a key with no amount" do
26
+ expect { subject.decrement(key, 100) }.not_to raise_error
27
+ end
28
+
29
+ it "allow to decrement a key" do
30
+ expect { subject.decrement(key) }.not_to raise_error
31
+ end
32
+
33
+ it "raises an exception if the key is an empty string" do
34
+ expect { subject.decrement("", 20) }.to raise_error(LogStash::Instrument::MetricNoKeyProvided)
35
+ end
36
+
37
+ it "raise an exception if the key is nil" do
38
+ expect { subject.decrement(nil, 20) }.to raise_error(LogStash::Instrument::MetricNoKeyProvided)
39
+ end
40
+ end
41
+
42
+ describe "#gauge" do
43
+ it "allows to set a value" do
44
+ expect { subject.gauge(key, "pluto") }.not_to raise_error
45
+ end
46
+
47
+
48
+ it "raises an exception if the key is an empty string" do
49
+ expect { subject.gauge("", 20) }.to raise_error(LogStash::Instrument::MetricNoKeyProvided)
50
+ end
51
+
52
+ it "raise an exception if the key is nil" do
53
+ expect { subject.gauge(nil, 20) }.to raise_error(LogStash::Instrument::MetricNoKeyProvided)
54
+ end
55
+ end
56
+
57
+ describe "#report_time" do
58
+ it "allow to record time" do
59
+ expect { subject.report_time(key, 1000) }.not_to raise_error
60
+ end
61
+
62
+ it "raises an exception if the key is an empty string" do
63
+ expect { subject.report_time("", 20) }.to raise_error(LogStash::Instrument::MetricNoKeyProvided)
64
+ end
65
+
66
+ it "raise an exception if the key is nil" do
67
+ expect { subject.report_time(nil, 20) }.to raise_error(LogStash::Instrument::MetricNoKeyProvided)
68
+ end
69
+ end
70
+
71
+ describe "#time" do
72
+ it "allow to record time with a block given" do
73
+ expect do
74
+ subject.time(key) { 1+1 }
75
+ end.not_to raise_error
76
+ end
77
+
78
+ it "returns the value of the block without recording any metrics" do
79
+ expect(subject.time(:execution_time) { "hello" }).to eq("hello")
80
+ end
81
+
82
+ it "return a TimedExecution" do
83
+ execution = subject.time(:do_something)
84
+ expect { execution.stop }.not_to raise_error
85
+ end
86
+
87
+
88
+ it "raises an exception if the key is an empty string" do
89
+ expect { subject.time("") {} }.to raise_error(LogStash::Instrument::MetricNoKeyProvided)
90
+ end
91
+
92
+ it "raise an exception if the key is nil" do
93
+ expect { subject.time(nil) {} }.to raise_error(LogStash::Instrument::MetricNoKeyProvided)
94
+ end
95
+ end
96
+ end
97
+
98
+
metadata CHANGED
@@ -1,21 +1,21 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.0.alpha4.snapshot3
4
+ version: 5.0.0.alpha5.snapshot1
5
5
  platform: java
6
6
  authors:
7
7
  - Elastic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-06-17 00:00:00.000000000 Z
11
+ date: 2016-07-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
15
15
  requirements:
16
16
  - - '='
17
17
  - !ruby/object:Gem::Version
18
- version: 5.0.0.alpha4.snapshot3
18
+ version: 5.0.0.alpha5.snapshot1
19
19
  name: logstash-core-event-java
20
20
  prerelease: false
21
21
  type: :runtime
@@ -23,7 +23,7 @@ dependencies:
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 5.0.0.alpha4.snapshot3
26
+ version: 5.0.0.alpha5.snapshot1
27
27
  - !ruby/object:Gem::Dependency
28
28
  requirement: !ruby/object:Gem::Requirement
29
29
  requirements:
@@ -296,6 +296,8 @@ files:
296
296
  - lib/logstash/api/app_helpers.rb
297
297
  - lib/logstash/api/command_factory.rb
298
298
  - lib/logstash/api/commands/base.rb
299
+ - lib/logstash/api/commands/default_metadata.rb
300
+ - lib/logstash/api/commands/hot_threads_reporter.rb
299
301
  - lib/logstash/api/commands/node.rb
300
302
  - lib/logstash/api/commands/stats.rb
301
303
  - lib/logstash/api/commands/system/basicinfo_command.rb
@@ -308,6 +310,7 @@ files:
308
310
  - lib/logstash/api/modules/stats.rb
309
311
  - lib/logstash/api/rack_app.rb
310
312
  - lib/logstash/api/service.rb
313
+ - lib/logstash/build.rb
311
314
  - lib/logstash/codecs/base.rb
312
315
  - lib/logstash/config/config_ast.rb
313
316
  - lib/logstash/config/cpu_core_strategy.rb
@@ -424,6 +427,7 @@ files:
424
427
  - spec/logstash/plugins/registry_spec.rb
425
428
  - spec/logstash/runner_spec.rb
426
429
  - spec/logstash/setting_spec.rb
430
+ - spec/logstash/settings/string_spec.rb
427
431
  - spec/logstash/settings_spec.rb
428
432
  - spec/logstash/shutdown_watcher_spec.rb
429
433
  - spec/logstash/util/buftok_spec.rb
@@ -437,6 +441,7 @@ files:
437
441
  - spec/static/i18n_spec.rb
438
442
  - spec/support/matchers.rb
439
443
  - spec/support/mocks_classes.rb
444
+ - spec/support/shared_examples.rb
440
445
  homepage: http://www.elastic.co/guide/en/logstash/current/index.html
441
446
  licenses:
442
447
  - Apache License (2.0)
@@ -502,6 +507,7 @@ test_files:
502
507
  - spec/logstash/plugins/registry_spec.rb
503
508
  - spec/logstash/runner_spec.rb
504
509
  - spec/logstash/setting_spec.rb
510
+ - spec/logstash/settings/string_spec.rb
505
511
  - spec/logstash/settings_spec.rb
506
512
  - spec/logstash/shutdown_watcher_spec.rb
507
513
  - spec/logstash/util/buftok_spec.rb
@@ -515,3 +521,4 @@ test_files:
515
521
  - spec/static/i18n_spec.rb
516
522
  - spec/support/matchers.rb
517
523
  - spec/support/mocks_classes.rb
524
+ - spec/support/shared_examples.rb