Class: LogStash::Api::Commands::Node
- Defined in:
- lib/logstash/api/commands/node.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
- #all(selected_fields = []) ⇒ Object
- #hot_threads(options = {}) ⇒ Object
- #jvm ⇒ Object
- #os ⇒ Object
- #pipeline(pipeline_id, options = {}) ⇒ Object
- #pipelines(options = {}) ⇒ Object
Methods inherited from Base
#extract_metrics, #initialize, #started_at, #uptime
Constructor Details
This class inherits a constructor from LogStash::Api::Commands::Base
Instance Method Details
#all(selected_fields = []) ⇒ Object
10 11 12 13 14 15 16 17 18 |
# File 'lib/logstash/api/commands/node.rb', line 10 def all(selected_fields=[]) payload = { :pipelines => pipelines, :os => os, :jvm => jvm } payload.select! { |k,v| selected_fields.include?(k) } unless selected_fields.empty? payload end |
#hot_threads(options = {}) ⇒ Object
80 81 82 |
# File 'lib/logstash/api/commands/node.rb', line 80 def hot_threads(={}) HotThreadsReport.new(self, ) end |
#jvm ⇒ Object
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/logstash/api/commands/node.rb', line 60 def jvm memory_bean = ManagementFactory.getMemoryMXBean() { :pid => ManagementFactory.getRuntimeMXBean().getName().split("@").first.to_i, :version => java.lang.System.getProperty("java.version"), :vm_version => java.lang.System.getProperty("java.version"), :vm_vendor => java.lang.System.getProperty("java.vendor"), :vm_name => java.lang.System.getProperty("java.vm.name"), :start_time_in_millis => started_at, :mem => { :heap_init_in_bytes => (memory_bean.getHeapMemoryUsage().getInit() < 0 ? 0 : memory_bean.getHeapMemoryUsage().getInit()), :heap_max_in_bytes => (memory_bean.getHeapMemoryUsage().getMax() < 0 ? 0 : memory_bean.getHeapMemoryUsage().getMax()), :non_heap_init_in_bytes => (memory_bean.getNonHeapMemoryUsage().getInit() < 0 ? 0 : memory_bean.getNonHeapMemoryUsage().getInit()), :non_heap_max_in_bytes => (memory_bean.getNonHeapMemoryUsage().getMax() < 0 ? 0 : memory_bean.getNonHeapMemoryUsage().getMax()) }, :gc_collectors => ManagementFactory.getGarbageCollectorMXBeans().collect(&:getName) } end |
#os ⇒ Object
51 52 53 54 55 56 57 58 |
# File 'lib/logstash/api/commands/node.rb', line 51 def os { :name => java.lang.System.getProperty("os.name"), :arch => java.lang.System.getProperty("os.arch"), :version => java.lang.System.getProperty("os.version"), :available_processors => java.lang.Runtime.getRuntime().availableProcessors() } end |
#pipeline(pipeline_id, options = {}) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/logstash/api/commands/node.rb', line 27 def pipeline(pipeline_id, ={}) metrics = extract_metrics( [:stats, :pipelines, pipeline_id.to_sym, :config], :ephemeral_id, :hash, :workers, :batch_size, :batch_delay, :config_reload_automatic, :config_reload_interval, :dead_letter_queue_enabled, :dead_letter_queue_path, ).reject{|_, v|v.nil?} if .fetch(:graph, false) extended_stats = extract_metrics([:stats, :pipelines, pipeline_id.to_sym, :config], :graph) decorated_vertices = extended_stats[:graph]["graph"]["vertices"].map { |vertex| decorate_with_cluster_uuids(vertex) } extended_stats[:graph]["graph"]["vertices"] = decorated_vertices metrics.merge!(extended_stats) end metrics rescue {} end |
#pipelines(options = {}) ⇒ Object
20 21 22 23 24 25 |
# File 'lib/logstash/api/commands/node.rb', line 20 def pipelines(={}) pipeline_ids = service.get_shallow(:stats, :pipelines).keys pipeline_ids.each_with_object({}) do |pipeline_id, result| result[pipeline_id] = pipeline(pipeline_id, ) end end |