logstash-core 5.0.0.alpha1.snapshot2-java → 5.0.0.alpha2-java

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of logstash-core might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1897b709706618fc25d95076f5260446a6552313
4
- data.tar.gz: ef6d4c66c9f72d39a3bcca7bad86ce1b493b1933
3
+ metadata.gz: 8a4717bd46d5d6a4e8d9bd8be9be28f001084d89
4
+ data.tar.gz: bfc0707c41178176db21e5ace27a5c38382b63cf
5
5
  SHA512:
6
- metadata.gz: 96edfe806e2fe9c0848cbfe10b3aeb780dc67c63e007792126bd6e0f166ece56ed79caab924d4cdbaaeae561400414d3efb7ae56a48378c9a179144f14c642a0
7
- data.tar.gz: c8b0b175e21c70203a2978b2c5b1973633694b42c09fb0e72784e1827ad25aee4c245656770f54e060db98190630605e171a130faa3f1b92870c21bfd0046cdf
6
+ metadata.gz: 7bec4929afafd898bdff9949fc9d2ec60fb6dd83986f72501132f0c7466de6b13424fbcea03cb818dcca340282ca2f148a5078160205160f4037413a17435fb0
7
+ data.tar.gz: a6594f0732aa6efc4213757382d776ae544e7006d0ecca46cb3db9c4b7e26daa136495aa40cfaca10a07904a703edb8203ff1cb9de469cf5d371709611b873b3
@@ -5,4 +5,4 @@
5
5
  # Note to authors: this should not include dashes because 'gem' barfs if
6
6
  # you include a dash in the version string.
7
7
 
8
- LOGSTASH_CORE_VERSION = "5.0.0-alpha1.snapshot2"
8
+ LOGSTASH_CORE_VERSION = "5.0.0-alpha2"
@@ -211,6 +211,12 @@ class LogStash::Agent
211
211
  return unless pipeline.is_a?(LogStash::Pipeline)
212
212
  return if pipeline.ready?
213
213
  @logger.info("starting pipeline", :id => id)
214
+
215
+ # Reset the current collected stats,
216
+ # starting a pipeline with a new configuration should be the same as restarting
217
+ # logstash.
218
+ reset_collector
219
+
214
220
  Thread.new do
215
221
  LogStash::Util.set_thread_name("pipeline.#{id}")
216
222
  begin
@@ -252,4 +258,8 @@ class LogStash::Agent
252
258
  def clean_state?
253
259
  @pipelines.empty?
254
260
  end
261
+
262
+ def reset_collector
263
+ LogStash::Instrument::Collector.instance.clear
264
+ end
255
265
  end # class LogStash::Agent
@@ -7,8 +7,13 @@ require "logstash/logging"
7
7
  # This is the base class for logstash codecs.
8
8
  module LogStash::Codecs; class Base < LogStash::Plugin
9
9
  include LogStash::Config::Mixin
10
+
10
11
  config_name "codec"
11
12
 
13
+ def self.plugin_type
14
+ "codec"
15
+ end
16
+
12
17
  def initialize(params={})
13
18
  super
14
19
  config_init(@params)
@@ -1,6 +1,7 @@
1
1
  # encoding: utf-8
2
2
  require "logstash/namespace"
3
3
  require "logstash/config/registry"
4
+ require "logstash/plugins/registry"
4
5
  require "logstash/logging"
5
6
  require "logstash/util/password"
6
7
  require "logstash/version"
@@ -85,7 +86,7 @@ module LogStash::Config::Mixin
85
86
  extra = opts[:obsolete].is_a?(String) ? opts[:obsolete] : ""
86
87
  extra.gsub!("%PLUGIN%", self.class.config_name)
87
88
  raise LogStash::ConfigurationError,
88
- I18n.t("logstash.agent.configuration.obsolete", :name => name,
89
+ I18n.t("logstash.runner.configuration.obsolete", :name => name,
89
90
  :plugin => self.class.config_name, :extra => extra)
90
91
  end
91
92
  end
@@ -191,8 +192,12 @@ module LogStash::Config::Mixin
191
192
  def config_name(name = nil)
192
193
  @config_name = name if !name.nil?
193
194
  LogStash::Config::Registry.registry[@config_name] = self
195
+ if self.respond_to?("plugin_type")
196
+ declare_plugin(self.plugin_type, @config_name)
197
+ end
194
198
  return @config_name
195
199
  end
200
+ alias_method :config_plugin, :config_name
196
201
 
197
202
  # Deprecated: Declare the version of the plugin
198
203
  # inside the gemspec.
@@ -117,6 +117,10 @@ class LogStash::Filters::Base < LogStash::Plugin
117
117
  # Optional.
118
118
  config :periodic_flush, :validate => :boolean, :default => false
119
119
 
120
+ def self.plugin_type
121
+ "filter"
122
+ end
123
+
120
124
  public
121
125
  def initialize(params)
122
126
  super
@@ -10,6 +10,7 @@ require "logstash/util/decorators"
10
10
  # This is the base class for Logstash inputs.
11
11
  class LogStash::Inputs::Base < LogStash::Plugin
12
12
  include LogStash::Config::Mixin
13
+
13
14
  config_name "input"
14
15
 
15
16
  # Add a `type` field to all events handled by this input.
@@ -48,6 +49,10 @@ class LogStash::Inputs::Base < LogStash::Plugin
48
49
  attr_accessor :params
49
50
  attr_accessor :threadable
50
51
 
52
+ def self.plugin_type
53
+ "input"
54
+ end
55
+
51
56
  public
52
57
  def initialize(params={})
53
58
  super
@@ -2,6 +2,7 @@
2
2
  require "concurrent"
3
3
  require "logstash/event"
4
4
  require "logstash/instrument/metric_type"
5
+ require "thread"
5
6
 
6
7
  module LogStash module Instrument
7
8
  # The Metric store the data structure that make sure the data is
@@ -25,6 +26,12 @@ module LogStash module Instrument
25
26
  # This hash has only one dimension
26
27
  # and allow fast retrieval of the metrics
27
28
  @fast_lookup = Concurrent::Map.new
29
+
30
+ # This Mutex block the critical section for the
31
+ # structured hash, it block the zone when we first insert a metric
32
+ # in the structured hash or when we query it for search or to make
33
+ # the result available in the API.
34
+ @structured_lookup_mutex = Mutex.new
28
35
  end
29
36
 
30
37
  # This method use the namespace and key to search the corresponding value of
@@ -46,16 +53,13 @@ module LogStash module Instrument
46
53
  # BUT. If the value is not present in the `@fast_lookup` the value will be inserted and
47
54
  # `#puf_if_absent` will return nil. With this returned value of nil we assume that we don't
48
55
  # have it in the `@metric_store` for structured search so we add it there too.
49
- #
50
- # The problem with only using the `@metric_store` directly all the time would require us
51
- # to use the mutex around the structure since its a multi-level hash, without that it wont
52
- # return a consistent value of the metric and this would slow down the code and would
53
- # complixity the code.
54
56
  if found_value = @fast_lookup.put_if_absent([namespaces, key], provided_value)
55
57
  return found_value
56
58
  else
57
- # If we cannot find the value this mean we need to save it in the store.
58
- fetch_or_store_namespaces(namespaces).fetch_or_store(key, provided_value)
59
+ @structured_lookup_mutex.synchronize do
60
+ # If we cannot find the value this mean we need to save it in the store.
61
+ fetch_or_store_namespaces(namespaces).fetch_or_store(key, provided_value)
62
+ end
59
63
  return provided_value
60
64
  end
61
65
  end
@@ -89,7 +93,9 @@ module LogStash module Instrument
89
93
  key_paths.map(&:to_sym)
90
94
  new_hash = Hash.new
91
95
 
92
- get_recursively(key_paths, @store, new_hash)
96
+ @structured_lookup_mutex.synchronize do
97
+ get_recursively(key_paths, @store, new_hash)
98
+ end
93
99
 
94
100
  new_hash
95
101
  end
@@ -57,6 +57,10 @@ class LogStash::Outputs::Base < LogStash::Plugin
57
57
  self.class.declare_workers_not_supported!(message)
58
58
  end
59
59
 
60
+ def self.plugin_type
61
+ "output"
62
+ end
63
+
60
64
  public
61
65
  def initialize(params={})
62
66
  super
@@ -6,6 +6,7 @@ require "logstash/instrument/null_metric"
6
6
  require "cabin"
7
7
  require "concurrent"
8
8
  require "securerandom"
9
+ require "logstash/plugins/registry"
9
10
 
10
11
  class LogStash::Plugin
11
12
  attr_accessor :params
@@ -117,23 +118,21 @@ class LogStash::Plugin
117
118
  # Look up a plugin by type and name.
118
119
  def self.lookup(type, name)
119
120
  path = "logstash/#{type}s/#{name}"
120
-
121
- # first check if plugin already exists in namespace and continue to next step if not
122
- begin
123
- return namespace_lookup(type, name)
124
- rescue NameError
125
- logger.debug("Plugin not defined in namespace, checking for plugin file", :type => type, :name => name, :path => path)
121
+ LogStash::Registry.instance.lookup(type ,name) do |plugin_klass, plugin_name|
122
+ is_a_plugin?(plugin_klass, plugin_name)
126
123
  end
127
-
128
- # try to load the plugin file. ex.: lookup("filter", "grok") will require logstash/filters/grok
129
- require(path)
130
-
131
- # check again if plugin is now defined in namespace after the require
132
- namespace_lookup(type, name)
133
124
  rescue LoadError, NameError => e
125
+ logger.debug("Problems loading the plugin with", :type => type, :name => name, :path => path)
134
126
  raise(LogStash::PluginLoadingError, I18n.t("logstash.pipeline.plugin-loading-error", :type => type, :name => name, :path => path, :error => e.to_s))
135
127
  end
136
128
 
129
+ public
130
+ def self.declare_plugin(type, name)
131
+ path = "logstash/#{type}s/#{name}"
132
+ registry = LogStash::Registry.instance
133
+ registry.register(path, self)
134
+ end
135
+
137
136
  private
138
137
  # lookup a plugin by type and name in the existing LogStash module namespace
139
138
  # ex.: namespace_lookup("filter", "grok") looks for LogStash::Filters::Grok
@@ -165,4 +164,5 @@ class LogStash::Plugin
165
164
  def self.logger
166
165
  @logger ||= Cabin::Channel.get(LogStash)
167
166
  end
167
+
168
168
  end # class LogStash::Plugin
@@ -0,0 +1,83 @@
1
+ # encoding: utf-8
2
+ require 'singleton'
3
+ require "rubygems/package"
4
+
5
+ module LogStash
6
+ class Registry
7
+
8
+ ##
9
+ # Placeholder class for registered plugins
10
+ ##
11
+ class Plugin
12
+ attr_reader :type, :name
13
+
14
+ def initialize(type, name)
15
+ @type = type
16
+ @name = name
17
+ end
18
+
19
+ def path
20
+ "logstash/#{type}s/#{name}"
21
+ end
22
+
23
+ def cannonic_gem_name
24
+ "logstash-#{type}-#{name}"
25
+ end
26
+
27
+ def installed?
28
+ find_plugin_spec(cannonic_gem_name).any?
29
+ end
30
+
31
+ private
32
+
33
+ def find_plugin_spec(name)
34
+ specs = ::Gem::Specification.find_all_by_name(name)
35
+ specs.select{|spec| logstash_plugin_spec?(spec)}
36
+ end
37
+
38
+ def logstash_plugin_spec?(spec)
39
+ spec.metadata && spec.metadata["logstash_plugin"] == "true"
40
+ end
41
+
42
+ end
43
+
44
+ include Singleton
45
+
46
+ def initialize
47
+ @registry = {}
48
+ @logger = Cabin::Channel.get(LogStash)
49
+ end
50
+
51
+ def lookup(type, plugin_name, &block)
52
+
53
+ plugin = Plugin.new(type, plugin_name)
54
+
55
+ if plugin.installed?
56
+ return @registry[plugin.path] if registered?(plugin.path)
57
+ require plugin.path
58
+ klass = @registry[plugin.path]
59
+ if block_given? # if provided pass a block to do validation
60
+ raise LoadError unless block.call(klass, plugin_name)
61
+ end
62
+ return klass
63
+ else
64
+ # The plugin was defined directly in the code, so there is no need to use the
65
+ # require way of loading classes
66
+ return @registry[plugin.path] if registered?(plugin.path)
67
+ raise LoadError
68
+ end
69
+ rescue => e
70
+ @logger.debug("Problems loading a plugin with", :type => type, :name => plugin, :path => plugin.path, :error => e) if @logger.debug?
71
+ raise LoadError, "Problems loading the requested plugin named #{plugin_name} of type #{type}."
72
+ end
73
+
74
+ def register(path, klass)
75
+ @registry[path] = klass
76
+ end
77
+
78
+ def registered?(path)
79
+ @registry.has_key?(path)
80
+ end
81
+
82
+ end
83
+ end
@@ -11,4 +11,4 @@
11
11
  # eventually this file should be in the root logstash lib fir and dependencies in logstash-core should be
12
12
  # fixed.
13
13
 
14
- LOGSTASH_VERSION = "5.0.0-alpha1.snapshot2"
14
+ LOGSTASH_VERSION = "5.0.0-alpha2"
@@ -17,7 +17,7 @@ Gem::Specification.new do |gem|
17
17
  gem.require_paths = ["lib"]
18
18
  gem.version = LOGSTASH_CORE_VERSION.gsub(/-/, '.')
19
19
 
20
- gem.add_runtime_dependency "logstash-core-event-java", "~> 5.0.0.alpha1.snapshot2"
20
+ gem.add_runtime_dependency "logstash-core-event-java", "~> 5.0.0.alpha2"
21
21
 
22
22
  gem.add_runtime_dependency "cabin", "~> 0.8.0" #(Apache 2.0 license)
23
23
  gem.add_runtime_dependency "pry", "~> 0.10.1" #(Ruby license)
@@ -28,7 +28,7 @@ Gem::Specification.new do |gem|
28
28
  gem.add_runtime_dependency "concurrent-ruby", "1.0.0"
29
29
  gem.add_runtime_dependency "sinatra", '~> 1.4', '>= 1.4.6'
30
30
  gem.add_runtime_dependency 'puma', '~> 2.16', '>= 2.16.0'
31
- gem.add_runtime_dependency "jruby-openssl", "0.9.13" # Required to support TLSv1.2
31
+ gem.add_runtime_dependency "jruby-openssl", "0.9.16" # >= 0.9.13 Required to support TLSv1.2
32
32
  gem.add_runtime_dependency "chronic_duration", "0.10.6"
33
33
  gem.add_runtime_dependency "jruby-monitoring", '~> 0.3.1'
34
34
 
@@ -1,6 +1,8 @@
1
1
  # encoding: utf-8
2
- require 'spec_helper'
3
- require 'stud/temporary'
2
+ require "spec_helper"
3
+ require "stud/temporary"
4
+ require "logstash/inputs/generator"
5
+ require_relative "../support/mocks_classes"
4
6
 
5
7
  describe LogStash::Agent do
6
8
 
@@ -80,7 +82,7 @@ describe LogStash::Agent do
80
82
  context "with a config that contains reload incompatible plugins" do
81
83
  let(:second_pipeline_config) { "input { stdin {} } filter { } output { }" }
82
84
 
83
- it "does not reload if new config contains reload incompatible plugins" do
85
+ it "does not upgrade the new config" do
84
86
  t = Thread.new { subject.execute }
85
87
  sleep 0.01 until subject.running_pipelines? && subject.pipelines.values.first.ready?
86
88
  expect(subject).to_not receive(:upgrade_pipeline)
@@ -95,10 +97,10 @@ describe LogStash::Agent do
95
97
  context "with a config that does not contain reload incompatible plugins" do
96
98
  let(:second_pipeline_config) { "input { generator { } } filter { } output { }" }
97
99
 
98
- it "does not reload if new config contains reload incompatible plugins" do
100
+ it "does upgrade the new config" do
99
101
  t = Thread.new { subject.execute }
100
102
  sleep 0.01 until subject.running_pipelines? && subject.pipelines.values.first.ready?
101
- expect(subject).to receive(:upgrade_pipeline)
103
+ expect(subject).to receive(:upgrade_pipeline).once.and_call_original
102
104
  File.open(config_file, "w") { |f| f.puts second_pipeline_config }
103
105
  subject.send(:reload_state!)
104
106
  sleep 0.1
@@ -134,7 +136,7 @@ describe LogStash::Agent do
134
136
  context "with a config that contains reload incompatible plugins" do
135
137
  let(:second_pipeline_config) { "input { stdin {} } filter { } output { }" }
136
138
 
137
- it "does not reload if new config contains reload incompatible plugins" do
139
+ it "does not upgrade the new config" do
138
140
  t = Thread.new { subject.execute }
139
141
  sleep 0.01 until subject.running_pipelines? && subject.pipelines.values.first.ready?
140
142
  expect(subject).to_not receive(:upgrade_pipeline)
@@ -148,10 +150,10 @@ describe LogStash::Agent do
148
150
  context "with a config that does not contain reload incompatible plugins" do
149
151
  let(:second_pipeline_config) { "input { generator { } } filter { } output { }" }
150
152
 
151
- it "does not reload if new config contains reload incompatible plugins" do
153
+ it "does upgrade the new config" do
152
154
  t = Thread.new { subject.execute }
153
155
  sleep 0.01 until subject.running_pipelines? && subject.pipelines.values.first.ready?
154
- expect(subject).to receive(:upgrade_pipeline).at_least(2).times
156
+ expect(subject).to receive(:upgrade_pipeline).once.and_call_original
155
157
  File.open(config_file, "w") { |f| f.puts second_pipeline_config }
156
158
  sleep 0.1
157
159
  Stud.stop!(t)
@@ -313,4 +315,65 @@ describe LogStash::Agent do
313
315
  expect(subject.uptime).to be >= 0
314
316
  end
315
317
  end
318
+
319
+ context "metrics after config reloading" do
320
+ let(:dummy_output) { DummyOutput.new }
321
+ let(:config) { "input { generator { } } output { dummyoutput { } }" }
322
+ let(:new_config_generator_counter) { 50 }
323
+ let(:new_config) { "input { generator { count => #{new_config_generator_counter} } } output { dummyoutput {} }" }
324
+ let(:config_path) do
325
+ f = Stud::Temporary.file
326
+ f.write(config)
327
+ f.close
328
+ f.path
329
+ end
330
+ let(:interval) { 0.2 }
331
+ let(:pipeline_settings) { { :pipeline_workers => 4,
332
+ :config_path => config_path } }
333
+
334
+ let(:agent_args) do
335
+ super.merge({ :auto_reload => true,
336
+ :reload_interval => interval,
337
+ :collect_metric => true })
338
+ end
339
+
340
+ before :each do
341
+ allow(DummyOutput).to receive(:new).at_least(:once).with(anything).and_return(dummy_output)
342
+ allow(LogStash::Plugin).to receive(:lookup).with("input", "generator").and_return(LogStash::Inputs::Generator)
343
+ allow(LogStash::Plugin).to receive(:lookup).with("codec", "plain").and_return(LogStash::Codecs::Plain)
344
+ allow(LogStash::Plugin).to receive(:lookup).with("output", "dummyoutput").and_return(DummyOutput)
345
+
346
+ @t = Thread.new do
347
+ subject.register_pipeline("main", pipeline_settings)
348
+ subject.execute
349
+ end
350
+
351
+ sleep(2)
352
+ end
353
+
354
+ after :each do
355
+ Stud.stop!(@t)
356
+ @t.join
357
+ end
358
+
359
+ it "resets the metric collector" do
360
+ # We know that the store has more events coming in.
361
+ sleep(0.01) while dummy_output.events.size < new_config_generator_counter
362
+ snapshot = LogStash::Instrument::Collector.instance.snapshot_metric
363
+ expect(snapshot.metric_store.get_with_path("/stats/events")[:stats][:events][:in].value).to be > new_config_generator_counter
364
+
365
+ # update the configuration and give some time to logstash to pick it up and do the work
366
+ IO.write(config_path, new_config)
367
+
368
+ sleep(interval * 3) # Give time to reload the config
369
+
370
+ # Since there is multiple threads involved with the configuration reload,
371
+ # It can take some time to the stats be visible in the store but it will
372
+ # be eventually consistent.
373
+ sleep(0.01) while dummy_output.events.size < new_config_generator_counter
374
+
375
+ value = LogStash::Instrument::Collector.instance.snapshot_metric.metric_store.get_with_path("/stats/events")[:stats][:events][:in].value
376
+ expect(value).to eq(new_config_generator_counter)
377
+ end
378
+ end
316
379
  end
@@ -2,6 +2,7 @@
2
2
  require "spec_helper"
3
3
  require "logstash/inputs/generator"
4
4
  require "logstash/filters/multiline"
5
+ require_relative "../support/mocks_classes"
5
6
 
6
7
  class DummyInput < LogStash::Inputs::Base
7
8
  config_name "dummyinput"
@@ -48,30 +49,6 @@ class DummyCodec < LogStash::Codecs::Base
48
49
  end
49
50
  end
50
51
 
51
- class DummyOutput < LogStash::Outputs::Base
52
- config_name "dummyoutput"
53
- milestone 2
54
-
55
- attr_reader :num_closes, :events
56
-
57
- def initialize(params={})
58
- super
59
- @num_closes = 0
60
- @events = []
61
- end
62
-
63
- def register
64
- end
65
-
66
- def receive(event)
67
- @events << event
68
- end
69
-
70
- def close
71
- @num_closes = 1
72
- end
73
- end
74
-
75
52
  class DummyOutputMore < DummyOutput
76
53
  config_name "dummyoutputmore"
77
54
  end
@@ -34,6 +34,19 @@ describe LogStash::Plugin do
34
34
  expect(LogStash::Plugin.lookup("filter", "lady_gaga")).to eq(LogStash::Filters::LadyGaga)
35
35
  end
36
36
 
37
+ describe "plugin signup in the registry" do
38
+
39
+ let(:registry) { LogStash::Registry.instance }
40
+
41
+ it "should be present in the registry" do
42
+ class LogStash::Filters::MyPlugin < LogStash::Filters::Base
43
+ config_name "my_plugin"
44
+ end
45
+ path = "logstash/filters/my_plugin"
46
+ expect(registry.registered?(path)).to eq(true)
47
+ end
48
+ end
49
+
37
50
  describe "#inspect" do
38
51
  class LogStash::Filters::MyTestFilter < LogStash::Filters::Base
39
52
  config_name "param1"
@@ -0,0 +1,57 @@
1
+ # encoding: utf-8
2
+ require "spec_helper"
3
+ require "logstash/plugins/registry"
4
+ require "logstash/inputs/base"
5
+
6
+ # use a dummy NOOP input to test plugin registry
7
+ class LogStash::Inputs::Dummy < LogStash::Inputs::Base
8
+ config_name "dummy"
9
+
10
+ def register; end
11
+
12
+ end
13
+
14
+ describe LogStash::Registry do
15
+
16
+ let(:registry) { described_class.instance }
17
+
18
+ context "when loading installed plugins" do
19
+
20
+ let(:plugin) { double("plugin") }
21
+
22
+ it "should return the expected class" do
23
+ klass = registry.lookup("input", "stdin")
24
+ expect(klass).to eq(LogStash::Inputs::Stdin)
25
+ end
26
+
27
+ it "should raise an error if can not find the plugin class" do
28
+ expect(LogStash::Registry::Plugin).to receive(:new).with("input", "elastic").and_return(plugin)
29
+ expect(plugin).to receive(:path).and_return("logstash/input/elastic").twice
30
+ expect(plugin).to receive(:installed?).and_return(true)
31
+ expect { registry.lookup("input", "elastic") }.to raise_error(LoadError)
32
+ end
33
+
34
+ it "should load from registry is already load" do
35
+ registry.lookup("input", "stdin")
36
+ expect(registry).to receive(:registered?).and_return(true).once
37
+ registry.lookup("input", "stdin")
38
+ internal_registry = registry.instance_variable_get("@registry")
39
+ expect(internal_registry).to include("logstash/inputs/stdin" => LogStash::Inputs::Stdin)
40
+ end
41
+ end
42
+
43
+ context "when loading code defined plugins" do
44
+ it "should return the expected class" do
45
+ klass = registry.lookup("input", "dummy")
46
+ expect(klass).to eq(LogStash::Inputs::Dummy)
47
+ end
48
+ end
49
+
50
+ context "when plugin is not installed and not defined" do
51
+ it "should raise an error" do
52
+ expect { registry.lookup("input", "elastic") }.to raise_error(LoadError)
53
+ end
54
+ end
55
+
56
+ end
57
+
@@ -0,0 +1,25 @@
1
+ # encoding: utf-8
2
+ require "spec_helper"
3
+ require "i18n"
4
+
5
+ I18N_T_REGEX = Regexp.new('I18n.t.+?"(.+?)"')
6
+
7
+ describe I18n do
8
+ context "when using en.yml" do
9
+ glob_path = File.join(LogStash::Environment::LOGSTASH_HOME, "logstash-*", "lib", "**", "*.rb")
10
+
11
+ Dir.glob(glob_path).each do |file_name|
12
+
13
+ context "in file \"#{file_name}\"" do
14
+ File.foreach(file_name) do |line|
15
+ next unless (match = line.match(I18N_T_REGEX))
16
+ line = $INPUT_LINE_NUMBER
17
+ key = match[1]
18
+ it "in line #{line} the \"#{key}\" key should exist" do
19
+ expect(I18n.exists?(key)).to be_truthy
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,26 @@
1
+ # encoding: utf-8
2
+ require "logstash/outputs/base"
3
+
4
+ class DummyOutput < LogStash::Outputs::Base
5
+ config_name "dummyoutput"
6
+ milestone 2
7
+
8
+ attr_reader :num_closes, :events
9
+
10
+ def initialize(params={})
11
+ super
12
+ @num_closes = 0
13
+ @events = []
14
+ end
15
+
16
+ def register
17
+ end
18
+
19
+ def receive(event)
20
+ @events << event
21
+ end
22
+
23
+ def close
24
+ @num_closes = 1
25
+ end
26
+ end
metadata CHANGED
@@ -1,33 +1,33 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.0.alpha1.snapshot2
4
+ version: 5.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: 2016-04-04 00:00:00.000000000 Z
11
+ date: 2016-05-02 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.alpha1.snapshot2
18
+ version: 5.0.0.alpha2
19
19
  name: logstash-core-event-java
20
20
  prerelease: false
21
21
  type: :runtime
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ~>
25
25
  - !ruby/object:Gem::Version
26
- version: 5.0.0.alpha1.snapshot2
26
+ version: 5.0.0.alpha2
27
27
  - !ruby/object:Gem::Dependency
28
28
  requirement: !ruby/object:Gem::Requirement
29
29
  requirements:
30
- - - "~>"
30
+ - - ~>
31
31
  - !ruby/object:Gem::Version
32
32
  version: 0.8.0
33
33
  name: cabin
@@ -35,13 +35,13 @@ dependencies:
35
35
  type: :runtime
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ~>
39
39
  - !ruby/object:Gem::Version
40
40
  version: 0.8.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  requirement: !ruby/object:Gem::Requirement
43
43
  requirements:
44
- - - "~>"
44
+ - - ~>
45
45
  - !ruby/object:Gem::Version
46
46
  version: 0.10.1
47
47
  name: pry
@@ -49,13 +49,13 @@ dependencies:
49
49
  type: :runtime
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ~>
53
53
  - !ruby/object:Gem::Version
54
54
  version: 0.10.1
55
55
  - !ruby/object:Gem::Dependency
56
56
  requirement: !ruby/object:Gem::Requirement
57
57
  requirements:
58
- - - "~>"
58
+ - - ~>
59
59
  - !ruby/object:Gem::Version
60
60
  version: 0.0.19
61
61
  name: stud
@@ -63,13 +63,13 @@ dependencies:
63
63
  type: :runtime
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - "~>"
66
+ - - ~>
67
67
  - !ruby/object:Gem::Version
68
68
  version: 0.0.19
69
69
  - !ruby/object:Gem::Dependency
70
70
  requirement: !ruby/object:Gem::Requirement
71
71
  requirements:
72
- - - "~>"
72
+ - - ~>
73
73
  - !ruby/object:Gem::Version
74
74
  version: 0.6.5
75
75
  name: clamp
@@ -77,7 +77,7 @@ dependencies:
77
77
  type: :runtime
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - "~>"
80
+ - - ~>
81
81
  - !ruby/object:Gem::Version
82
82
  version: 0.6.5
83
83
  - !ruby/object:Gem::Dependency
@@ -97,7 +97,7 @@ dependencies:
97
97
  - !ruby/object:Gem::Dependency
98
98
  requirement: !ruby/object:Gem::Requirement
99
99
  requirements:
100
- - - "~>"
100
+ - - ~>
101
101
  - !ruby/object:Gem::Version
102
102
  version: 0.8.3
103
103
  name: gems
@@ -105,7 +105,7 @@ dependencies:
105
105
  type: :runtime
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - "~>"
108
+ - - ~>
109
109
  - !ruby/object:Gem::Version
110
110
  version: 0.8.3
111
111
  - !ruby/object:Gem::Dependency
@@ -125,10 +125,10 @@ dependencies:
125
125
  - !ruby/object:Gem::Dependency
126
126
  requirement: !ruby/object:Gem::Requirement
127
127
  requirements:
128
- - - "~>"
128
+ - - ~>
129
129
  - !ruby/object:Gem::Version
130
130
  version: '1.4'
131
- - - ">="
131
+ - - '>='
132
132
  - !ruby/object:Gem::Version
133
133
  version: 1.4.6
134
134
  name: sinatra
@@ -136,19 +136,19 @@ dependencies:
136
136
  type: :runtime
137
137
  version_requirements: !ruby/object:Gem::Requirement
138
138
  requirements:
139
- - - "~>"
139
+ - - ~>
140
140
  - !ruby/object:Gem::Version
141
141
  version: '1.4'
142
- - - ">="
142
+ - - '>='
143
143
  - !ruby/object:Gem::Version
144
144
  version: 1.4.6
145
145
  - !ruby/object:Gem::Dependency
146
146
  requirement: !ruby/object:Gem::Requirement
147
147
  requirements:
148
- - - "~>"
148
+ - - ~>
149
149
  - !ruby/object:Gem::Version
150
150
  version: '2.16'
151
- - - ">="
151
+ - - '>='
152
152
  - !ruby/object:Gem::Version
153
153
  version: 2.16.0
154
154
  name: puma
@@ -156,10 +156,10 @@ dependencies:
156
156
  type: :runtime
157
157
  version_requirements: !ruby/object:Gem::Requirement
158
158
  requirements:
159
- - - "~>"
159
+ - - ~>
160
160
  - !ruby/object:Gem::Version
161
161
  version: '2.16'
162
- - - ">="
162
+ - - '>='
163
163
  - !ruby/object:Gem::Version
164
164
  version: 2.16.0
165
165
  - !ruby/object:Gem::Dependency
@@ -167,7 +167,7 @@ dependencies:
167
167
  requirements:
168
168
  - - '='
169
169
  - !ruby/object:Gem::Version
170
- version: 0.9.13
170
+ version: 0.9.16
171
171
  name: jruby-openssl
172
172
  prerelease: false
173
173
  type: :runtime
@@ -175,7 +175,7 @@ dependencies:
175
175
  requirements:
176
176
  - - '='
177
177
  - !ruby/object:Gem::Version
178
- version: 0.9.13
178
+ version: 0.9.16
179
179
  - !ruby/object:Gem::Dependency
180
180
  requirement: !ruby/object:Gem::Requirement
181
181
  requirements:
@@ -193,7 +193,7 @@ dependencies:
193
193
  - !ruby/object:Gem::Dependency
194
194
  requirement: !ruby/object:Gem::Requirement
195
195
  requirements:
196
- - - "~>"
196
+ - - ~>
197
197
  - !ruby/object:Gem::Version
198
198
  version: 0.3.1
199
199
  name: jruby-monitoring
@@ -201,13 +201,13 @@ dependencies:
201
201
  type: :runtime
202
202
  version_requirements: !ruby/object:Gem::Requirement
203
203
  requirements:
204
- - - "~>"
204
+ - - ~>
205
205
  - !ruby/object:Gem::Version
206
206
  version: 0.3.1
207
207
  - !ruby/object:Gem::Dependency
208
208
  requirement: !ruby/object:Gem::Requirement
209
209
  requirements:
210
- - - "<"
210
+ - - <
211
211
  - !ruby/object:Gem::Version
212
212
  version: 1.5.0
213
213
  name: treetop
@@ -215,7 +215,7 @@ dependencies:
215
215
  type: :runtime
216
216
  version_requirements: !ruby/object:Gem::Requirement
217
217
  requirements:
218
- - - "<"
218
+ - - <
219
219
  - !ruby/object:Gem::Version
220
220
  version: 1.5.0
221
221
  - !ruby/object:Gem::Dependency
@@ -235,7 +235,7 @@ dependencies:
235
235
  - !ruby/object:Gem::Dependency
236
236
  requirement: !ruby/object:Gem::Requirement
237
237
  requirements:
238
- - - "~>"
238
+ - - ~>
239
239
  - !ruby/object:Gem::Version
240
240
  version: 0.5.4
241
241
  name: minitar
@@ -243,13 +243,13 @@ dependencies:
243
243
  type: :runtime
244
244
  version_requirements: !ruby/object:Gem::Requirement
245
245
  requirements:
246
- - - "~>"
246
+ - - ~>
247
247
  - !ruby/object:Gem::Version
248
248
  version: 0.5.4
249
249
  - !ruby/object:Gem::Dependency
250
250
  requirement: !ruby/object:Gem::Requirement
251
251
  requirements:
252
- - - "~>"
252
+ - - ~>
253
253
  - !ruby/object:Gem::Version
254
254
  version: 1.1.7
255
255
  name: rubyzip
@@ -257,13 +257,13 @@ dependencies:
257
257
  type: :runtime
258
258
  version_requirements: !ruby/object:Gem::Requirement
259
259
  requirements:
260
- - - "~>"
260
+ - - ~>
261
261
  - !ruby/object:Gem::Version
262
262
  version: 1.1.7
263
263
  - !ruby/object:Gem::Dependency
264
264
  requirement: !ruby/object:Gem::Requirement
265
265
  requirements:
266
- - - "~>"
266
+ - - ~>
267
267
  - !ruby/object:Gem::Version
268
268
  version: 0.3.5
269
269
  name: thread_safe
@@ -271,13 +271,13 @@ dependencies:
271
271
  type: :runtime
272
272
  version_requirements: !ruby/object:Gem::Requirement
273
273
  requirements:
274
- - - "~>"
274
+ - - ~>
275
275
  - !ruby/object:Gem::Version
276
276
  version: 0.3.5
277
277
  - !ruby/object:Gem::Dependency
278
278
  requirement: !ruby/object:Gem::Requirement
279
279
  requirements:
280
- - - "~>"
280
+ - - ~>
281
281
  - !ruby/object:Gem::Version
282
282
  version: 0.3.7
283
283
  name: jrjackson
@@ -285,7 +285,7 @@ dependencies:
285
285
  type: :runtime
286
286
  version_requirements: !ruby/object:Gem::Requirement
287
287
  requirements:
288
- - - "~>"
288
+ - - ~>
289
289
  - !ruby/object:Gem::Version
290
290
  version: 0.3.7
291
291
  description: The core components of logstash, the scalable log and event management tool
@@ -363,6 +363,7 @@ files:
363
363
  - lib/logstash/pipeline.rb
364
364
  - lib/logstash/pipeline_reporter.rb
365
365
  - lib/logstash/plugin.rb
366
+ - lib/logstash/plugins/registry.rb
366
367
  - lib/logstash/program.rb
367
368
  - lib/logstash/runner.rb
368
369
  - lib/logstash/shutdown_watcher.rb
@@ -422,6 +423,7 @@ files:
422
423
  - spec/logstash/pipeline_reporter_spec.rb
423
424
  - spec/logstash/pipeline_spec.rb
424
425
  - spec/logstash/plugin_spec.rb
426
+ - spec/logstash/plugins/registry_spec.rb
425
427
  - spec/logstash/runner_spec.rb
426
428
  - spec/logstash/shutdown_watcher_spec.rb
427
429
  - spec/logstash/util/buftok_spec.rb
@@ -434,7 +436,9 @@ files:
434
436
  - spec/logstash/util/worker_threads_default_printer_spec.rb
435
437
  - spec/logstash/util/wrapped_synchronous_queue_spec.rb
436
438
  - spec/logstash/util_spec.rb
439
+ - spec/static/i18n_spec.rb
437
440
  - spec/support/matchers.rb
441
+ - spec/support/mocks_classes.rb
438
442
  homepage: http://www.elastic.co/guide/en/logstash/current/index.html
439
443
  licenses:
440
444
  - Apache License (2.0)
@@ -445,17 +449,17 @@ require_paths:
445
449
  - lib
446
450
  required_ruby_version: !ruby/object:Gem::Requirement
447
451
  requirements:
448
- - - ">="
452
+ - - '>='
449
453
  - !ruby/object:Gem::Version
450
454
  version: '0'
451
455
  required_rubygems_version: !ruby/object:Gem::Requirement
452
456
  requirements:
453
- - - ">"
457
+ - - '>'
454
458
  - !ruby/object:Gem::Version
455
459
  version: 1.3.1
456
460
  requirements: []
457
461
  rubyforge_project:
458
- rubygems_version: 2.4.8
462
+ rubygems_version: 2.4.5
459
463
  signing_key:
460
464
  specification_version: 4
461
465
  summary: logstash-core - The core components of logstash
@@ -495,6 +499,7 @@ test_files:
495
499
  - spec/logstash/pipeline_reporter_spec.rb
496
500
  - spec/logstash/pipeline_spec.rb
497
501
  - spec/logstash/plugin_spec.rb
502
+ - spec/logstash/plugins/registry_spec.rb
498
503
  - spec/logstash/runner_spec.rb
499
504
  - spec/logstash/shutdown_watcher_spec.rb
500
505
  - spec/logstash/util/buftok_spec.rb
@@ -507,4 +512,6 @@ test_files:
507
512
  - spec/logstash/util/worker_threads_default_printer_spec.rb
508
513
  - spec/logstash/util/wrapped_synchronous_queue_spec.rb
509
514
  - spec/logstash/util_spec.rb
515
+ - spec/static/i18n_spec.rb
510
516
  - spec/support/matchers.rb
517
+ - spec/support/mocks_classes.rb