logstash-core 5.0.0.alpha3.snapshot5-java → 5.0.0.alpha3.snapshot6-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.

Potentially problematic release.


This version of logstash-core might be problematic. Click here for more details.

Files changed (53) hide show
  1. checksums.yaml +4 -4
  2. data/lib/logstash-core/version.rb +1 -1
  3. data/lib/logstash/api/{lib/helpers/app_helpers.rb → app_helpers.rb} +0 -0
  4. data/lib/logstash/api/command_factory.rb +34 -0
  5. data/lib/logstash/api/commands/base.rb +25 -0
  6. data/lib/logstash/api/commands/stats.rb +105 -0
  7. data/lib/logstash/api/commands/system/basicinfo_command.rb +23 -0
  8. data/lib/logstash/api/commands/system/plugins_command.rb +35 -0
  9. data/lib/logstash/api/modules/base.rb +41 -0
  10. data/lib/logstash/api/modules/node.rb +24 -0
  11. data/lib/logstash/api/modules/node_stats.rb +59 -0
  12. data/lib/logstash/api/modules/plugins.rb +15 -0
  13. data/lib/logstash/api/modules/root.rb +15 -0
  14. data/lib/logstash/api/modules/stats.rb +63 -0
  15. data/lib/logstash/api/rack_app.rb +33 -0
  16. data/lib/logstash/api/service.rb +73 -0
  17. data/lib/logstash/instrument/metric_store.rb +11 -1
  18. data/lib/logstash/instrument/periodic_poller/base.rb +2 -0
  19. data/lib/logstash/instrument/periodic_poller/jvm.rb +47 -2
  20. data/lib/logstash/util/thread_dump.rb +55 -0
  21. data/lib/logstash/version.rb +1 -1
  22. data/lib/logstash/webserver.rb +15 -49
  23. data/locales/en.yml +5 -5
  24. data/logstash-core.gemspec +3 -3
  25. data/spec/api/lib/api/node_spec.rb +2 -2
  26. data/spec/api/lib/api/node_stats_spec.rb +32 -57
  27. data/spec/api/lib/api/plugins_spec.rb +2 -2
  28. data/spec/api/lib/api/root_spec.rb +2 -2
  29. data/spec/api/lib/api/support/resource_dsl_methods.rb +47 -0
  30. data/spec/api/lib/commands/stats.rb +47 -0
  31. data/spec/api/spec_helper.rb +2 -5
  32. data/spec/logstash/agent_spec.rb +1 -1
  33. data/spec/logstash/instrument/periodic_poller/jvm_spec.rb +45 -0
  34. metadata +30 -38
  35. data/lib/logstash/api/init.ru +0 -31
  36. data/lib/logstash/api/lib/app.rb +0 -40
  37. data/lib/logstash/api/lib/app/command.rb +0 -29
  38. data/lib/logstash/api/lib/app/command_factory.rb +0 -29
  39. data/lib/logstash/api/lib/app/commands/stats/events_command.rb +0 -13
  40. data/lib/logstash/api/lib/app/commands/stats/hotthreads_command.rb +0 -120
  41. data/lib/logstash/api/lib/app/commands/stats/memory_command.rb +0 -25
  42. data/lib/logstash/api/lib/app/commands/system/basicinfo_command.rb +0 -15
  43. data/lib/logstash/api/lib/app/commands/system/plugins_command.rb +0 -28
  44. data/lib/logstash/api/lib/app/modules/node.rb +0 -25
  45. data/lib/logstash/api/lib/app/modules/node_stats.rb +0 -51
  46. data/lib/logstash/api/lib/app/modules/plugins.rb +0 -15
  47. data/lib/logstash/api/lib/app/modules/stats.rb +0 -21
  48. data/lib/logstash/api/lib/app/root.rb +0 -13
  49. data/lib/logstash/api/lib/app/service.rb +0 -61
  50. data/lib/logstash/api/lib/app/stats.rb +0 -56
  51. data/spec/api/lib/api/stats_spec.rb +0 -19
  52. data/spec/api/lib/commands/events_spec.rb +0 -17
  53. data/spec/api/lib/commands/jvm_spec.rb +0 -45
@@ -1,13 +0,0 @@
1
- # encoding: utf-8
2
- require "app"
3
-
4
- module LogStash::Api
5
- class Root < BaseApp
6
-
7
- get "/" do
8
- command = factory.build(:system_basic_info)
9
- respond_with command.run
10
- end
11
-
12
- end
13
- end
@@ -1,61 +0,0 @@
1
- # encoding: utf-8
2
- require "logstash/instrument/collector"
3
- require "logstash/util/loggable"
4
-
5
- class LogStash::Api::Service
6
-
7
- include Singleton
8
- include LogStash::Util::Loggable
9
-
10
- def initialize
11
- @snapshot_rotation_mutex = Mutex.new
12
- @snapshot = nil
13
- logger.debug("[api-service] start") if logger.debug?
14
- LogStash::Instrument::Collector.instance.add_observer(self)
15
- end
16
-
17
- def stop
18
- logger.debug("[api-service] stop") if logger.debug?
19
- LogStash::Instrument::Collector.instance.delete_observer(self)
20
- end
21
-
22
- def agent
23
- LogStash::Instrument::Collector.instance.agent
24
- end
25
-
26
- def started?
27
- !@snapshot.nil? && has_counters?
28
- end
29
-
30
- def update(snapshot)
31
- logger.debug("[api-service] snapshot received", :snapshot_time => snapshot.created_at) if logger.debug?
32
- if @snapshot_rotation_mutex.try_lock
33
- @snapshot = snapshot
34
- @snapshot_rotation_mutex.unlock
35
- end
36
- end
37
-
38
- def get(key)
39
- metric_store = @snapshot.metric_store
40
- if key == :jvm_memory_stats
41
- data = metric_store.get_with_path("jvm/memory")[:jvm][:memory]
42
- else
43
- data = metric_store.get_with_path("stats/events")
44
- end
45
- LogStash::Json.dump(data)
46
- end
47
-
48
- private
49
-
50
- def has_counters?
51
- (["LogStash::Instrument::MetricType::Counter", "LogStash::Instrument::MetricType::Gauge"] - metric_types).empty?
52
- end
53
-
54
- def metric_types
55
- types = []
56
- @snapshot_rotation_mutex.synchronize do
57
- types = @snapshot.metric_store.all.map { |t| t.class.to_s }
58
- end
59
- return types
60
- end
61
- end
@@ -1,56 +0,0 @@
1
- # encoding: utf-8
2
- require "app"
3
- require "app/stats/events_command"
4
- require "app/stats/hotthreads_command"
5
-
6
- module LogStash::Api
7
- class Stats < BaseApp
8
-
9
- helpers AppHelpers
10
-
11
-
12
- # Global _stats resource where all information is
13
- # retrieved and show
14
- get "/" do
15
- events_command = factory.build(:events_command)
16
- memory_command = factory.build(:memory_command)
17
- payload = {
18
- :events => events_command.run,
19
- :jvm => { :memory => memory_command.run }
20
- }
21
- respond_with payload
22
- end
23
-
24
- # Show all events stats information
25
- # (for ingested, emitted, dropped)
26
- # - #events since startup
27
- # - #data (bytes) since startup
28
- # - events/s
29
- # - bytes/s
30
- # - dropped events/s
31
- # - events in the pipeline
32
- get "/events" do
33
- command = factory.build(:events_command)
34
- respond_with({ :events => command.run })
35
- end
36
-
37
- # return hot threads information
38
- get "/jvm/hot_threads" do
39
- top_threads_count = params["threads"] || 3
40
- ignore_idle_threads = params["ignore_idle_threads"] || true
41
- options = {
42
- :threads => top_threads_count.to_i,
43
- :ignore_idle_threads => as_boolean(ignore_idle_threads)
44
- }
45
- command = factory.build(:hot_threads_command)
46
- respond_with(command.run(options), :string)
47
- end
48
-
49
- # return hot threads information
50
- get "/jvm/memory" do
51
- command = factory.build(:memory_command)
52
- respond_with({ :memory => command.run })
53
- end
54
-
55
- end
56
- end
@@ -1,19 +0,0 @@
1
- # encoding: utf-8
2
- require_relative "../../spec_helper"
3
- require "sinatra"
4
- require "app/modules/stats"
5
-
6
- describe LogStash::Api::Stats do
7
-
8
- include Rack::Test::Methods
9
-
10
- def app()
11
- described_class
12
- end
13
-
14
- it "respond to the jvm resource" do
15
- do_request { get "/jvm" }
16
- expect(last_response).to be_ok
17
- end
18
-
19
- end
@@ -1,17 +0,0 @@
1
- # encoding: utf-8
2
- require_relative "../../spec_helper"
3
- require "app/commands/stats/events_command"
4
-
5
- describe LogStash::Api::StatsEventsCommand do
6
-
7
- context "#schema" do
8
-
9
- let(:report) do
10
- do_request { subject.run }
11
- end
12
-
13
- it "return events information" do
14
- expect(report).to include("in", "filtered", "out")
15
- end
16
- end
17
- end
@@ -1,45 +0,0 @@
1
- # encoding: utf-8
2
- require_relative "../../spec_helper"
3
- require "app/commands/stats/hotthreads_command"
4
- require "app/commands/stats/memory_command"
5
-
6
- describe "JVM stats" do
7
-
8
- describe LogStash::Api::HotThreadsCommand do
9
-
10
- let(:report) do
11
- do_request { subject.run }
12
- end
13
-
14
- context "#schema" do
15
- it "return hot threads information" do
16
- report = do_request { subject.run }
17
- expect(report.to_s).not_to be_empty
18
- end
19
-
20
- end
21
- end
22
-
23
- describe LogStash::Api::JvmMemoryCommand do
24
-
25
- context "#schema" do
26
-
27
- let(:report) do
28
- do_request { subject.run }
29
- end
30
-
31
- it "return hot threads information" do
32
- expect(report).not_to be_empty
33
- end
34
-
35
- it "return heap information" do
36
- expect(report.keys).to include(:heap_used_in_bytes)
37
- end
38
-
39
- it "return non heap information" do
40
- expect(report.keys).to include(:non_heap_used_in_bytes)
41
- end
42
-
43
- end
44
- end
45
- end