Class: LogMagic::MySqlRefiner
Instance Attribute Summary
Attributes inherited from BaseRefiner
#lines
Instance Method Summary
collapse
Methods inherited from BaseRefiner
#initialize, #matches?, #persistance_layer
Instance Method Details
#compute ⇒ Object
6
7
8
9
10
|
# File 'lib/log_magic/refiners/mysql_refiner.rb', line 6
def compute
mysql_query =
persist_mysql_query(mysql_query)
output(mysql_query, persistance_layer.uuid)
end
|
17
18
19
|
# File 'lib/log_magic/refiners/mysql_refiner.rb', line 17
def
@lines.last.match(load_sql_regex)[1]
end
|
#line_match_regex ⇒ Object
2
3
4
|
# File 'lib/log_magic/refiners/mysql_refiner.rb', line 2
def line_match_regex
/\w*\sLoad/
end
|
#load_sql_regex ⇒ Object
25
26
27
|
# File 'lib/log_magic/refiners/mysql_refiner.rb', line 25
def load_sql_regex
/Load \([\d\.]+ms\)[^S]*(.*)/
end
|
#output(mysql_query, uuid) ⇒ Object
12
13
14
15
|
# File 'lib/log_magic/refiners/mysql_refiner.rb', line 12
def output(mysql_query, uuid)
mysql_printer = ::LogMagic::MySqlPrinter.new(mysql_query, uuid)
mysql_printer.print
end
|
#persist_mysql_query(mysql_query) ⇒ Object
21
22
23
|
# File 'lib/log_magic/refiners/mysql_refiner.rb', line 21
def persist_mysql_query(mysql_query)
persistance_layer.add_value('mysql_query', mysql_query)
end
|