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

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: aac6580e3fcdb7a4ef97667263de8081ef5f747948508322dc44dcf58f649102
4
- data.tar.gz: 62fe96390ead958576494f6507200be79183eb4d36daf3724b9b3f9116f686ea
3
+ metadata.gz: 5e824ba00a89915dc5806c980c92edc6fcdb117f7c92eba1ce76bdee8a6730b6
4
+ data.tar.gz: 9bc5a09b8af714e11b2ac6390d05698a85d5523d0b2eff30ef3d197f2fad8f5c
5
5
  SHA512:
6
- metadata.gz: 551463904e10b3d091962829e5f55c6a32435d6f39799d725a72c8b5fa7bf5051abc4cfdd2ab6e8b509a70d28b33e9cce1deedaae16e70fefd49fb7100a61b07
7
- data.tar.gz: '08c65c30b5223731ff293615a5c321262eb2e93d6fa896d25b064ccc52de2e2b9b877e01976b156919f3e0bf4852f3c3ae261f40375332217ad246ebbb982d85'
6
+ metadata.gz: 31f101ef4e58029d9353da647dd5cef4c22d96b41ab905be18fe469ad6028cc67cfaa863a809e352f8cb887cf728f517500040a730e1c0d5664945f2c7977e7b
7
+ data.tar.gz: 99f257a1da0b6c3a30aba429edffca4b0981ab7700a95c41f8ba90701415c98153f5ed927f4b50e2da3c50783bddf8ba52eaf82d6ce2337de97bc26c3dda9a5d
@@ -10,7 +10,7 @@ module LogStash
10
10
  # return hot threads information
11
11
  get "/jvm/hot_threads" do
12
12
  begin
13
- top_threads_count = params["threads"] || 3
13
+ top_threads_count = params["threads"] || 10
14
14
  ignore_idle_threads = params["ignore_idle_threads"] || true
15
15
  options = {
16
16
  :threads => top_threads_count.to_i,
@@ -136,7 +136,7 @@ module LogStash; module Config; module AST
136
136
  events.each{|e| block.call(e)}
137
137
  end
138
138
 
139
- if @generated_objects[:#{name}].respond_to?(:flush)
139
+ if !@generated_objects[:#{name}].nil? && @generated_objects[:#{name}].has_flush
140
140
  @periodic_flushers << @generated_objects[:#{name}_flush] if @generated_objects[:#{name}].periodic_flush
141
141
  @shutdown_flushers << @generated_objects[:#{name}_flush]
142
142
  end
@@ -323,7 +323,7 @@ module LogStash::Config::Mixin
323
323
  if config_settings[:list]
324
324
  value = Array(value) # coerce scalars to lists
325
325
  # Empty lists are converted to nils
326
- return true, nil if value.empty?
326
+ return true, [] if value.empty?
327
327
 
328
328
  validated_items = value.map {|v| validate_value(v, config_val)}
329
329
  is_valid = validated_items.all? {|sr| sr[0] }
@@ -1,69 +1,2 @@
1
- # encoding: utf-8
2
- #
3
- module LogStash
4
- class FilterDelegator
5
- extend Forwardable
6
- DELEGATED_METHODS = [
7
- :register,
8
- :close,
9
- :threadsafe?,
10
- :do_close,
11
- :do_stop,
12
- :periodic_flush,
13
- :reloadable?
14
- ]
15
- def_delegators :@filter, *DELEGATED_METHODS
16
-
17
- attr_reader :id
18
-
19
- def initialize(filter, id)
20
- @klass = filter.class
21
- @id = id
22
- @filter = filter
23
-
24
- # Scope the metrics to the plugin
25
- namespaced_metric = filter.metric
26
- @metric_events = namespaced_metric.namespace(:events)
27
- @metric_events_in = @metric_events.counter(:in)
28
- @metric_events_out = @metric_events.counter(:out)
29
- @metric_events_time = @metric_events.counter(:duration_in_millis)
30
- namespaced_metric.gauge(:name, config_name)
31
-
32
- # Not all the filters will do bufferings
33
- define_flush_method if @filter.respond_to?(:flush)
34
- end
35
-
36
- def config_name
37
- @klass.config_name
38
- end
39
-
40
- def multi_filter(events)
41
- @metric_events_in.increment(events.size)
42
-
43
- start_time = java.lang.System.nano_time
44
- new_events = @filter.multi_filter(events)
45
- @metric_events_time.increment((java.lang.System.nano_time - start_time) / 1_000_000)
46
-
47
- # There is no guarantee in the context of filter
48
- # that EVENTS_IN == EVENTS_OUT, see the aggregates and
49
- # the split filter
50
- c = new_events.count { |event| !event.cancelled? }
51
- @metric_events_out.increment(c) if c > 0
52
- new_events
53
- end
54
-
55
- private
56
- def define_flush_method
57
- define_singleton_method(:flush) do |options = {}|
58
- # we also need to trace the number of events
59
- # coming from a specific filters.
60
- new_events = @filter.flush(options)
61
-
62
- # Filter plugins that does buffering or spooling of events like the
63
- # `Logstash-filter-aggregates` can return `NIL` and will flush on the next flush ticks.
64
- @metric_events_out.increment(new_events.size) if new_events && new_events.size > 0
65
- new_events
66
- end
67
- end
68
- end
69
- end
1
+ # The contents of this file have been ported to Java. It is included for for compatibility
2
+ # with plugins that directly include it.
@@ -20,8 +20,8 @@ java_import 'org.logstash.instrument.reports.ProcessReport'
20
20
  module LogStash module Instrument module PeriodicPoller
21
21
  class JVM < Base
22
22
  class GarbageCollectorName
23
- YOUNG_GC_NAMES = Set.new(["Copy", "PS Scavenge", "ParNew", "G1 Young Generation", "scavenge"])
24
- OLD_GC_NAMES = Set.new(["MarkSweepCompact", "PS MarkSweep", "ConcurrentMarkSweep", "G1 Old Generation", "global"])
23
+ YOUNG_GC_NAMES = Set.new(["Copy", "PS Scavenge", "ParNew", "G1 Young Generation", "scavenge", "GPGC New"])
24
+ OLD_GC_NAMES = Set.new(["MarkSweepCompact", "PS MarkSweep", "ConcurrentMarkSweep", "G1 Old Generation", "global", "GPGC Old"])
25
25
 
26
26
  YOUNG = :young
27
27
  OLD = :old
@@ -68,7 +68,7 @@ module LogStash module Instrument module PeriodicPoller
68
68
  logger.debug("collector name", :name => collector_name)
69
69
  name = GarbageCollectorName.get(collector_name)
70
70
  if name.nil?
71
- logger.error("Unknown garbage collector name", :name => name)
71
+ logger.error("Unknown garbage collector name", :name => collector_name)
72
72
  else
73
73
  metric.gauge([:jvm, :gc, :collectors, name], :collection_count, collector.getCollectionCount())
74
74
  metric.gauge([:jvm, :gc, :collectors, name], :collection_time_in_millis, collector.getCollectionTime())
@@ -25,6 +25,8 @@ module LogStash; class JavaPipeline < JavaBasePipeline
25
25
 
26
26
  @worker_threads = []
27
27
 
28
+ @java_inputs_controller = org.logstash.execution.InputsController.new(lir_execution.javaInputs)
29
+
28
30
  @drain_queue = settings.get_value("queue.drain") || settings.get("queue.type") == "memory"
29
31
 
30
32
  @events_filtered = java.util.concurrent.atomic.LongAdder.new
@@ -241,6 +243,7 @@ module LogStash; class JavaPipeline < JavaBasePipeline
241
243
 
242
244
  def wait_inputs
243
245
  @input_threads.each(&:join)
246
+ @java_inputs_controller.awaitStop
244
247
  end
245
248
 
246
249
  def start_inputs
@@ -259,6 +262,7 @@ module LogStash; class JavaPipeline < JavaBasePipeline
259
262
 
260
263
  # then after all input plugins are successfully registered, start them
261
264
  inputs.each { |input| start_input(input) }
265
+ @java_inputs_controller.startInputs(self)
262
266
  end
263
267
 
264
268
  def start_input(plugin)
@@ -324,6 +328,7 @@ module LogStash; class JavaPipeline < JavaBasePipeline
324
328
  def stop_inputs
325
329
  @logger.debug("Closing inputs", default_logging_keys)
326
330
  inputs.each(&:do_stop)
331
+ @java_inputs_controller.stopInputs
327
332
  @logger.debug("Closed inputs", default_logging_keys)
328
333
  end
329
334
 
@@ -262,11 +262,14 @@ module LogStash module Plugins
262
262
  # @param name [String] plugin name
263
263
  # @return [Boolean] true if klass is a valid plugin for name
264
264
  def is_a_plugin?(klass, name)
265
- klass.ancestors.include?(LogStash::Plugin) && klass.respond_to?(:config_name) && klass.config_name == name
265
+ (klass.class == Java::JavaClass && klass.simple_name.downcase == name.gsub('_','')) ||
266
+ (klass.ancestors.include?(LogStash::Plugin) && klass.respond_to?(:config_name) && klass.config_name == name)
266
267
  end
267
268
 
268
269
  def add_plugin(type, name, klass)
269
- if !exists?(type, name)
270
+ if klass.respond_to?("javaClass", true)
271
+ @registry[key_for(type, name)] = PluginSpecification.new(type, name, klass.javaClass)
272
+ elsif !exists?(type, name)
270
273
  specification_klass = type == :universal ? UniversalPluginSpecification : PluginSpecification
271
274
  @registry[key_for(type, name)] = specification_klass.new(type, name, klass)
272
275
  else
@@ -5,7 +5,7 @@ module LogStash
5
5
  module Util
6
6
  class ThreadDump
7
7
  SKIPPED_THREADS = [ "Finalizer", "Reference Handler", "Signal Dispatcher" ].freeze
8
- THREADS_COUNT_DEFAULT = 3.freeze
8
+ THREADS_COUNT_DEFAULT = 10.freeze
9
9
  IGNORE_IDLE_THREADS_DEFAULT = true.freeze
10
10
 
11
11
  attr_reader :top_count, :ignore, :dump
@@ -53,10 +53,7 @@ Gem::Specification.new do |gem|
53
53
  gem.add_runtime_dependency "filesize", "0.0.4" #(MIT license) for :bytes config validator
54
54
  gem.add_runtime_dependency "gems", "~> 0.8.3" #(MIT license)
55
55
  gem.add_runtime_dependency "concurrent-ruby", "~> 1.0", ">= 1.0.5"
56
-
57
- # Later versions are ruby 2.0 only. We should remove the rack dep once we support 9k
58
- gem.add_runtime_dependency "rack", '1.6.6'
59
-
56
+ gem.add_runtime_dependency "rack", '~> 1.6', '>= 1.6.11'
60
57
  gem.add_runtime_dependency "sinatra", '~> 1.4', '>= 1.4.6'
61
58
  gem.add_runtime_dependency 'puma', '~> 2.16'
62
59
  gem.add_runtime_dependency "jruby-openssl", ">= 0.9.20" # >= 0.9.13 Required to support TLSv1.2
@@ -132,8 +132,8 @@ describe LogStash::Config::Mixin do
132
132
  context "with an empty list" do
133
133
  let(:strings) { [] }
134
134
 
135
- it "should return nil" do
136
- expect(subject.strings).to be_nil
135
+ it "should return an empty list" do
136
+ expect(subject.strings).to be_empty
137
137
  end
138
138
  end
139
139
 
@@ -51,7 +51,7 @@ describe LogStash::FilterDelegator do
51
51
  end
52
52
 
53
53
  it "defines a flush method" do
54
- expect(subject.respond_to?(:flush)).to be_truthy
54
+ expect(subject.has_flush).to be_truthy
55
55
  end
56
56
 
57
57
  context "when the flush return events" do
@@ -128,7 +128,7 @@ describe LogStash::FilterDelegator do
128
128
  end
129
129
 
130
130
  it "doesnt define a flush method" do
131
- expect(subject.respond_to?(:flush)).to be_falsey
131
+ expect(subject.has_flush).to be_falsey
132
132
  end
133
133
 
134
134
  it "increments the in/out of the metric" do
@@ -145,14 +145,4 @@ describe LogStash::FilterDelegator do
145
145
  end
146
146
  end
147
147
 
148
- context "delegate methods to the original plugin" do
149
- # I am not testing the behavior of these methods
150
- # this is done in the plugin tests. I just want to make sure
151
- # the proxy delegates the methods.
152
- LogStash::FilterDelegator::DELEGATED_METHODS.each do |method|
153
- it "delegate method: `#{method}` to the filter" do
154
- expect(subject.respond_to?(method))
155
- end
156
- end
157
- end
158
148
  end
@@ -6,7 +6,7 @@ require "support/shared_contexts"
6
6
 
7
7
  java_import org.logstash.RubyUtil
8
8
 
9
- describe LogStash::JavaFilterDelegator do
9
+ describe LogStash::FilterDelegator do
10
10
 
11
11
  class MockGauge
12
12
  def increment(_)
@@ -182,14 +182,4 @@ describe LogStash::JavaFilterDelegator do
182
182
  end
183
183
  end
184
184
 
185
- context "delegate methods to the original plugin" do
186
- # I am not testing the behavior of these methods
187
- # this is done in the plugin tests. I just want to make sure
188
- # the proxy delegates the methods.
189
- LogStash::FilterDelegator::DELEGATED_METHODS.each do |method|
190
- it "delegate method: `#{method}` to the filter" do
191
- expect(subject.respond_to?(method))
192
- end
193
- end
194
- end
195
185
  end
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: 7.0.0.alpha1
4
+ version: 7.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: 2018-11-13 00:00:00.000000000 Z
11
+ date: 2018-12-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -103,17 +103,23 @@ dependencies:
103
103
  - !ruby/object:Gem::Dependency
104
104
  requirement: !ruby/object:Gem::Requirement
105
105
  requirements:
106
- - - '='
106
+ - - "~>"
107
+ - !ruby/object:Gem::Version
108
+ version: '1.6'
109
+ - - ">="
107
110
  - !ruby/object:Gem::Version
108
- version: 1.6.6
111
+ version: 1.6.11
109
112
  name: rack
110
113
  prerelease: false
111
114
  type: :runtime
112
115
  version_requirements: !ruby/object:Gem::Requirement
113
116
  requirements:
114
- - - '='
117
+ - - "~>"
118
+ - !ruby/object:Gem::Version
119
+ version: '1.6'
120
+ - - ">="
115
121
  - !ruby/object:Gem::Version
116
- version: 1.6.6
122
+ version: 1.6.11
117
123
  - !ruby/object:Gem::Dependency
118
124
  requirement: !ruby/object:Gem::Requirement
119
125
  requirements: