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



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

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



113
114
115
116
117
118
119
120
121
122
123
124
# File 'lib/logstash/api/commands/stats.rb', line 113

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]
}.merge(stats[:dlq] ? {:dead_letter_queue => stats[:dlq]} : {})
end