logstash-devutils 2.0.0-java → 2.0.1-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.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bbe4f7fcac7be8836722ca86c35bfb15ee88755b3e86090a48dc06c4956d8924
|
4
|
+
data.tar.gz: 9d0878398c1ea6025c093c4a5d52fa0dd44610337e236565b2801b301bfcdbf4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d01f4d24ac50a2b5cb26037e85035d6201626de2f3caf059e12166589f9a1f45b7e4043b887d3894befd9084858a00d1e0e1f2884a2dfa2c9acc36d3d2656638
|
7
|
+
data.tar.gz: fc51d639ee289af95294609389be443dd264603b03c31432def9552b9d30a6274f29c0390f2b1a97fa7470a02bb8271b4283c3796355a017e95010cfd0b41960
|
@@ -88,16 +88,21 @@ module LogStashHelper
|
|
88
88
|
end
|
89
89
|
end # def sample
|
90
90
|
|
91
|
+
org.logstash.config.ir.compiler.OutputStrategyExt::SimpleAbstractOutputStrategyExt.class_eval do
|
92
|
+
field_reader :output # available since LS 6.3
|
93
|
+
end
|
94
|
+
|
91
95
|
def input(config_string, test_sink: {}, &block); require 'logstash/outputs/test_sink'
|
92
96
|
config_parts = [ config_source(config_string), test_sink_output_source(**test_sink) ]
|
93
97
|
|
94
|
-
# TODO unwrapping output from LogStash::OutputDelegator is cumbersome
|
95
|
-
instances = LogStash::Outputs::TestSink::TRACKER.keys.to_a
|
96
98
|
pipeline = new_pipeline(config_parts)
|
97
99
|
|
98
|
-
|
100
|
+
output_delegator = pipeline.outputs.last # LogStash::OutputDelegator
|
101
|
+
fail('test_sink output expected') unless output_delegator.config_name.eql?('test_sink')
|
102
|
+
test_sink_output = output_delegator.strategy.to_java.output
|
103
|
+
queue = test_sink_output.init_event_store
|
99
104
|
|
100
|
-
|
105
|
+
start_thread = pipeline.start_and_wait
|
101
106
|
|
102
107
|
# NOTE: we used to pass a Queue here, now its a Java List/Queue collection
|
103
108
|
result = block.call(pipeline, queue)
|
@@ -22,7 +22,7 @@ class LogStash::Outputs::TestSink < LogStash::Outputs::Base
|
|
22
22
|
|
23
23
|
# @override plugin hook
|
24
24
|
def register
|
25
|
-
TRACKER[self] =
|
25
|
+
TRACKER[self] = @_event_store || init_event_store
|
26
26
|
end
|
27
27
|
|
28
28
|
# @override plugin impl
|
@@ -32,7 +32,8 @@ class LogStash::Outputs::TestSink < LogStash::Outputs::Base
|
|
32
32
|
|
33
33
|
# @override plugin hook
|
34
34
|
def close
|
35
|
-
TRACKER.delete(self)
|
35
|
+
TRACKER.delete(self)
|
36
|
+
@_event_store = false if release_on_close?
|
36
37
|
end
|
37
38
|
|
38
39
|
def store_events?
|
@@ -50,7 +51,24 @@ class LogStash::Outputs::TestSink < LogStash::Outputs::Base
|
|
50
51
|
|
51
52
|
# @return [Queue] (enumerable) event store
|
52
53
|
def event_store
|
53
|
-
|
54
|
+
if @_event_store.nil?
|
55
|
+
warn("#{self} event store not initialized (call plugin.register to initialize)", caller_locations(2))
|
56
|
+
return init_event_store
|
57
|
+
elsif @_event_store.eql?(false)
|
58
|
+
warn("#{self} closed - event store no longer available (release_on_close => false if you need to retain events)", caller_locations(2))
|
59
|
+
return nil
|
60
|
+
end
|
61
|
+
@_event_store
|
62
|
+
end
|
63
|
+
|
64
|
+
def init_event_store
|
65
|
+
@_event_store = Queue.new(@event_poll_timeout.to_f * 1000)
|
66
|
+
end
|
67
|
+
|
68
|
+
private
|
69
|
+
|
70
|
+
def warn(msg, callstack = nil)
|
71
|
+
Kernel.warn("#{msg}#{callstack ? " called from #{callstack.first}" : nil}")
|
54
72
|
end
|
55
73
|
|
56
74
|
# TODO refactor to java.util.concurrent.ConcurrentLinkedQueue
|
data/logstash-devutils.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logstash-devutils
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.1
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Elastic
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-03-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|