logstash-core 6.3.2-java → 6.4.0-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 +4 -4
- data/lib/logstash/agent.rb +10 -6
- data/lib/logstash/api/modules/logging.rb +4 -0
- data/lib/logstash/api/service.rb +0 -1
- data/lib/logstash/bootstrap_check/default_config.rb +0 -2
- data/lib/logstash/bootstrap_check/persisted_queue_config.rb +0 -1
- data/lib/logstash/codecs/base.rb +2 -4
- data/lib/logstash/compiler.rb +2 -3
- data/lib/logstash/compiler/lscl.rb +0 -1
- data/lib/logstash/config/config_ast.rb +0 -1
- data/lib/logstash/config/cpu_core_strategy.rb +0 -1
- data/lib/logstash/config/defaults.rb +0 -1
- data/lib/logstash/config/file.rb +0 -2
- data/lib/logstash/config/mixin.rb +4 -7
- data/lib/logstash/config/modules_common.rb +0 -2
- data/lib/logstash/config/source/local.rb +1 -3
- data/lib/logstash/config/source/modules.rb +0 -2
- data/lib/logstash/config/source/multi_local.rb +0 -1
- data/lib/logstash/config/source_loader.rb +1 -2
- data/lib/logstash/dependency_report.rb +19 -6
- data/lib/logstash/elasticsearch_client.rb +0 -2
- data/lib/logstash/environment.rb +3 -2
- data/lib/logstash/errors.rb +1 -15
- data/lib/logstash/event.rb +0 -1
- data/lib/logstash/event_dispatcher.rb +1 -40
- data/lib/logstash/execution_context.rb +2 -19
- data/lib/logstash/filters/base.rb +0 -2
- data/lib/logstash/inputs/base.rb +2 -4
- data/lib/logstash/inputs/threadable.rb +2 -3
- data/lib/logstash/instrument/collector.rb +0 -2
- data/lib/logstash/instrument/metric.rb +1 -105
- data/lib/logstash/instrument/namespaced_metric.rb +1 -58
- data/lib/logstash/instrument/namespaced_null_metric.rb +1 -58
- data/lib/logstash/instrument/null_metric.rb +2 -71
- data/lib/logstash/instrument/periodic_poller/base.rb +0 -1
- data/lib/logstash/instrument/periodic_poller/cgroup.rb +0 -1
- data/lib/logstash/java_pipeline.rb +33 -222
- data/lib/logstash/json.rb +0 -1
- data/lib/logstash/logging.rb +0 -2
- data/lib/logstash/logging/logger.rb +1 -159
- data/lib/logstash/modules/cli_parser.rb +0 -4
- data/lib/logstash/modules/elasticsearch_config.rb +0 -3
- data/lib/logstash/modules/elasticsearch_importer.rb +0 -3
- data/lib/logstash/modules/elasticsearch_resource.rb +0 -1
- data/lib/logstash/modules/file_reader.rb +0 -2
- data/lib/logstash/modules/kibana_base.rb +0 -1
- data/lib/logstash/modules/kibana_client.rb +0 -2
- data/lib/logstash/modules/kibana_config.rb +0 -3
- data/lib/logstash/modules/kibana_dashboards.rb +0 -2
- data/lib/logstash/modules/kibana_importer.rb +0 -3
- data/lib/logstash/modules/kibana_resource.rb +0 -1
- data/lib/logstash/modules/kibana_settings.rb +0 -2
- data/lib/logstash/modules/logstash_config.rb +0 -1
- data/lib/logstash/modules/resource_base.rb +0 -1
- data/lib/logstash/modules/scaffold.rb +0 -3
- data/lib/logstash/modules/settings_merger.rb +0 -2
- data/lib/logstash/namespace.rb +2 -15
- data/lib/logstash/outputs/base.rb +3 -5
- data/lib/logstash/patches/clamp.rb +6 -0
- data/lib/logstash/pipeline.rb +38 -180
- data/lib/logstash/pipeline_action/create.rb +0 -2
- data/lib/logstash/pipeline_action/reload.rb +1 -4
- data/lib/logstash/pipeline_action/stop.rb +0 -2
- data/lib/logstash/pipeline_reporter.rb +2 -108
- data/lib/logstash/plugin.rb +4 -7
- data/lib/logstash/plugins/hooks_registry.rb +1 -63
- data/lib/logstash/plugins/registry.rb +3 -2
- data/lib/logstash/runner.rb +6 -7
- data/lib/logstash/settings.rb +4 -5
- data/lib/logstash/shutdown_watcher.rb +0 -119
- data/lib/logstash/universal_plugin.rb +1 -13
- data/lib/logstash/util.rb +0 -1
- data/lib/logstash/util/buftok.rb +1 -139
- data/lib/logstash/util/byte_value.rb +2 -3
- data/lib/logstash/util/charset.rb +0 -1
- data/lib/logstash/util/cloud_setting_auth.rb +0 -1
- data/lib/logstash/util/cloud_setting_id.rb +20 -8
- data/lib/logstash/util/dead_letter_queue_manager.rb +2 -61
- data/lib/logstash/util/decorators.rb +0 -1
- data/lib/logstash/util/loggable.rb +1 -31
- data/lib/logstash/util/modules_setting_array.rb +2 -2
- data/lib/logstash/util/password.rb +0 -1
- data/lib/logstash/util/plugin_version.rb +0 -1
- data/lib/logstash/util/safe_uri.rb +7 -8
- data/lib/logstash/util/secretstore.rb +1 -38
- data/lib/logstash/util/substitution_variables.rb +4 -5
- data/lib/logstash/util/worker_threads_default_printer.rb +0 -1
- data/locales/en.yml +28 -1
- data/spec/logstash/config/mixin_spec.rb +4 -4
- data/spec/logstash/converge_result_spec.rb +0 -1
- data/spec/logstash/event_dispatcher_spec.rb +0 -2
- data/spec/logstash/event_spec.rb +22 -26
- data/spec/logstash/execution_context_spec.rb +0 -2
- data/spec/logstash/filter_delegator_spec.rb +12 -28
- data/spec/logstash/inputs/base_spec.rb +4 -5
- data/spec/logstash/instrument/metric_spec.rb +0 -1
- data/spec/logstash/instrument/namespaced_metric_spec.rb +0 -2
- data/spec/logstash/instrument/namespaced_null_metric_spec.rb +1 -3
- data/spec/logstash/instrument/null_metric_spec.rb +1 -4
- data/spec/logstash/instrument/periodic_poller/base_spec.rb +0 -1
- data/spec/logstash/instrument/periodic_poller/os_spec.rb +0 -1
- data/spec/logstash/instrument/wrapped_write_client_spec.rb +0 -1
- data/spec/logstash/java_filter_delegator_spec.rb +0 -3
- data/spec/logstash/java_integration_spec.rb +0 -1
- data/spec/logstash/java_pipeline_spec.rb +1 -4
- data/spec/logstash/modules/cli_parser_spec.rb +1 -3
- data/spec/logstash/modules/scaffold_spec.rb +0 -1
- data/spec/logstash/outputs/base_spec.rb +9 -10
- data/spec/logstash/pipeline_action/create_spec.rb +2 -3
- data/spec/logstash/pipeline_action/reload_spec.rb +1 -2
- data/spec/logstash/pipeline_action/stop_spec.rb +0 -1
- data/spec/logstash/pipeline_dlq_commit_spec.rb +0 -6
- data/spec/logstash/pipeline_reporter_spec.rb +18 -4
- data/spec/logstash/pipeline_spec.rb +2 -6
- data/spec/logstash/plugin_spec.rb +1 -2
- data/spec/logstash/plugins/hooks_registry_spec.rb +0 -2
- data/spec/logstash/queue_factory_spec.rb +0 -1
- data/spec/logstash/runner_spec.rb +16 -9
- data/spec/logstash/settings/modules_spec.rb +3 -3
- data/spec/logstash/shutdown_watcher_spec.rb +0 -27
- data/spec/logstash/state_resolver_spec.rb +0 -1
- data/spec/logstash/util/buftok_spec.rb +0 -1
- data/spec/logstash/util/cloud_setting_id_spec.rb +55 -2
- data/spec/logstash/util/secretstore_spec.rb +10 -10
- data/spec/logstash/util/wrapped_synchronous_queue_spec.rb +2 -2
- data/versions-gem-copy.yml +2 -2
- metadata +2 -16
- data/lib/logstash/bootstrap_check/bad_java.rb +0 -16
- data/lib/logstash/bootstrap_check/bad_ruby.rb +0 -12
- data/lib/logstash/converge_result.rb +0 -103
- data/lib/logstash/instrument/global_metrics.rb +0 -13
- data/lib/logstash/instrument/snapshot.rb +0 -15
- data/lib/logstash/java_integration.rb +0 -116
- data/lib/logstash/logging/json.rb +0 -21
- data/lib/logstash/plugins/plugin_factory.rb +0 -107
- data/lib/logstash/queue_factory.rb +0 -34
- data/lib/logstash/util/retryable.rb +0 -40
- data/spec/logstash/output_delegator_spec.rb +0 -201
- data/spec/logstash/timestamp_spec.rb +0 -45
|
@@ -1,38 +1 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
# Ruby helper to work with the secret store
|
|
4
|
-
module ::LogStash::Util::SecretStore
|
|
5
|
-
|
|
6
|
-
java_import "org.logstash.secret.store.SecretStoreFactory"
|
|
7
|
-
java_import "org.logstash.secret.SecretIdentifier"
|
|
8
|
-
java_import "org.logstash.secret.store.SecureConfig"
|
|
9
|
-
java_import "org.logstash.secret.cli.SecretStoreCli"
|
|
10
|
-
|
|
11
|
-
SECRET_STORE_FACTORY = SecretStoreFactory::fromEnvironment()
|
|
12
|
-
|
|
13
|
-
# Return the configuration necessary to work with a secret store
|
|
14
|
-
def self.get_config
|
|
15
|
-
secure_config = SecureConfig.new
|
|
16
|
-
secure_config.add("keystore.file", LogStash::SETTINGS.get_setting("keystore.file").value.chars)
|
|
17
|
-
pass = ENV["LOGSTASH_KEYSTORE_PASS"]
|
|
18
|
-
secure_config.add("keystore.pass", pass.chars) unless pass.nil?
|
|
19
|
-
secure_config.add("keystore.classname", LogStash::SETTINGS.get_setting("keystore.classname").value.chars)
|
|
20
|
-
secure_config
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
# Check to see if the secret store exists, return true if exists, false otherwise
|
|
24
|
-
def self.exists?
|
|
25
|
-
SECRET_STORE_FACTORY.exists(get_config)
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
# Returns a org.logstash.secret.store.SecretStore if it exists, nil otherwise
|
|
29
|
-
def self.get_if_exists
|
|
30
|
-
SECRET_STORE_FACTORY.load(get_config) if exists?
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
# Returns a org.org.logstash.secret.SecretIdentifier for use with the secret store
|
|
34
|
-
def self.get_store_id(id)
|
|
35
|
-
SecretIdentifier.new(id)
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
end
|
|
1
|
+
# Keeping this file for backwards compatibility with plugins that include it directly.
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
# encoding: utf-8
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
require "logstash/util/secretstore"
|
|
2
|
+
|
|
3
|
+
java_import "org.logstash.secret.store.SecretStoreExt"
|
|
5
4
|
|
|
6
5
|
module ::LogStash::Util::SubstitutionVariables
|
|
7
6
|
|
|
@@ -43,8 +42,8 @@ module ::LogStash::Util::SubstitutionVariables
|
|
|
43
42
|
logger.debug("Replacing `#{placeholder}` with actual value")
|
|
44
43
|
|
|
45
44
|
#check the secret store if it exists
|
|
46
|
-
secret_store = LogStash::
|
|
47
|
-
replacement = secret_store.nil? ? nil : secret_store.retrieveSecret(
|
|
45
|
+
secret_store = SecretStoreExt.getIfExists(LogStash::SETTINGS.get_setting("keystore.file").value, LogStash::SETTINGS.get_setting("keystore.classname").value)
|
|
46
|
+
replacement = secret_store.nil? ? nil : secret_store.retrieveSecret(SecretStoreExt.getStoreId(name))
|
|
48
47
|
#check the environment
|
|
49
48
|
replacement = ENV.fetch(name, default) if replacement.nil?
|
|
50
49
|
if replacement.nil?
|
data/locales/en.yml
CHANGED
|
@@ -228,6 +228,33 @@ en:
|
|
|
228
228
|
"%{default_output}"
|
|
229
229
|
If you wish to use both defaults, please use
|
|
230
230
|
the empty string for the '-e' flag.
|
|
231
|
+
field-reference-parser: |+
|
|
232
|
+
Use the given MODE when parsing field
|
|
233
|
+
references.
|
|
234
|
+
|
|
235
|
+
The field reference parser is used to expand
|
|
236
|
+
field references in your pipeline configs,
|
|
237
|
+
and will be becoming more strict to better
|
|
238
|
+
handle illegal and ambbiguous inputs in a
|
|
239
|
+
future release of Logstash.
|
|
240
|
+
|
|
241
|
+
Available MODEs are:
|
|
242
|
+
- `LEGACY`: parse with the legacy parser,
|
|
243
|
+
which is known to handle ambiguous- and
|
|
244
|
+
illegal-syntax in surprising ways;
|
|
245
|
+
warnings will not be emitted.
|
|
246
|
+
- `COMPAT`: warn once for each distinct
|
|
247
|
+
ambiguous- or illegal-syntax input, but
|
|
248
|
+
continue to expand field references with
|
|
249
|
+
the legacy parser.
|
|
250
|
+
- `STRICT`: parse in a strict manner; when
|
|
251
|
+
given ambiguous- or illegal-syntax input,
|
|
252
|
+
raises a runtime exception that should
|
|
253
|
+
be handled by the calling plugin.
|
|
254
|
+
|
|
255
|
+
The MODE can also be set with
|
|
256
|
+
`config.field_reference.parser`
|
|
257
|
+
|
|
231
258
|
modules: |+
|
|
232
259
|
Load Logstash modules.
|
|
233
260
|
Modules can be defined using multiple instances
|
|
@@ -348,4 +375,4 @@ en:
|
|
|
348
375
|
DEPRECATED: use --log.level=info instead.
|
|
349
376
|
quiet: |+
|
|
350
377
|
Set the log level to info.
|
|
351
|
-
DEPRECATED: use --log.level=
|
|
378
|
+
DEPRECATED: use --log.level=info instead.
|
|
@@ -7,7 +7,7 @@ describe LogStash::Config::Mixin do
|
|
|
7
7
|
let(:password) { "sekret" }
|
|
8
8
|
let(:double_logger) { double("logger").as_null_object }
|
|
9
9
|
|
|
10
|
-
subject do
|
|
10
|
+
subject do
|
|
11
11
|
Class.new(LogStash::Filters::Base) do
|
|
12
12
|
include LogStash::Config::Mixin
|
|
13
13
|
config_name "test_deprecated"
|
|
@@ -151,7 +151,7 @@ describe LogStash::Config::Mixin do
|
|
|
151
151
|
|
|
152
152
|
it "should raise a configuration error" do
|
|
153
153
|
expect { subject.required_strings }.to raise_error(LogStash::ConfigurationError)
|
|
154
|
-
end
|
|
154
|
+
end
|
|
155
155
|
end
|
|
156
156
|
|
|
157
157
|
context "with no value specified" do
|
|
@@ -160,7 +160,7 @@ describe LogStash::Config::Mixin do
|
|
|
160
160
|
it "should raise a configuration error" do
|
|
161
161
|
expect { subject.required_strings }.to raise_error(LogStash::ConfigurationError)
|
|
162
162
|
end
|
|
163
|
-
end
|
|
163
|
+
end
|
|
164
164
|
end
|
|
165
165
|
end
|
|
166
166
|
|
|
@@ -208,7 +208,7 @@ describe LogStash::Config::Mixin do
|
|
|
208
208
|
|
|
209
209
|
shared_examples("safe URI") do |options|
|
|
210
210
|
options ||= {}
|
|
211
|
-
|
|
211
|
+
|
|
212
212
|
subject { klass.new("uri" => uri_str) }
|
|
213
213
|
|
|
214
214
|
it "should be a SafeURI object" do
|
data/spec/logstash/event_spec.rb
CHANGED
|
@@ -76,6 +76,17 @@ describe LogStash::Event do
|
|
|
76
76
|
expect(e.get("[foo][-1]")).to eq(list[-1])
|
|
77
77
|
end
|
|
78
78
|
end
|
|
79
|
+
|
|
80
|
+
context 'with illegal-syntax field reference' do
|
|
81
|
+
# NOTE: in true-legacy-mode FieldReference parsing, the input `[` caused Logstash
|
|
82
|
+
# to crash entirely with a Java ArrayIndexOutOfBounds exception; this spec ensures that
|
|
83
|
+
# we instead raise a RuntimeException that can be handled normally within the
|
|
84
|
+
# Ruby runtime.
|
|
85
|
+
it 'raises a RuntimeError' do
|
|
86
|
+
e = LogStash::Event.new
|
|
87
|
+
expect { e.get('[') }.to raise_exception(::RuntimeError)
|
|
88
|
+
end
|
|
89
|
+
end
|
|
79
90
|
end
|
|
80
91
|
|
|
81
92
|
context "#set" do
|
|
@@ -145,32 +156,6 @@ describe LogStash::Event do
|
|
|
145
156
|
expect(e.get("foo").to_f).to be_within(0.1).of(time.to_f)
|
|
146
157
|
end
|
|
147
158
|
|
|
148
|
-
it "should set XXJavaProxy Jackson crafted" do
|
|
149
|
-
proxy = org.logstash.RspecTestUtils.getMapFixtureJackson()
|
|
150
|
-
# proxy is {"string": "foo", "int": 42, "float": 42.42, "array": ["bar","baz"], "hash": {"string":"quux"} }
|
|
151
|
-
e = LogStash::Event.new()
|
|
152
|
-
e.set("[proxy]", proxy)
|
|
153
|
-
expect(e.get("[proxy][string]")).to eql("foo")
|
|
154
|
-
expect(e.get("[proxy][int]")).to eql(42)
|
|
155
|
-
expect(e.get("[proxy][float]")).to eql(42.42)
|
|
156
|
-
expect(e.get("[proxy][array][0]")).to eql("bar")
|
|
157
|
-
expect(e.get("[proxy][array][1]")).to eql("baz")
|
|
158
|
-
expect(e.get("[proxy][hash][string]")).to eql("quux")
|
|
159
|
-
end
|
|
160
|
-
|
|
161
|
-
it "should set XXJavaProxy hand crafted" do
|
|
162
|
-
proxy = org.logstash.RspecTestUtils.getMapFixtureHandcrafted()
|
|
163
|
-
# proxy is {"string": "foo", "int": 42, "float": 42.42, "array": ["bar","baz"], "hash": {"string":"quux"} }
|
|
164
|
-
e = LogStash::Event.new()
|
|
165
|
-
e.set("[proxy]", proxy)
|
|
166
|
-
expect(e.get("[proxy][string]")).to eql("foo")
|
|
167
|
-
expect(e.get("[proxy][int]")).to eql(42)
|
|
168
|
-
expect(e.get("[proxy][float]")).to eql(42.42)
|
|
169
|
-
expect(e.get("[proxy][array][0]")).to eql("bar")
|
|
170
|
-
expect(e.get("[proxy][array][1]")).to eql("baz")
|
|
171
|
-
expect(e.get("[proxy][hash][string]")).to eql("quux")
|
|
172
|
-
end
|
|
173
|
-
|
|
174
159
|
it "should fail on non UTF-8 encoding" do
|
|
175
160
|
# e = LogStash::Event.new
|
|
176
161
|
# s1 = "\xE0 Montr\xE9al".force_encoding("ISO-8859-1")
|
|
@@ -181,6 +166,17 @@ describe LogStash::Event do
|
|
|
181
166
|
# expect(s2.encoding.name).to eq("UTF-8")
|
|
182
167
|
# expect(s2.valid_encoding?).to eq(true)
|
|
183
168
|
end
|
|
169
|
+
|
|
170
|
+
context 'with illegal-syntax field reference' do
|
|
171
|
+
# NOTE: in true-legacy-mode FieldReference parsing, the input `[` caused Logstash
|
|
172
|
+
# to crash entirely with a Java ArrayIndexOutOfBounds exception; this spec ensures that
|
|
173
|
+
# we instead raise a RuntimeException that can be handled normally within the
|
|
174
|
+
# Ruby runtime.
|
|
175
|
+
it 'raises a RuntimeError' do
|
|
176
|
+
e = LogStash::Event.new
|
|
177
|
+
expect { e.set('[', 'value') }.to raise_exception(::RuntimeError)
|
|
178
|
+
end
|
|
179
|
+
end
|
|
184
180
|
end
|
|
185
181
|
|
|
186
182
|
context "timestamp" do
|
|
@@ -1,37 +1,24 @@
|
|
|
1
1
|
# encoding: utf-8
|
|
2
2
|
require "spec_helper"
|
|
3
|
+
require 'logstash/instrument/collector'
|
|
3
4
|
require "logstash/filter_delegator"
|
|
4
|
-
require "logstash/instrument/null_metric"
|
|
5
5
|
require "logstash/event"
|
|
6
|
-
require "logstash/execution_context"
|
|
7
6
|
require "support/shared_contexts"
|
|
8
7
|
|
|
9
8
|
describe LogStash::FilterDelegator do
|
|
10
9
|
|
|
11
|
-
class MockGauge
|
|
12
|
-
def increment(_)
|
|
13
|
-
end
|
|
14
|
-
end
|
|
15
|
-
|
|
16
10
|
include_context "execution_context"
|
|
17
11
|
|
|
18
12
|
let(:filter_id) { "my-filter" }
|
|
19
13
|
let(:config) do
|
|
20
14
|
{ "host" => "127.0.0.1", "id" => filter_id }
|
|
21
15
|
end
|
|
22
|
-
let(:collector) {
|
|
23
|
-
let(:
|
|
24
|
-
let(:counter_out) { MockGauge.new }
|
|
25
|
-
let(:counter_time) { MockGauge.new }
|
|
26
|
-
let(:metric) { LogStash::Instrument::NamespacedNullMetric.new(collector, :null) }
|
|
16
|
+
let(:collector) {LogStash::Instrument::Collector.new}
|
|
17
|
+
let(:metric) { LogStash::Instrument::Metric.new(collector).namespace(:null) }
|
|
27
18
|
let(:events) { [LogStash::Event.new, LogStash::Event.new] }
|
|
28
19
|
|
|
29
20
|
before :each do
|
|
30
21
|
allow(pipeline).to receive(:id).and_return(pipeline_id)
|
|
31
|
-
allow(metric).to receive(:namespace).with(anything).and_return(metric)
|
|
32
|
-
allow(metric).to receive(:counter).with(:in).and_return(counter_in)
|
|
33
|
-
allow(metric).to receive(:counter).with(:out).and_return(counter_out)
|
|
34
|
-
allow(metric).to receive(:counter).with(:duration_in_millis).and_return(counter_time)
|
|
35
22
|
end
|
|
36
23
|
|
|
37
24
|
let(:plugin_klass) do
|
|
@@ -70,8 +57,8 @@ describe LogStash::FilterDelegator do
|
|
|
70
57
|
context "when the flush return events" do
|
|
71
58
|
it "increments the out" do
|
|
72
59
|
subject.multi_filter([LogStash::Event.new])
|
|
73
|
-
expect(counter_out).to receive(:increment).with(1)
|
|
74
60
|
subject.flush({})
|
|
61
|
+
expect(collector.snapshot_metric.metric_store.get_with_path("/null")[:null]["my-filter".to_sym][:events][:out].value).to eq(1)
|
|
75
62
|
end
|
|
76
63
|
end
|
|
77
64
|
|
|
@@ -83,18 +70,15 @@ describe LogStash::FilterDelegator do
|
|
|
83
70
|
end
|
|
84
71
|
|
|
85
72
|
context "when the filter buffer events" do
|
|
86
|
-
before do
|
|
87
|
-
allow(metric).to receive(:increment).with(anything, anything)
|
|
88
|
-
end
|
|
89
73
|
|
|
90
74
|
it "has incremented :in" do
|
|
91
|
-
expect(counter_in).to receive(:increment).with(events.size)
|
|
92
75
|
subject.multi_filter(events)
|
|
76
|
+
expect(collector.snapshot_metric.metric_store.get_with_path("/null")[:null]["my-filter".to_sym][:events][:in].value).to eq(events.size)
|
|
93
77
|
end
|
|
94
78
|
|
|
95
79
|
it "has not incremented :out" do
|
|
96
|
-
expect(counter_out).not_to receive(:increment).with(anything)
|
|
97
80
|
subject.multi_filter(events)
|
|
81
|
+
expect(collector.snapshot_metric.metric_store.get_with_path("/null")[:null]["my-filter".to_sym][:events][:out].value).to eq(0)
|
|
98
82
|
end
|
|
99
83
|
end
|
|
100
84
|
|
|
@@ -119,10 +103,10 @@ describe LogStash::FilterDelegator do
|
|
|
119
103
|
end
|
|
120
104
|
|
|
121
105
|
it "increments the in/out of the metric" do
|
|
122
|
-
expect(counter_in).to receive(:increment).with(events.size)
|
|
123
|
-
expect(counter_out).to receive(:increment).with(events.size * 2)
|
|
124
|
-
|
|
125
106
|
subject.multi_filter(events)
|
|
107
|
+
event_metrics = collector.snapshot_metric.metric_store.get_with_path("/null")[:null]["my-filter".to_sym][:events]
|
|
108
|
+
expect(event_metrics[:in].value).to eq(events.size)
|
|
109
|
+
expect(event_metrics[:out].value).to eq(2 * events.size)
|
|
126
110
|
end
|
|
127
111
|
end
|
|
128
112
|
end
|
|
@@ -148,10 +132,10 @@ describe LogStash::FilterDelegator do
|
|
|
148
132
|
end
|
|
149
133
|
|
|
150
134
|
it "increments the in/out of the metric" do
|
|
151
|
-
expect(counter_in).to receive(:increment).with(events.size)
|
|
152
|
-
expect(counter_out).to receive(:increment).with(events.size)
|
|
153
|
-
|
|
154
135
|
subject.multi_filter(events)
|
|
136
|
+
event_metrics = collector.snapshot_metric.metric_store.get_with_path("/null")[:null]["my-filter".to_sym][:events]
|
|
137
|
+
expect(event_metrics[:in].value).to eq(events.size)
|
|
138
|
+
expect(event_metrics[:out].value).to eq(events.size)
|
|
155
139
|
end
|
|
156
140
|
end
|
|
157
141
|
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
# encoding: utf-8
|
|
2
2
|
require "spec_helper"
|
|
3
|
-
require "logstash/execution_context"
|
|
4
3
|
require "logstash/inputs/base"
|
|
5
4
|
require "support/shared_contexts"
|
|
6
5
|
|
|
@@ -90,15 +89,15 @@ describe "LogStash::Inputs::Base#decorate" do
|
|
|
90
89
|
let(:input) do
|
|
91
90
|
LogStash::Inputs::NOOP.new("add_field" => {"field" => ["value1", "value2"], "field2" => "value"})
|
|
92
91
|
end
|
|
93
|
-
|
|
92
|
+
|
|
94
93
|
let(:cloned) do
|
|
95
94
|
input.clone
|
|
96
95
|
end
|
|
97
|
-
|
|
96
|
+
|
|
98
97
|
it "should clone the codec when cloned" do
|
|
99
98
|
expect(input.codec).not_to eq(cloned.codec)
|
|
100
|
-
end
|
|
101
|
-
|
|
99
|
+
end
|
|
100
|
+
|
|
102
101
|
it "should preserve codec params" do
|
|
103
102
|
expect(input.codec.params).to eq(cloned.codec.params)
|
|
104
103
|
end
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
# encoding: utf-8
|
|
2
|
-
require "logstash/instrument/namespaced_null_metric"
|
|
3
|
-
require "logstash/instrument/null_metric"
|
|
4
2
|
require_relative "../../support/matchers"
|
|
5
3
|
require "spec_helper"
|
|
6
4
|
|
|
@@ -16,7 +14,7 @@ describe LogStash::Instrument::NamespacedNullMetric do
|
|
|
16
14
|
end
|
|
17
15
|
|
|
18
16
|
it "returns a TimedException when we call without a block" do
|
|
19
|
-
expect(subject.time(:duration_ms)).to
|
|
17
|
+
expect(subject.time(:duration_ms)).to be_kind_of(LogStash::Instrument::NullMetric::NullTimedExecution)
|
|
20
18
|
end
|
|
21
19
|
|
|
22
20
|
it "returns the value of the block" do
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
# encoding: utf-8
|
|
2
|
-
require "logstash/instrument/null_metric"
|
|
3
|
-
require "logstash/instrument/namespaced_metric"
|
|
4
2
|
require_relative "../../support/shared_examples"
|
|
5
3
|
require_relative "../../support/matchers"
|
|
6
4
|
require "spec_helper"
|
|
@@ -8,8 +6,7 @@ require "spec_helper"
|
|
|
8
6
|
describe LogStash::Instrument::NullMetric do
|
|
9
7
|
|
|
10
8
|
let(:key) { "test" }
|
|
11
|
-
|
|
12
|
-
subject { LogStash::Instrument::NullMetric.new(collector) }
|
|
9
|
+
subject { LogStash::Instrument::NullMetric.new(nil) }
|
|
13
10
|
|
|
14
11
|
it "defines the same interface as `Metric`" do
|
|
15
12
|
expect(described_class).to implement_interface_of(LogStash::Instrument::Metric)
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
# encoding: utf-8
|
|
2
2
|
require "spec_helper"
|
|
3
3
|
require "logstash/filter_delegator"
|
|
4
|
-
require "logstash/instrument/null_metric"
|
|
5
4
|
require "logstash/event"
|
|
6
|
-
require "logstash/execution_context"
|
|
7
5
|
require "support/shared_contexts"
|
|
8
6
|
|
|
9
7
|
java_import org.logstash.RubyUtil
|
|
@@ -21,7 +19,6 @@ describe LogStash::JavaFilterDelegator do
|
|
|
21
19
|
let(:config) do
|
|
22
20
|
{ "host" => "127.0.0.1", "id" => filter_id }
|
|
23
21
|
end
|
|
24
|
-
let(:collector) { [] }
|
|
25
22
|
let(:metric) {
|
|
26
23
|
LogStash::Instrument::NamespacedMetric.new(
|
|
27
24
|
LogStash::Instrument::Metric.new(LogStash::Instrument::Collector.new), [:filter]
|