logstash-core 6.3.2-java → 6.4.0-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (139) hide show
  1. checksums.yaml +4 -4
  2. data/lib/logstash/agent.rb +10 -6
  3. data/lib/logstash/api/modules/logging.rb +4 -0
  4. data/lib/logstash/api/service.rb +0 -1
  5. data/lib/logstash/bootstrap_check/default_config.rb +0 -2
  6. data/lib/logstash/bootstrap_check/persisted_queue_config.rb +0 -1
  7. data/lib/logstash/codecs/base.rb +2 -4
  8. data/lib/logstash/compiler.rb +2 -3
  9. data/lib/logstash/compiler/lscl.rb +0 -1
  10. data/lib/logstash/config/config_ast.rb +0 -1
  11. data/lib/logstash/config/cpu_core_strategy.rb +0 -1
  12. data/lib/logstash/config/defaults.rb +0 -1
  13. data/lib/logstash/config/file.rb +0 -2
  14. data/lib/logstash/config/mixin.rb +4 -7
  15. data/lib/logstash/config/modules_common.rb +0 -2
  16. data/lib/logstash/config/source/local.rb +1 -3
  17. data/lib/logstash/config/source/modules.rb +0 -2
  18. data/lib/logstash/config/source/multi_local.rb +0 -1
  19. data/lib/logstash/config/source_loader.rb +1 -2
  20. data/lib/logstash/dependency_report.rb +19 -6
  21. data/lib/logstash/elasticsearch_client.rb +0 -2
  22. data/lib/logstash/environment.rb +3 -2
  23. data/lib/logstash/errors.rb +1 -15
  24. data/lib/logstash/event.rb +0 -1
  25. data/lib/logstash/event_dispatcher.rb +1 -40
  26. data/lib/logstash/execution_context.rb +2 -19
  27. data/lib/logstash/filters/base.rb +0 -2
  28. data/lib/logstash/inputs/base.rb +2 -4
  29. data/lib/logstash/inputs/threadable.rb +2 -3
  30. data/lib/logstash/instrument/collector.rb +0 -2
  31. data/lib/logstash/instrument/metric.rb +1 -105
  32. data/lib/logstash/instrument/namespaced_metric.rb +1 -58
  33. data/lib/logstash/instrument/namespaced_null_metric.rb +1 -58
  34. data/lib/logstash/instrument/null_metric.rb +2 -71
  35. data/lib/logstash/instrument/periodic_poller/base.rb +0 -1
  36. data/lib/logstash/instrument/periodic_poller/cgroup.rb +0 -1
  37. data/lib/logstash/java_pipeline.rb +33 -222
  38. data/lib/logstash/json.rb +0 -1
  39. data/lib/logstash/logging.rb +0 -2
  40. data/lib/logstash/logging/logger.rb +1 -159
  41. data/lib/logstash/modules/cli_parser.rb +0 -4
  42. data/lib/logstash/modules/elasticsearch_config.rb +0 -3
  43. data/lib/logstash/modules/elasticsearch_importer.rb +0 -3
  44. data/lib/logstash/modules/elasticsearch_resource.rb +0 -1
  45. data/lib/logstash/modules/file_reader.rb +0 -2
  46. data/lib/logstash/modules/kibana_base.rb +0 -1
  47. data/lib/logstash/modules/kibana_client.rb +0 -2
  48. data/lib/logstash/modules/kibana_config.rb +0 -3
  49. data/lib/logstash/modules/kibana_dashboards.rb +0 -2
  50. data/lib/logstash/modules/kibana_importer.rb +0 -3
  51. data/lib/logstash/modules/kibana_resource.rb +0 -1
  52. data/lib/logstash/modules/kibana_settings.rb +0 -2
  53. data/lib/logstash/modules/logstash_config.rb +0 -1
  54. data/lib/logstash/modules/resource_base.rb +0 -1
  55. data/lib/logstash/modules/scaffold.rb +0 -3
  56. data/lib/logstash/modules/settings_merger.rb +0 -2
  57. data/lib/logstash/namespace.rb +2 -15
  58. data/lib/logstash/outputs/base.rb +3 -5
  59. data/lib/logstash/patches/clamp.rb +6 -0
  60. data/lib/logstash/pipeline.rb +38 -180
  61. data/lib/logstash/pipeline_action/create.rb +0 -2
  62. data/lib/logstash/pipeline_action/reload.rb +1 -4
  63. data/lib/logstash/pipeline_action/stop.rb +0 -2
  64. data/lib/logstash/pipeline_reporter.rb +2 -108
  65. data/lib/logstash/plugin.rb +4 -7
  66. data/lib/logstash/plugins/hooks_registry.rb +1 -63
  67. data/lib/logstash/plugins/registry.rb +3 -2
  68. data/lib/logstash/runner.rb +6 -7
  69. data/lib/logstash/settings.rb +4 -5
  70. data/lib/logstash/shutdown_watcher.rb +0 -119
  71. data/lib/logstash/universal_plugin.rb +1 -13
  72. data/lib/logstash/util.rb +0 -1
  73. data/lib/logstash/util/buftok.rb +1 -139
  74. data/lib/logstash/util/byte_value.rb +2 -3
  75. data/lib/logstash/util/charset.rb +0 -1
  76. data/lib/logstash/util/cloud_setting_auth.rb +0 -1
  77. data/lib/logstash/util/cloud_setting_id.rb +20 -8
  78. data/lib/logstash/util/dead_letter_queue_manager.rb +2 -61
  79. data/lib/logstash/util/decorators.rb +0 -1
  80. data/lib/logstash/util/loggable.rb +1 -31
  81. data/lib/logstash/util/modules_setting_array.rb +2 -2
  82. data/lib/logstash/util/password.rb +0 -1
  83. data/lib/logstash/util/plugin_version.rb +0 -1
  84. data/lib/logstash/util/safe_uri.rb +7 -8
  85. data/lib/logstash/util/secretstore.rb +1 -38
  86. data/lib/logstash/util/substitution_variables.rb +4 -5
  87. data/lib/logstash/util/worker_threads_default_printer.rb +0 -1
  88. data/locales/en.yml +28 -1
  89. data/spec/logstash/config/mixin_spec.rb +4 -4
  90. data/spec/logstash/converge_result_spec.rb +0 -1
  91. data/spec/logstash/event_dispatcher_spec.rb +0 -2
  92. data/spec/logstash/event_spec.rb +22 -26
  93. data/spec/logstash/execution_context_spec.rb +0 -2
  94. data/spec/logstash/filter_delegator_spec.rb +12 -28
  95. data/spec/logstash/inputs/base_spec.rb +4 -5
  96. data/spec/logstash/instrument/metric_spec.rb +0 -1
  97. data/spec/logstash/instrument/namespaced_metric_spec.rb +0 -2
  98. data/spec/logstash/instrument/namespaced_null_metric_spec.rb +1 -3
  99. data/spec/logstash/instrument/null_metric_spec.rb +1 -4
  100. data/spec/logstash/instrument/periodic_poller/base_spec.rb +0 -1
  101. data/spec/logstash/instrument/periodic_poller/os_spec.rb +0 -1
  102. data/spec/logstash/instrument/wrapped_write_client_spec.rb +0 -1
  103. data/spec/logstash/java_filter_delegator_spec.rb +0 -3
  104. data/spec/logstash/java_integration_spec.rb +0 -1
  105. data/spec/logstash/java_pipeline_spec.rb +1 -4
  106. data/spec/logstash/modules/cli_parser_spec.rb +1 -3
  107. data/spec/logstash/modules/scaffold_spec.rb +0 -1
  108. data/spec/logstash/outputs/base_spec.rb +9 -10
  109. data/spec/logstash/pipeline_action/create_spec.rb +2 -3
  110. data/spec/logstash/pipeline_action/reload_spec.rb +1 -2
  111. data/spec/logstash/pipeline_action/stop_spec.rb +0 -1
  112. data/spec/logstash/pipeline_dlq_commit_spec.rb +0 -6
  113. data/spec/logstash/pipeline_reporter_spec.rb +18 -4
  114. data/spec/logstash/pipeline_spec.rb +2 -6
  115. data/spec/logstash/plugin_spec.rb +1 -2
  116. data/spec/logstash/plugins/hooks_registry_spec.rb +0 -2
  117. data/spec/logstash/queue_factory_spec.rb +0 -1
  118. data/spec/logstash/runner_spec.rb +16 -9
  119. data/spec/logstash/settings/modules_spec.rb +3 -3
  120. data/spec/logstash/shutdown_watcher_spec.rb +0 -27
  121. data/spec/logstash/state_resolver_spec.rb +0 -1
  122. data/spec/logstash/util/buftok_spec.rb +0 -1
  123. data/spec/logstash/util/cloud_setting_id_spec.rb +55 -2
  124. data/spec/logstash/util/secretstore_spec.rb +10 -10
  125. data/spec/logstash/util/wrapped_synchronous_queue_spec.rb +2 -2
  126. data/versions-gem-copy.yml +2 -2
  127. metadata +2 -16
  128. data/lib/logstash/bootstrap_check/bad_java.rb +0 -16
  129. data/lib/logstash/bootstrap_check/bad_ruby.rb +0 -12
  130. data/lib/logstash/converge_result.rb +0 -103
  131. data/lib/logstash/instrument/global_metrics.rb +0 -13
  132. data/lib/logstash/instrument/snapshot.rb +0 -15
  133. data/lib/logstash/java_integration.rb +0 -116
  134. data/lib/logstash/logging/json.rb +0 -21
  135. data/lib/logstash/plugins/plugin_factory.rb +0 -107
  136. data/lib/logstash/queue_factory.rb +0 -34
  137. data/lib/logstash/util/retryable.rb +0 -40
  138. data/spec/logstash/output_delegator_spec.rb +0 -201
  139. data/spec/logstash/timestamp_spec.rb +0 -45
@@ -25,7 +25,7 @@ describe LogStash::Util::CloudSettingId do
25
25
  let(:raw) {%w(first second)}
26
26
  let(:input) { described_class.cloud_id_encode(*raw) }
27
27
  it "raises an error" do
28
- expect{subject}.to raise_exception(ArgumentError, "Cloud Id does not decode. You may need to enable Kibana in the Cloud UI. Received: \"#{raw[0]}$#{raw[1]}\".")
28
+ expect{subject}.to raise_exception(ArgumentError, "Cloud Id, after decoding, is invalid. Format: '<segment1>$<segment2>$<segment3>'. Received: \"#{raw[0]}$#{raw[1]}\".")
29
29
  end
30
30
  end
31
31
 
@@ -90,4 +90,57 @@ describe LogStash::Util::CloudSettingId do
90
90
  expect(subject.to_s).to eq(subject.decoded)
91
91
  end
92
92
  end
93
- end
93
+ context "when cloud id contains port descriptions for ES and Kibana" do
94
+ let(:input) { "different-es-kb-port:dXMtY2VudHJhbDEuZ2NwLmNsb3VkLmVzLmlvJGFjMzFlYmI5MDI0MTc3MzE1NzA0M2MzNGZkMjZmZDQ2OjkyNDMkYTRjMDYyMzBlNDhjOGZjZTdiZTg4YTA3NGEzYmIzZTA6OTI0NA==" }
95
+
96
+ it "decodes the elasticsearch port corretly" do
97
+ expect(subject.elasticsearch_host).to eq("ac31ebb90241773157043c34fd26fd46.us-central1.gcp.cloud.es.io:9243")
98
+ end
99
+ it "decodes the kibana port corretly" do
100
+ expect(subject.kibana_host).to eq("a4c06230e48c8fce7be88a074a3bb3e0.us-central1.gcp.cloud.es.io:9244")
101
+ end
102
+ end
103
+ context "when cloud id contains cloud port" do
104
+ let(:input) { "custom-port:dXMtY2VudHJhbDEuZ2NwLmNsb3VkLmVzLmlvOjkyNDMkYWMzMWViYjkwMjQxNzczMTU3MDQzYzM0ZmQyNmZkNDYkYTRjMDYyMzBlNDhjOGZjZTdiZTg4YTA3NGEzYmIzZTA=" }
105
+
106
+ it "decodes the elasticsearch port corretly" do
107
+ expect(subject.elasticsearch_host).to eq("ac31ebb90241773157043c34fd26fd46.us-central1.gcp.cloud.es.io:9243")
108
+ end
109
+ it "decodes the kibana port corretly" do
110
+ expect(subject.kibana_host).to eq("a4c06230e48c8fce7be88a074a3bb3e0.us-central1.gcp.cloud.es.io:9243")
111
+ end
112
+ end
113
+ context "when cloud id only defines kibana port" do
114
+ let(:input) { "only-kb-set:dXMtY2VudHJhbDEuZ2NwLmNsb3VkLmVzLmlvJGFjMzFlYmI5MDI0MTc3MzE1NzA0M2MzNGZkMjZmZDQ2JGE0YzA2MjMwZTQ4YzhmY2U3YmU4OGEwNzRhM2JiM2UwOjkyNDQ=" }
115
+
116
+ it "defaults the elasticsearch port to 443" do
117
+ expect(subject.elasticsearch_host).to eq("ac31ebb90241773157043c34fd26fd46.us-central1.gcp.cloud.es.io:443")
118
+ end
119
+ it "decodes the kibana port corretly" do
120
+ expect(subject.kibana_host).to eq("a4c06230e48c8fce7be88a074a3bb3e0.us-central1.gcp.cloud.es.io:9244")
121
+ end
122
+ end
123
+ context "when cloud id defines cloud port and kibana port" do
124
+ let(:input) { "host-and-kb-set:dXMtY2VudHJhbDEuZ2NwLmNsb3VkLmVzLmlvOjkyNDMkYWMzMWViYjkwMjQxNzczMTU3MDQzYzM0ZmQyNmZkNDYkYTRjMDYyMzBlNDhjOGZjZTdiZTg4YTA3NGEzYmIzZTA6OTI0NA==" }
125
+
126
+ it "sets the elasticsearch port to cloud port" do
127
+ expect(subject.elasticsearch_host).to eq("ac31ebb90241773157043c34fd26fd46.us-central1.gcp.cloud.es.io:9243")
128
+ end
129
+ it "overrides cloud port with the kibana port" do
130
+ expect(subject.kibana_host).to eq("a4c06230e48c8fce7be88a074a3bb3e0.us-central1.gcp.cloud.es.io:9244")
131
+ end
132
+ end
133
+ context "when cloud id defines extra data" do
134
+ let(:input) { "extra-items:dXMtY2VudHJhbDEuZ2NwLmNsb3VkLmVzLmlvJGFjMzFlYmI5MDI0MTc3MzE1NzA0M2MzNGZkMjZmZDQ2JGE0YzA2MjMwZTQ4YzhmY2U3YmU4OGEwNzRhM2JiM2UwJGFub3RoZXJpZCRhbmRhbm90aGVy" }
135
+
136
+ it "captures the elasticsearch host" do
137
+ expect(subject.elasticsearch_host).to eq("ac31ebb90241773157043c34fd26fd46.us-central1.gcp.cloud.es.io:443")
138
+ end
139
+ it "captures the kibana host" do
140
+ expect(subject.kibana_host).to eq("a4c06230e48c8fce7be88a074a3bb3e0.us-central1.gcp.cloud.es.io:443")
141
+ end
142
+ it "captures the remaining identifiers" do
143
+ expect(subject.other_identifiers).to eq(["anotherid", "andanother"])
144
+ end
145
+ end
146
+ end
@@ -1,9 +1,10 @@
1
- require "logstash/util/secretstore"
2
1
  require "logstash/settings"
3
2
 
4
- describe LogStash::Util::SecretStore do
3
+ java_import "org.logstash.secret.store.SecretStoreExt"
5
4
 
6
- subject {LogStash::Util::SecretStore}
5
+ describe SecretStoreExt do
6
+
7
+ subject {SecretStoreExt}
7
8
 
8
9
  describe "with missing keystore" do
9
10
  before :each do
@@ -11,8 +12,8 @@ describe LogStash::Util::SecretStore do
11
12
  end
12
13
 
13
14
  it "should be not exist" do
14
- expect(subject.exists?).to be_falsy
15
- expect(subject.get_if_exists).to be_nil
15
+ expect(subject.exists(LogStash::SETTINGS.get_setting("keystore.file").value, LogStash::SETTINGS.get_setting("keystore.classname").value)).to be_falsy
16
+ expect(subject.getIfExists(LogStash::SETTINGS.get_setting("keystore.file").value, LogStash::SETTINGS.get_setting("keystore.classname").value)).to be_nil
16
17
  end
17
18
  end
18
19
 
@@ -22,7 +23,7 @@ describe LogStash::Util::SecretStore do
22
23
  end
23
24
 
24
25
  it "should be readable" do
25
- expect(subject.get_if_exists.list).to include(subject.get_store_id("keystore.seed"))
26
+ expect(subject.getIfExists(LogStash::SETTINGS.get_setting("keystore.file").value, LogStash::SETTINGS.get_setting("keystore.classname").value).list).to include(subject.get_store_id("keystore.seed"))
26
27
  end
27
28
  end
28
29
 
@@ -41,7 +42,7 @@ describe LogStash::Util::SecretStore do
41
42
  end
42
43
 
43
44
  it "should be readable" do
44
- expect(subject.get_if_exists.list).to include(subject.get_store_id("keystore.seed"))
45
+ expect(subject.getIfExists(LogStash::SETTINGS.get_setting("keystore.file").value, LogStash::SETTINGS.get_setting("keystore.classname").value).list).to include(subject.get_store_id("keystore.seed"))
45
46
  end
46
47
  end
47
48
 
@@ -55,15 +56,14 @@ describe LogStash::Util::SecretStore do
55
56
  end
56
57
 
57
58
  it "should be not readable" do
58
- expect {subject.get_if_exists}.to raise_error.with_message(/Can not access Logstash keystore/)
59
+ expect {subject.getIfExists(LogStash::SETTINGS.get_setting("keystore.file").value, LogStash::SETTINGS.get_setting("keystore.classname").value)}.to raise_error.with_message(/Can not access Logstash keystore/)
59
60
  end
60
61
  end
61
62
 
62
63
  describe "and missing password" do
63
64
  it "should be not readable" do
64
- expect {subject.get_if_exists}.to raise_error.with_message(/Could not determine keystore password/)
65
+ expect {subject.getIfExists(LogStash::SETTINGS.get_setting("keystore.file").value, LogStash::SETTINGS.get_setting("keystore.classname").value)}.to raise_error.with_message(/Could not determine keystore password/)
65
66
  end
66
67
  end
67
68
  end
68
-
69
69
  end
@@ -84,8 +84,8 @@ describe LogStash::WrappedSynchronousQueue do
84
84
 
85
85
  context "when writing to the queue" do
86
86
  before :each do
87
- read_client.set_events_metric(LogStash::Instrument::NamespacedNullMetric.new([], :null))
88
- read_client.set_pipeline_metric(LogStash::Instrument::NamespacedNullMetric.new([], :null))
87
+ read_client.set_events_metric(LogStash::Instrument::NamespacedNullMetric.new(nil, :null))
88
+ read_client.set_pipeline_metric(LogStash::Instrument::NamespacedNullMetric.new(nil, :null))
89
89
  end
90
90
 
91
91
  it "appends batches to the queue" do
@@ -1,6 +1,6 @@
1
1
  ---
2
- logstash: 6.3.2
3
- logstash-core: 6.3.2
2
+ logstash: 6.4.0
3
+ logstash-core: 6.4.0
4
4
  logstash-core-plugin-api: 2.1.16
5
5
 
6
6
  # jruby must reference a *released* version of jruby which can be downloaded from the official download url
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: 6.3.2
4
+ version: 6.4.0
5
5
  platform: java
6
6
  authors:
7
7
  - Elastic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-07-20 00:00:00.000000000 Z
11
+ date: 2018-08-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -331,8 +331,6 @@ files:
331
331
  - lib/logstash/api/modules/stats.rb
332
332
  - lib/logstash/api/rack_app.rb
333
333
  - lib/logstash/api/service.rb
334
- - lib/logstash/bootstrap_check/bad_java.rb
335
- - lib/logstash/bootstrap_check/bad_ruby.rb
336
334
  - lib/logstash/bootstrap_check/default_config.rb
337
335
  - lib/logstash/bootstrap_check/persisted_queue_config.rb
338
336
  - lib/logstash/build.rb
@@ -356,7 +354,6 @@ files:
356
354
  - lib/logstash/config/source/multi_local.rb
357
355
  - lib/logstash/config/source_loader.rb
358
356
  - lib/logstash/config/string_escape.rb
359
- - lib/logstash/converge_result.rb
360
357
  - lib/logstash/dependency_report.rb
361
358
  - lib/logstash/dependency_report_runner.rb
362
359
  - lib/logstash/elasticsearch_client.rb
@@ -370,7 +367,6 @@ files:
370
367
  - lib/logstash/inputs/base.rb
371
368
  - lib/logstash/inputs/threadable.rb
372
369
  - lib/logstash/instrument/collector.rb
373
- - lib/logstash/instrument/global_metrics.rb
374
370
  - lib/logstash/instrument/metric.rb
375
371
  - lib/logstash/instrument/metric_store.rb
376
372
  - lib/logstash/instrument/metric_type.rb
@@ -387,12 +383,9 @@ files:
387
383
  - lib/logstash/instrument/periodic_poller/os.rb
388
384
  - lib/logstash/instrument/periodic_poller/pq.rb
389
385
  - lib/logstash/instrument/periodic_pollers.rb
390
- - lib/logstash/instrument/snapshot.rb
391
- - lib/logstash/java_integration.rb
392
386
  - lib/logstash/java_pipeline.rb
393
387
  - lib/logstash/json.rb
394
388
  - lib/logstash/logging.rb
395
- - lib/logstash/logging/json.rb
396
389
  - lib/logstash/logging/logger.rb
397
390
  - lib/logstash/modules/cli_parser.rb
398
391
  - lib/logstash/modules/elasticsearch_config.rb
@@ -436,9 +429,7 @@ files:
436
429
  - lib/logstash/plugins/builtin/pipeline/input.rb
437
430
  - lib/logstash/plugins/builtin/pipeline/output.rb
438
431
  - lib/logstash/plugins/hooks_registry.rb
439
- - lib/logstash/plugins/plugin_factory.rb
440
432
  - lib/logstash/plugins/registry.rb
441
- - lib/logstash/queue_factory.rb
442
433
  - lib/logstash/runner.rb
443
434
  - lib/logstash/settings.rb
444
435
  - lib/logstash/shutdown_watcher.rb
@@ -461,7 +452,6 @@ files:
461
452
  - lib/logstash/util/password.rb
462
453
  - lib/logstash/util/plugin_version.rb
463
454
  - lib/logstash/util/prctl.rb
464
- - lib/logstash/util/retryable.rb
465
455
  - lib/logstash/util/safe_uri.rb
466
456
  - lib/logstash/util/secretstore.rb
467
457
  - lib/logstash/util/settings_helper.rb
@@ -536,7 +526,6 @@ files:
536
526
  - spec/logstash/modules/logstash_config_spec.rb
537
527
  - spec/logstash/modules/scaffold_spec.rb
538
528
  - spec/logstash/modules/settings_merger_spec.rb
539
- - spec/logstash/output_delegator_spec.rb
540
529
  - spec/logstash/outputs/base_spec.rb
541
530
  - spec/logstash/patches_spec.rb
542
531
  - spec/logstash/pipeline_action/create_spec.rb
@@ -566,7 +555,6 @@ files:
566
555
  - spec/logstash/settings_spec.rb
567
556
  - spec/logstash/shutdown_watcher_spec.rb
568
557
  - spec/logstash/state_resolver_spec.rb
569
- - spec/logstash/timestamp_spec.rb
570
558
  - spec/logstash/util/accessors_spec.rb
571
559
  - spec/logstash/util/buftok_spec.rb
572
560
  - spec/logstash/util/byte_value_spec.rb
@@ -677,7 +665,6 @@ test_files:
677
665
  - spec/logstash/modules/logstash_config_spec.rb
678
666
  - spec/logstash/modules/scaffold_spec.rb
679
667
  - spec/logstash/modules/settings_merger_spec.rb
680
- - spec/logstash/output_delegator_spec.rb
681
668
  - spec/logstash/outputs/base_spec.rb
682
669
  - spec/logstash/patches_spec.rb
683
670
  - spec/logstash/pipeline_action/create_spec.rb
@@ -707,7 +694,6 @@ test_files:
707
694
  - spec/logstash/settings_spec.rb
708
695
  - spec/logstash/shutdown_watcher_spec.rb
709
696
  - spec/logstash/state_resolver_spec.rb
710
- - spec/logstash/timestamp_spec.rb
711
697
  - spec/logstash/util/accessors_spec.rb
712
698
  - spec/logstash/util/buftok_spec.rb
713
699
  - spec/logstash/util/byte_value_spec.rb
@@ -1,16 +0,0 @@
1
- # encoding: utf-8
2
- require "logstash/util"
3
- require "logstash/util/java_version"
4
- require "logstash/errors"
5
-
6
- module LogStash module BootstrapCheck
7
- class BadJava
8
- def self.check(settings)
9
- # Exit on bad java versions
10
- LogStash::Util::JavaVersion.validate_java_version!
11
- rescue => e
12
- # Just rewrap the original exception
13
- raise LogStash::BootstrapCheckError, e.message
14
- end
15
- end
16
- end end
@@ -1,12 +0,0 @@
1
- # encoding: utf-8
2
- require "logstash/errors"
3
-
4
- module LogStash module BootstrapCheck
5
- class BadRuby
6
- def self.check(settings)
7
- if RUBY_VERSION < "2.0"
8
- raise LogStash::BootstrapCheckError, "Ruby 2.0 or later is required. (You are running: " + RUBY_VERSION + ")"
9
- end
10
- end
11
- end
12
- end end
@@ -1,103 +0,0 @@
1
- # encoding: utf-8
2
- require "logstash/errors"
3
-
4
- module LogStash
5
- # This class allow us to keep track and uniform all the return values from the
6
- # action task
7
- class ConvergeResult
8
- class ActionResult
9
- attr_reader :executed_at
10
-
11
- def initialize
12
- @executed_at = LogStash::Timestamp.now
13
- end
14
-
15
- # Until all the action have more granularity in the validation
16
- # or execution we make the ConvergeResult works with primitives and exceptions
17
- def self.create(action, action_result)
18
- if action_result.is_a?(ActionResult)
19
- action_result
20
- elsif action_result.is_a?(Exception)
21
- FailedAction.from_exception(action_result)
22
- elsif action_result == true
23
- SuccessfulAction.new
24
- elsif action_result == false
25
- FailedAction.from_action(action, action_result)
26
- else
27
- raise LogStash::Error, "Don't know how to handle `#{action_result.class}` for `#{action}`"
28
- end
29
- end
30
- end
31
-
32
- class FailedAction < ActionResult
33
- attr_reader :message, :backtrace
34
-
35
- def initialize(message, backtrace = nil)
36
- super()
37
-
38
- @message = message
39
- @backtrace = backtrace
40
- end
41
-
42
- def self.from_exception(exception)
43
- FailedAction.new(exception.message, exception.backtrace)
44
- end
45
-
46
- def self.from_action(action, action_result)
47
- FailedAction.new("Could not execute action: #{action}, action_result: #{action_result}")
48
- end
49
-
50
- def successful?
51
- false
52
- end
53
- end
54
-
55
- class SuccessfulAction < ActionResult
56
- def successful?
57
- true
58
- end
59
- end
60
-
61
- def initialize(expected_actions_count)
62
- @expected_actions_count = expected_actions_count
63
- @actions = java.util.concurrent.ConcurrentHashMap.new
64
- end
65
-
66
- def add(action, action_result)
67
- @actions[action] = ActionResult.create(action, action_result)
68
- end
69
-
70
- def failed_actions
71
- filter_by_successful_state(false)
72
- end
73
-
74
- def successful_actions
75
- filter_by_successful_state(true)
76
- end
77
-
78
- def complete?
79
- total == @expected_actions_count
80
- end
81
-
82
- def success?
83
- failed_actions.empty? && complete?
84
- end
85
-
86
- def fails_count
87
- failed_actions.size
88
- end
89
-
90
- def success_count
91
- successful_actions.size
92
- end
93
-
94
- def total
95
- @actions.size
96
- end
97
-
98
- private
99
- def filter_by_successful_state(predicate)
100
- @actions.select { |action, action_result| action_result.successful? == predicate }
101
- end
102
- end
103
- end
@@ -1,13 +0,0 @@
1
- class GlobalMetrics
2
- class Stats(metric)
3
- @metric = metric
4
- end
5
-
6
- def initialize(metric)
7
- @metric = metric
8
-
9
- @pipeline_reloads = metric.namespace([:stats, :pipelines])
10
- end
11
-
12
-
13
- end
@@ -1,15 +0,0 @@
1
- # encoding: utf-8
2
- require "logstash/util/loggable"
3
-
4
- module LogStash module Instrument
5
- class Snapshot
6
- include LogStash::Util::Loggable
7
-
8
- attr_reader :metric_store, :created_at
9
-
10
- def initialize(metric_store, created_at = Time.now)
11
- @metric_store = metric_store
12
- @created_at = created_at
13
- end
14
- end
15
- end; end
@@ -1,116 +0,0 @@
1
- # encoding: utf-8
2
- require "java"
3
-
4
- # this is mainly for usage with JrJackson json parsing in :raw mode which generates
5
- # Java::JavaUtil::ArrayList and Java::JavaUtil::LinkedHashMap native objects for speed.
6
- # these object already quacks like their Ruby equivalents Array and Hash but they will
7
- # not test for is_a?(Array) or is_a?(Hash) and we do not want to include tests for
8
- # both classes everywhere. see LogStash::JSon.
9
-
10
- class Array
11
- # enable class equivalence between Array and ArrayList
12
- # so that ArrayList will work with case o when Array ...
13
- def self.===(other)
14
- return true if other.is_a?(Java::JavaUtil::Collection)
15
- super
16
- end
17
- end
18
-
19
- class Hash
20
- # enable class equivalence between Hash and LinkedHashMap
21
- # so that LinkedHashMap will work with case o when Hash ...
22
- def self.===(other)
23
- return true if other.is_a?(Java::JavaUtil::Map)
24
- super
25
- end
26
- end
27
-
28
- # map_mixin to patch LinkedHashMap and HashMap. it must be done directly on the classes,
29
- # using a module mixin does not work, and injecting in the Map interface does not work either
30
- # but injecting in the class works.
31
-
32
- map_mixin = lambda do
33
- # this is a temporary fix to solve a bug in JRuby where classes implementing the Map interface, like LinkedHashMap
34
- # have a bug in the has_key? method that is implemented in the Enumerable module that is somehow mixed in the Map interface.
35
- # this bug makes has_key? (and all its aliases) return false for a key that has a nil value.
36
- # Only LinkedHashMap is patched here because patching the Map interface is not working.
37
- # TODO find proper fix, and submit upstream
38
- # relevant JRuby files:
39
- # https://github.com/jruby/jruby/blob/master/core/src/main/ruby/jruby/java/java_ext/java.util.rb
40
- # https://github.com/jruby/jruby/blob/master/core/src/main/java/org/jruby/java/proxies/MapJavaProxy.java
41
- def has_key?(key)
42
- self.containsKey(key)
43
- end
44
- alias_method :include?, :has_key?
45
- alias_method :member?, :has_key?
46
- alias_method :key?, :has_key?
47
-
48
- # Java 8 Map implements a merge method with a different signature from
49
- # the Ruby Hash#merge. see https://github.com/jruby/jruby/issues/1249
50
- # this can be removed when fixed upstream
51
- if ENV_JAVA['java.specification.version'] >= '1.8'
52
- def merge(other)
53
- dup.merge!(other)
54
- end
55
- end
56
- end
57
-
58
- Java::JavaUtil::LinkedHashMap.module_exec(&map_mixin)
59
- Java::JavaUtil::HashMap.module_exec(&map_mixin)
60
-
61
- module java::util::Map
62
- # have Map objects like LinkedHashMap objects report is_a?(Array) == true
63
- def is_a?(clazz)
64
- return true if clazz == Hash
65
- super
66
- end
67
- end
68
-
69
- module java::util::Collection
70
- # have Collections objects like ArrayList report is_a?(Array) == true
71
- def is_a?(clazz)
72
- return true if clazz == Array
73
- super
74
- end
75
-
76
- # support the Ruby Array delete method on a Java Collection
77
- def delete(o)
78
- self.removeAll([o]) ? o : block_given? ? yield : nil
79
- end
80
-
81
- def compact
82
- duped = Java::JavaUtil::ArrayList.new(self)
83
- duped.compact!
84
- duped
85
- end
86
-
87
- def compact!
88
- size_before = self.size
89
- self.removeAll(java::util::Collections.singleton(nil))
90
- if size_before == self.size
91
- nil
92
- else
93
- self
94
- end
95
- end
96
-
97
- # support the Ruby intersection method on Java Collection
98
- def &(other)
99
- # transform self into a LinkedHashSet to remove duplicates and preserve order as defined by the Ruby Array intersection contract
100
- duped = Java::JavaUtil::LinkedHashSet.new(self)
101
- duped.retainAll(other)
102
- duped
103
- end
104
-
105
- # support the Ruby union method on Java Collection
106
- def |(other)
107
- # transform self into a LinkedHashSet to remove duplicates and preserve order as defined by the Ruby Array union contract
108
- duped = Java::JavaUtil::LinkedHashSet.new(self)
109
- duped.addAll(other)
110
- duped
111
- end
112
-
113
- def inspect
114
- "<#{self.class.name}:#{self.hashCode} #{self.to_a(&:inspect)}>"
115
- end
116
- end