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



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

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



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

def report(stats)
  {
    :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