Method: Dexter::Processor#initialize

Defined in:
lib/dexter/processor.rb

#initialize(logfile, options) ⇒ Processor

Returns a new instance of Processor.



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/dexter/processor.rb', line 5

def initialize(logfile, options)
  @logfile = logfile

  @collector = Collector.new(min_time: options[:min_time], min_calls: options[:min_calls])
  @indexer = Indexer.new(options)

  @log_parser =
    if @logfile == :pg_stat_activity
      PgStatActivityParser.new(@indexer, @collector)
    elsif options[:input_format] == "csv"
      CsvLogParser.new(logfile, @collector)
    elsif options[:input_format] == "sql"
      SqlLogParser.new(logfile, @collector)
    else
      LogParser.new(logfile, @collector)
    end

  @starting_interval = 3
  @interval = options[:interval]

  @mutex = Mutex.new
  @last_checked_at = {}

  log "Started"
end