logstash-core 5.5.1.snapshot1-java → 5.5.2-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
  SHA1:
3
- metadata.gz: 985eec72f7499afe23ca1299dbf3c18040ccf979
4
- data.tar.gz: 54b4aceb9a9246ecaef591b2a1a41894b05fbc22
3
+ metadata.gz: 3e3a34fa89c2e677d893c0e08c30248cd0ab1afd
4
+ data.tar.gz: 1e9b3642bdecd73579f7612088bcc3c185835605
5
5
  SHA512:
6
- metadata.gz: 80dc6295efaf6483162dc1946ac8fd6e72d5f010bb871102b633465daf47871a9a4547756d86787867332e7022c22394bab5bc0881a6631ea144202234aa7300
7
- data.tar.gz: 0d68667633cca33a2b83530e6ba32816590405028d9e9f4f110ea51c975fa0c68af1ecbe5d5ee645aa79efb55fed25647a80bb524976ada6cc78260ffff8e762
6
+ metadata.gz: ab99a3bdcd46920b7da1b4c1a534ec39c38e86f6f46c6667604a43c42fcaf465f9c493bc616fa7db3fde3e971f794f7ccc8ba7ee60cc1696ea11cca379982d5c
7
+ data.tar.gz: ba03e641910ceeb050edbf3124243e9deb5acc6bc5c237289dc43b0a76f9712da7ad852b0572ebb1c75e67f43899baa300851104518b4cf71dba4937799c1fed
@@ -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.5.1.snapshot1"
8
+ LOGSTASH_CORE_VERSION = "5.5.2"
@@ -103,12 +103,12 @@ class LogStash::Agent
103
103
  @pipelines[pipeline_id] = pipeline
104
104
  end
105
105
 
106
- def reload_state!
106
+ def reload_state!(force=false)
107
107
  @upgrade_mutex.synchronize do
108
108
  @pipelines.each do |pipeline_id, pipeline|
109
- next if pipeline.settings.get("config.reload.automatic") == false
109
+ next if pipeline.settings.get("config.reload.automatic") == false && force == false
110
110
  begin
111
- reload_pipeline!(pipeline_id)
111
+ reload_pipeline!(pipeline_id, force)
112
112
  rescue => e
113
113
  @instance_reload_metric.increment(:failures)
114
114
  @pipeline_reload_metric.namespace([pipeline_id.to_sym, :reloads]).tap do |n|
@@ -297,11 +297,11 @@ class LogStash::Agent
297
297
  # reload_pipeline trys to reloads the pipeline with id using a potential new configuration if it changed
298
298
  # since this method modifies the @pipelines hash it is wrapped in @upgrade_mutex in the parent call `reload_state!`
299
299
  # @param id [String] the pipeline id to reload
300
- def reload_pipeline!(id)
300
+ def reload_pipeline!(id, force=false)
301
301
  old_pipeline = @pipelines[id]
302
302
  new_config = fetch_config(old_pipeline.settings)
303
303
 
304
- if old_pipeline.config_str == new_config
304
+ if old_pipeline.config_str == new_config && force == false
305
305
  @logger.debug("no configuration change for pipeline", :pipeline => id)
306
306
  return
307
307
  end
@@ -12,7 +12,7 @@ module LogStash
12
12
  end
13
13
 
14
14
  def host
15
- Socket.gethostname
15
+ @@host ||= Socket.gethostname
16
16
  end
17
17
 
18
18
  def version
@@ -17,7 +17,12 @@ class HotThreadsReport
17
17
  report << '=' * STRING_SEPARATOR_LENGTH
18
18
  report << "\n"
19
19
  hash[:threads].each do |thread|
20
- thread_report = "#{I18n.t("logstash.web_api.hot_threads.thread_title", :percent_of_cpu_time => thread[:percent_of_cpu_time], :thread_state => thread[:state], :thread_name => thread[:name])} \n"
20
+ line_str = I18n.t("logstash.web_api.hot_threads.thread_title",
21
+ :percent_of_cpu_time => thread[:percent_of_cpu_time],
22
+ :thread_state => thread[:state],
23
+ :thread_name => thread[:name],
24
+ :thread_id => thread[:thread_id])
25
+ thread_report = "#{line_str} \n"
21
26
  thread_report << "#{thread[:path]}\n" if thread[:path]
22
27
  thread[:traces].each do |trace|
23
28
  thread_report << "\t#{trace}\n"
@@ -31,9 +36,10 @@ class HotThreadsReport
31
36
 
32
37
  def to_hash
33
38
  hash = { :time => Time.now.iso8601, :busiest_threads => @thread_dump.top_count, :threads => [] }
34
- @thread_dump.each do |thread_name, _hash|
39
+ @thread_dump.each do |_hash|
35
40
  thread_name, thread_path = _hash["thread.name"].split(": ")
36
41
  thread = { :name => thread_name,
42
+ :thread_id => _hash["thread.id"],
37
43
  :percent_of_cpu_time => cpu_time_as_percent(_hash),
38
44
  :state => _hash["thread.state"]
39
45
  }
@@ -428,7 +428,7 @@ class LogStash::Runner < Clamp::StrictCommand
428
428
  def trap_sighup
429
429
  Stud::trap("HUP") do
430
430
  logger.warn(I18n.t("logstash.agent.sighup"))
431
- @agent.reload_state!
431
+ @agent.reload_state!(true)
432
432
  end
433
433
  end
434
434
 
@@ -19,12 +19,13 @@ module LogStash
19
19
 
20
20
  def each(&block)
21
21
  i=0
22
- dump.each_pair do |thread_name, _hash|
22
+ dump.each do |hash|
23
+ thread_name = hash["thread.name"]
23
24
  break if i >= top_count
24
25
  if ignore
25
- next if idle_thread?(thread_name, _hash)
26
+ next if idle_thread?(thread_name, hash)
26
27
  end
27
- block.call(thread_name, _hash)
28
+ block.call(hash)
28
29
  i += 1
29
30
  end
30
31
  end
@@ -100,6 +100,10 @@ module LogStash; module Util
100
100
  end
101
101
  end
102
102
 
103
+ def is_empty?
104
+ @queue.is_empty?
105
+ end
106
+
103
107
  def close
104
108
  @queue.close
105
109
  @closed.make_true
@@ -129,7 +133,7 @@ module LogStash; module Util
129
133
  def empty?
130
134
  @mutex.lock
131
135
  begin
132
- @queue.is_fully_acked?
136
+ @queue.is_empty?
133
137
  ensure
134
138
  @mutex.unlock
135
139
  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.5.1.snapshot1"
14
+ LOGSTASH_VERSION = "5.5.2"
@@ -79,7 +79,7 @@ en:
79
79
  ::: {%{hostname}}
80
80
  Hot threads at %{time}, busiestThreads=%{top_count}:
81
81
  thread_title: |-
82
- %{percent_of_cpu_time} % of cpu usage, state: %{thread_state}, thread name: '%{thread_name}'
82
+ %{percent_of_cpu_time} % of cpu usage, state: %{thread_state}, thread name: '%{thread_name}', thread id: %{thread_id}
83
83
  logging:
84
84
  unrecognized_option: |-
85
85
  unrecognized option [%{option}]
@@ -162,6 +162,19 @@ describe LogStash::Agent do
162
162
  t.join
163
163
  subject.shutdown
164
164
  end
165
+
166
+ context "and force autoreload" do
167
+ it "reloads the pipeline" do
168
+ t = Thread.new { subject.execute }
169
+ sleep(0.01) until subject.running_pipelines? && subject.pipelines.values.first.running?
170
+ expect(subject).to receive(:reload_pipeline!).with("main", true)
171
+ subject.reload_state!(true)
172
+
173
+ Stud.stop!(t)
174
+ t.join
175
+ subject.shutdown
176
+ end
177
+ end
165
178
  end
166
179
 
167
180
  context "with a pipeline with auto reloading turned on" do
@@ -0,0 +1,63 @@
1
+ # encoding: utf-8
2
+ require "spec_helper"
3
+ require "logstash/util/wrapped_acked_queue"
4
+
5
+ describe LogStash::Util::WrappedAckedQueue do
6
+ shared_examples "queue tests" do
7
+ it "is_empty? on creation" do
8
+ expect(queue.is_empty?).to be_truthy
9
+ end
10
+
11
+ it "not is_empty? after pushing an element" do
12
+ queue.push(LogStash::Event.new)
13
+ expect(queue.is_empty?).to be_falsey
14
+ end
15
+
16
+ it "not is_empty? when all elements are not acked" do
17
+ queue.push(LogStash::Event.new)
18
+ batch = queue.read_batch(1, 250)
19
+ expect(batch.get_elements.size).to eq(1)
20
+ expect(queue.is_empty?).to be_falsey
21
+ end
22
+
23
+ it "is_empty? when all elements are acked" do
24
+ queue.push(LogStash::Event.new)
25
+ batch = queue.read_batch(1, 250)
26
+ expect(batch.get_elements.size).to eq(1)
27
+ expect(queue.is_empty?).to be_falsey
28
+ batch.close
29
+ expect(queue.is_empty?).to be_truthy
30
+ end
31
+ end
32
+
33
+ context "memory" do
34
+ let(:page_capacity) { 1024 }
35
+ let(:max_events) { 0 }
36
+ let(:max_bytes) { 0 }
37
+ let(:path) { Stud::Temporary.directory }
38
+ let(:queue) { LogStash::Util::WrappedAckedQueue.create_memory_based(path, page_capacity, max_events, max_bytes) }
39
+
40
+ after do
41
+ queue.close
42
+ end
43
+
44
+ include_examples "queue tests"
45
+ end
46
+
47
+ context "persisted" do
48
+ let(:page_capacity) { 1024 }
49
+ let(:max_events) { 0 }
50
+ let(:max_bytes) { 0 }
51
+ let(:checkpoint_acks) { 1024 }
52
+ let(:checkpoint_writes) { 1024 }
53
+ let(:checkpoint_interval) { 0 }
54
+ let(:path) { Stud::Temporary.directory }
55
+ let(:queue) { LogStash::Util::WrappedAckedQueue.create_file_based(path, page_capacity, max_events, checkpoint_acks, checkpoint_writes, checkpoint_interval, max_bytes) }
56
+
57
+ after do
58
+ queue.close
59
+ end
60
+
61
+ include_examples "queue tests"
62
+ end
63
+ 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: 5.5.1.snapshot1
4
+ version: 5.5.2
5
5
  platform: java
6
6
  authors:
7
7
  - Elastic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-07-18 00:00:00.000000000 Z
11
+ date: 2017-08-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -551,6 +551,7 @@ files:
551
551
  - spec/logstash/util/safe_uri_spec.rb
552
552
  - spec/logstash/util/time_value_spec.rb
553
553
  - spec/logstash/util/unicode_trimmer_spec.rb
554
+ - spec/logstash/util/wrapped_acked_queue_spec.rb
554
555
  - spec/logstash/util/wrapped_synchronous_queue_spec.rb
555
556
  - spec/logstash/util_spec.rb
556
557
  - spec/logstash/webserver_spec.rb
@@ -575,9 +576,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
575
576
  version: '0'
576
577
  required_rubygems_version: !ruby/object:Gem::Requirement
577
578
  requirements:
578
- - - ">"
579
+ - - ">="
579
580
  - !ruby/object:Gem::Version
580
- version: 1.3.1
581
+ version: '0'
581
582
  requirements:
582
583
  - jar org.apache.logging.log4j:log4j-api, 2.6.2
583
584
  - jar org.apache.logging.log4j:log4j-core, 2.6.2
@@ -668,6 +669,7 @@ test_files:
668
669
  - spec/logstash/util/safe_uri_spec.rb
669
670
  - spec/logstash/util/time_value_spec.rb
670
671
  - spec/logstash/util/unicode_trimmer_spec.rb
672
+ - spec/logstash/util/wrapped_acked_queue_spec.rb
671
673
  - spec/logstash/util/wrapped_synchronous_queue_spec.rb
672
674
  - spec/logstash/util_spec.rb
673
675
  - spec/logstash/webserver_spec.rb