Module: LogStash::Api::Commands::Stats::PluginsStats

Defined in:
lib/logstash/api/commands/stats.rb

Class Method Summary collapse

Class Method Details

.plugin_stats(stats, plugin_type) ⇒ Object



90
91
92
93
94
95
96
97
98
# File 'lib/logstash/api/commands/stats.rb', line 90

def plugin_stats(stats, plugin_type)
  # Turn the `plugins` stats hash into an array of [ {}, {}, ... ]
  # This is to produce an array of data points, one point for each
  # plugin instance.
  return [] unless stats[:plugins] && stats[:plugins].include?(plugin_type)
  stats[:plugins][plugin_type].collect do |id, data|
    { :id => id }.merge(data)
  end
end

.report(stats) ⇒ Object



100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# File 'lib/logstash/api/commands/stats.rb', line 100

def report(stats)
  # Only one pipeline right now.
  stats = stats[:main]

  {
    :events => stats[:events],
    :plugins => {
      :inputs => plugin_stats(stats, :inputs),
      :filters => plugin_stats(stats, :filters),
      :outputs => plugin_stats(stats, :outputs)
    },
    :reloads => stats[:reloads],
    :queue => stats[:queue]
  }
end