class GroongaQueryLog::Command::Analyzer::CSVReporter

Public Class Methods

new(statistics, options) click to toggle source
# File lib/groonga-query-log/command/analyzer/reporter/csv.rb, line 25
def initialize(statistics, options)
  super
  if @options[:report_command_line].nil?
    @report_command_line = false
  end
end

Public Instance Methods

finish() click to toggle source
# File lib/groonga-query-log/command/analyzer/reporter/csv.rb, line 59
def finish
  @csv.close
end
report_statistic(statistic) click to toggle source
# File lib/groonga-query-log/command/analyzer/reporter/csv.rb, line 46
def report_statistic(statistic)
  record = [
    format_time(statistic.start_time),
    format_time(statistic.end_time),
    statistic.elapsed_in_seconds,
    statistic.return_code,
    statistic.slow?,
    statistic.command.command_name,
  ]
  record << statistic.raw_command if @report_command_line
  @csv << record
end
report_summary() click to toggle source
# File lib/groonga-query-log/command/analyzer/reporter/csv.rb, line 63
def report_summary
end
start() click to toggle source
# File lib/groonga-query-log/command/analyzer/reporter/csv.rb, line 32
def start
  @csv = CSV.new(@output)
  header = [
    "start_time",
    "end_time",
    "elapsed",
    "return_code",
    "slow",
    "command_name",
  ]
  header << "command_line" if @report_command_line
  @csv << header
end

Private Instance Methods

format_time(time) click to toggle source
# File lib/groonga-query-log/command/analyzer/reporter/csv.rb, line 67
def format_time(time)
  if time.nil?
    ""
  else
    super
  end
end