Module: LogStash::PerformanceMeter

Extended by:
PerformanceMeter
Included in:
PerformanceMeter
Defined in:
lib/lsperfm.rb,
lib/lsperfm/core.rb,
lib/lsperfm/version.rb,
lib/lsperfm/core/run.rb,
lib/lsperfm/core/stats.rb,
lib/lsperfm/core/reporter.rb,
lib/lsperfm/defaults/suite.rb

Defined Under Namespace

Classes: ConfigException, Core, Reporter, Runner, Stats

Constant Summary collapse

VERSION =
'0.1.1'
DEFAULT_SUITE =
[ { :name => "simple line in/out", :config => "#{base_dir}/config/simple.conf", :input => "#{base_dir}/input/simple_10.txt", :time => 120 },
{ :name => "simple line in/json out", :config => "#{base_dir}/config/simple_json_out.conf", :input => "#{base_dir}/input/simple_10.txt", :time => 120 },
{ :name => "json codec in/out", :config => "#{base_dir}/config/json_inout_codec.conf", :input => "#{base_dir}/input/json_medium.txt", :time => 120 },
{ :name => "line in/json filter/json out", :config => "#{base_dir}/config/json_inout_filter.conf", :input => "#{base_dir}/input/json_medium.txt", :time => 120 },
{ :name => "apache in/json out", :config => "#{base_dir}/config/simple.conf", :input => "#{base_dir}/input/apache_log.txt", :time => 120 },
{ :name => "apache in/grok codec/json out", :config => "#{base_dir}/config/simple_grok.conf", :input => "#{base_dir}/input/apache_log.txt", :time => 120 },
{ :name => "syslog in/json out", :config => "#{base_dir}/config/complex_syslog.conf", :input => "#{base_dir}/input/syslog_acl_10.txt", :time => 120} ]

Instance Method Summary collapse

Instance Method Details

#extract_options(args) ⇒ Object



114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
# File 'lib/lsperfm/core/run.rb', line 114

def extract_options(args)
  options = {}
  while !args.empty?
    config = args.shift.to_s.strip
    option = args.shift.to_s.strip
    raise(IllegalArgumentException, "invalid option for #{config}") if option.empty?
    case config
    when "--events"
      options[:events] = option
    when "--time"
      options[:time] = option
    when "--config"
      options[:config] = option
    when "--input"
      options[:input] = option
    when "--headers"
      options[:headers] = option
    else
      raise(IllegalArgumentException, "invalid config #{config}")
    end
  end

  options

end

#invokeObject



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/lsperfm.rb', line 9

def invoke
  debug   = !!ENV['DEBUG']
  headers = !!ENV['HEADERS']

  install_path  = ARGV.size > 1 ? ARGV[1] : Dir.pwd
  definition    = ARGV.size > 0 ? ARGV[0] : ""

  runner = LogStash::PerformanceMeter::Core.new(definition, install_path)
  runner.config = '.lsperfm' if File.exist?('.lsperfm.yml')
  puts runner.run(debug, headers).join("\n")
end