Class: Maatkit::QueryDigest
- Inherits:
-
Object
- Object
- Maatkit::QueryDigest
- Defined in:
- lib/maatkit-ruby/mk-query-digest.rb
Overview
Parses logs and more. Analyze, transform, filter, review and report on queries.
Maatkit::QueryDigest.new( array, str, array)
Instance Attribute Summary collapse
-
#ask_pass ⇒ Object
FALSE.
-
#attribute_aliases ⇒ Object
db|Schema.
-
#attribute_value_limit ⇒ Object
4294967296.
-
#aux_dsn ⇒ Object
(No # value).
-
#charset ⇒ Object
(No # value).
-
#check_attributes_limit ⇒ Object
1000.
-
#config ⇒ Object
/etc/maatkit/maatkit.conf,/etc/maatkit/mk_query_digest.conf,/home/joel/.maatkit.conf,/home/joel/.mk_query_digest.conf.
-
#continue_on_error ⇒ Object
TRUE.
-
#create_review_history_table ⇒ Object
FALSE.
-
#create_review_table ⇒ Object
FALSE.
-
#daemonize ⇒ Object
FALSE.
-
#defaults_file ⇒ Object
(No # value).
-
#embedded_attributes ⇒ Object
(No # value).
-
#execute ⇒ Object
(No # value).
-
#execute_throttle ⇒ Object
(No # value).
-
#expected_range ⇒ Object
5,10.
-
#explain ⇒ Object
(No # value).
-
#filter ⇒ Object
(No # value).
-
#fingerprints ⇒ Object
FALSE.
-
#for_explain ⇒ Object
TRUE.
-
#group_by ⇒ Object
fingerprint.
-
#gzip ⇒ Object
TRUE.
-
#help ⇒ Object
TRUE.
-
#host ⇒ Object
(No # value).
-
#ignore_attributes ⇒ Object
arg,cmd,insert_id,ip,port,Thread_id,timestamp,exptime,flags,key,res,val,server_id,offset,end_log_pos,Xid.
-
#inherit_attributes ⇒ Object
db,ts.
-
#interval ⇒ Object
.1.
-
#iterations ⇒ Object
1.
-
#limit ⇒ Object
95%:20.
-
#log ⇒ Object
(No # value).
-
#mirror ⇒ Object
(No # value).
-
#order_by ⇒ Object
Query_time:sum.
-
#outliers ⇒ Object
Query_time:1:10.
-
#password ⇒ Object
(No # value).
-
#path_to_mk_query_digest ⇒ Object
Sets the executable path, otherwise the environment path will be used.
-
#pid ⇒ Object
(No # value).
-
#pipeline_profile ⇒ Object
FALSE.
-
#port ⇒ Object
(No # value).
-
#print ⇒ Object
FALSE.
-
#print_iterations ⇒ Object
FALSE.
-
#processlist ⇒ Object
(No # value).
-
#progress ⇒ Object
time,30.
-
#read_timeout ⇒ Object
(No # value).
-
#report ⇒ Object
TRUE.
-
#report_all ⇒ Object
FALSE.
-
#report_format ⇒ Object
rusage,date,files,header,profile,query_report,prepared.
-
#report_histogram ⇒ Object
Query_time.
-
#review ⇒ Object
(No # value).
-
#review_history ⇒ Object
(No # value).
-
#run_time ⇒ Object
(No # value).
-
#sample ⇒ Object
(No # value).
-
#save_results ⇒ Object
(No # value).
-
#select ⇒ Object
Returns the value of attribute select.
-
#set_vars ⇒ Object
wait_timeout=10000.
-
#shorten ⇒ Object
1024.
-
#show_all ⇒ Object
Returns the value of attribute show_all.
-
#since ⇒ Object
(No # value).
-
#socket ⇒ Object
(No # value).
-
#statistics ⇒ Object
FALSE.
-
#table_access ⇒ Object
FALSE.
-
#tcpdump_errors ⇒ Object
(No # value).
-
#timeline ⇒ Object
FALSE.
-
#type ⇒ Object
slowlog.
-
#until ⇒ Object
(No # value).
-
#user ⇒ Object
(No # value).
-
#version ⇒ Object
FALSE.
-
#watch_server ⇒ Object
(No # value).
-
#zero_admin ⇒ Object
TRUE.
-
#zero_bool ⇒ Object
TRUE.
Instance Method Summary collapse
-
#initialize ⇒ QueryDigest
constructor
Returns a new QueryDigest Object.
-
#start(options = nil) ⇒ Object
Execute the command.
Constructor Details
#initialize ⇒ QueryDigest
Returns a new QueryDigest Object
92 93 |
# File 'lib/maatkit-ruby/mk-query-digest.rb', line 92 def initialize() end |
Instance Attribute Details
#ask_pass ⇒ Object
FALSE
15 16 17 |
# File 'lib/maatkit-ruby/mk-query-digest.rb', line 15 def ask_pass @ask_pass end |
#attribute_aliases ⇒ Object
db|Schema
16 17 18 |
# File 'lib/maatkit-ruby/mk-query-digest.rb', line 16 def attribute_aliases @attribute_aliases end |
#attribute_value_limit ⇒ Object
4294967296
17 18 19 |
# File 'lib/maatkit-ruby/mk-query-digest.rb', line 17 def attribute_value_limit @attribute_value_limit end |
#aux_dsn ⇒ Object
(No # value)
18 19 20 |
# File 'lib/maatkit-ruby/mk-query-digest.rb', line 18 def aux_dsn @aux_dsn end |
#charset ⇒ Object
(No # value)
19 20 21 |
# File 'lib/maatkit-ruby/mk-query-digest.rb', line 19 def charset @charset end |
#check_attributes_limit ⇒ Object
1000
20 21 22 |
# File 'lib/maatkit-ruby/mk-query-digest.rb', line 20 def check_attributes_limit @check_attributes_limit end |
#config ⇒ Object
/etc/maatkit/maatkit.conf,/etc/maatkit/mk_query_digest.conf,/home/joel/.maatkit.conf,/home/joel/.mk_query_digest.conf
21 22 23 |
# File 'lib/maatkit-ruby/mk-query-digest.rb', line 21 def config @config end |
#continue_on_error ⇒ Object
TRUE
22 23 24 |
# File 'lib/maatkit-ruby/mk-query-digest.rb', line 22 def continue_on_error @continue_on_error end |
#create_review_history_table ⇒ Object
FALSE
23 24 25 |
# File 'lib/maatkit-ruby/mk-query-digest.rb', line 23 def create_review_history_table @create_review_history_table end |
#create_review_table ⇒ Object
FALSE
24 25 26 |
# File 'lib/maatkit-ruby/mk-query-digest.rb', line 24 def create_review_table @create_review_table end |
#daemonize ⇒ Object
FALSE
25 26 27 |
# File 'lib/maatkit-ruby/mk-query-digest.rb', line 25 def daemonize @daemonize end |
#defaults_file ⇒ Object
(No # value)
26 27 28 |
# File 'lib/maatkit-ruby/mk-query-digest.rb', line 26 def defaults_file @defaults_file end |
#embedded_attributes ⇒ Object
(No # value)
27 28 29 |
# File 'lib/maatkit-ruby/mk-query-digest.rb', line 27 def @embedded_attributes end |
#execute ⇒ Object
(No # value)
28 29 30 |
# File 'lib/maatkit-ruby/mk-query-digest.rb', line 28 def execute @execute end |
#execute_throttle ⇒ Object
(No # value)
29 30 31 |
# File 'lib/maatkit-ruby/mk-query-digest.rb', line 29 def execute_throttle @execute_throttle end |
#expected_range ⇒ Object
5,10
30 31 32 |
# File 'lib/maatkit-ruby/mk-query-digest.rb', line 30 def expected_range @expected_range end |
#explain ⇒ Object
(No # value)
31 32 33 |
# File 'lib/maatkit-ruby/mk-query-digest.rb', line 31 def explain @explain end |
#filter ⇒ Object
(No # value)
32 33 34 |
# File 'lib/maatkit-ruby/mk-query-digest.rb', line 32 def filter @filter end |
#fingerprints ⇒ Object
FALSE
33 34 35 |
# File 'lib/maatkit-ruby/mk-query-digest.rb', line 33 def fingerprints @fingerprints end |
#for_explain ⇒ Object
TRUE
34 35 36 |
# File 'lib/maatkit-ruby/mk-query-digest.rb', line 34 def for_explain @for_explain end |
#group_by ⇒ Object
fingerprint
35 36 37 |
# File 'lib/maatkit-ruby/mk-query-digest.rb', line 35 def group_by @group_by end |
#gzip ⇒ Object
TRUE
36 37 38 |
# File 'lib/maatkit-ruby/mk-query-digest.rb', line 36 def gzip @gzip end |
#help ⇒ Object
TRUE
37 38 39 |
# File 'lib/maatkit-ruby/mk-query-digest.rb', line 37 def help @help end |
#host ⇒ Object
(No # value)
38 39 40 |
# File 'lib/maatkit-ruby/mk-query-digest.rb', line 38 def host @host end |
#ignore_attributes ⇒ Object
arg,cmd,insert_id,ip,port,Thread_id,timestamp,exptime,flags,key,res,val,server_id,offset,end_log_pos,Xid
39 40 41 |
# File 'lib/maatkit-ruby/mk-query-digest.rb', line 39 def ignore_attributes @ignore_attributes end |
#inherit_attributes ⇒ Object
db,ts
40 41 42 |
# File 'lib/maatkit-ruby/mk-query-digest.rb', line 40 def inherit_attributes @inherit_attributes end |
#interval ⇒ Object
.1
41 42 43 |
# File 'lib/maatkit-ruby/mk-query-digest.rb', line 41 def interval @interval end |
#iterations ⇒ Object
1
42 43 44 |
# File 'lib/maatkit-ruby/mk-query-digest.rb', line 42 def iterations @iterations end |
#limit ⇒ Object
95%:20
43 44 45 |
# File 'lib/maatkit-ruby/mk-query-digest.rb', line 43 def limit @limit end |
#log ⇒ Object
(No # value)
44 45 46 |
# File 'lib/maatkit-ruby/mk-query-digest.rb', line 44 def log @log end |
#mirror ⇒ Object
(No # value)
45 46 47 |
# File 'lib/maatkit-ruby/mk-query-digest.rb', line 45 def mirror @mirror end |
#order_by ⇒ Object
Query_time:sum
46 47 48 |
# File 'lib/maatkit-ruby/mk-query-digest.rb', line 46 def order_by @order_by end |
#outliers ⇒ Object
Query_time:1:10
47 48 49 |
# File 'lib/maatkit-ruby/mk-query-digest.rb', line 47 def outliers @outliers end |
#password ⇒ Object
(No # value)
48 49 50 |
# File 'lib/maatkit-ruby/mk-query-digest.rb', line 48 def password @password end |
#path_to_mk_query_digest ⇒ Object
Sets the executable path, otherwise the environment path will be used.
87 88 89 |
# File 'lib/maatkit-ruby/mk-query-digest.rb', line 87 def path_to_mk_query_digest @path_to_mk_query_digest end |
#pid ⇒ Object
(No # value)
49 50 51 |
# File 'lib/maatkit-ruby/mk-query-digest.rb', line 49 def pid @pid end |
#pipeline_profile ⇒ Object
FALSE
50 51 52 |
# File 'lib/maatkit-ruby/mk-query-digest.rb', line 50 def pipeline_profile @pipeline_profile end |
#port ⇒ Object
(No # value)
51 52 53 |
# File 'lib/maatkit-ruby/mk-query-digest.rb', line 51 def port @port end |
#print ⇒ Object
FALSE
52 53 54 |
# File 'lib/maatkit-ruby/mk-query-digest.rb', line 52 def print @print end |
#print_iterations ⇒ Object
FALSE
53 54 55 |
# File 'lib/maatkit-ruby/mk-query-digest.rb', line 53 def print_iterations @print_iterations end |
#processlist ⇒ Object
(No # value)
54 55 56 |
# File 'lib/maatkit-ruby/mk-query-digest.rb', line 54 def processlist @processlist end |
#progress ⇒ Object
time,30
55 56 57 |
# File 'lib/maatkit-ruby/mk-query-digest.rb', line 55 def progress @progress end |
#read_timeout ⇒ Object
(No # value)
56 57 58 |
# File 'lib/maatkit-ruby/mk-query-digest.rb', line 56 def read_timeout @read_timeout end |
#report ⇒ Object
TRUE
57 58 59 |
# File 'lib/maatkit-ruby/mk-query-digest.rb', line 57 def report @report end |
#report_all ⇒ Object
FALSE
58 59 60 |
# File 'lib/maatkit-ruby/mk-query-digest.rb', line 58 def report_all @report_all end |
#report_format ⇒ Object
rusage,date,files,header,profile,query_report,prepared
59 60 61 |
# File 'lib/maatkit-ruby/mk-query-digest.rb', line 59 def report_format @report_format end |
#report_histogram ⇒ Object
Query_time
60 61 62 |
# File 'lib/maatkit-ruby/mk-query-digest.rb', line 60 def report_histogram @report_histogram end |
#review ⇒ Object
(No # value)
61 62 63 |
# File 'lib/maatkit-ruby/mk-query-digest.rb', line 61 def review @review end |
#review_history ⇒ Object
(No # value)
62 63 64 |
# File 'lib/maatkit-ruby/mk-query-digest.rb', line 62 def review_history @review_history end |
#run_time ⇒ Object
(No # value)
63 64 65 |
# File 'lib/maatkit-ruby/mk-query-digest.rb', line 63 def run_time @run_time end |
#sample ⇒ Object
(No # value)
64 65 66 |
# File 'lib/maatkit-ruby/mk-query-digest.rb', line 64 def sample @sample end |
#save_results ⇒ Object
(No # value)
65 66 67 |
# File 'lib/maatkit-ruby/mk-query-digest.rb', line 65 def save_results @save_results end |
#select ⇒ Object
Returns the value of attribute select.
66 67 68 |
# File 'lib/maatkit-ruby/mk-query-digest.rb', line 66 def select @select end |
#set_vars ⇒ Object
wait_timeout=10000
67 68 69 |
# File 'lib/maatkit-ruby/mk-query-digest.rb', line 67 def set_vars @set_vars end |
#shorten ⇒ Object
1024
68 69 70 |
# File 'lib/maatkit-ruby/mk-query-digest.rb', line 68 def shorten @shorten end |
#show_all ⇒ Object
Returns the value of attribute show_all.
69 70 71 |
# File 'lib/maatkit-ruby/mk-query-digest.rb', line 69 def show_all @show_all end |
#since ⇒ Object
(No # value)
70 71 72 |
# File 'lib/maatkit-ruby/mk-query-digest.rb', line 70 def since @since end |
#socket ⇒ Object
(No # value)
71 72 73 |
# File 'lib/maatkit-ruby/mk-query-digest.rb', line 71 def socket @socket end |
#statistics ⇒ Object
FALSE
72 73 74 |
# File 'lib/maatkit-ruby/mk-query-digest.rb', line 72 def statistics @statistics end |
#table_access ⇒ Object
FALSE
73 74 75 |
# File 'lib/maatkit-ruby/mk-query-digest.rb', line 73 def table_access @table_access end |
#tcpdump_errors ⇒ Object
(No # value)
74 75 76 |
# File 'lib/maatkit-ruby/mk-query-digest.rb', line 74 def tcpdump_errors @tcpdump_errors end |
#timeline ⇒ Object
FALSE
75 76 77 |
# File 'lib/maatkit-ruby/mk-query-digest.rb', line 75 def timeline @timeline end |
#type ⇒ Object
slowlog
76 77 78 |
# File 'lib/maatkit-ruby/mk-query-digest.rb', line 76 def type @type end |
#until ⇒ Object
(No # value)
77 78 79 |
# File 'lib/maatkit-ruby/mk-query-digest.rb', line 77 def until @until end |
#user ⇒ Object
(No # value)
78 79 80 |
# File 'lib/maatkit-ruby/mk-query-digest.rb', line 78 def user @user end |
#version ⇒ Object
FALSE
79 80 81 |
# File 'lib/maatkit-ruby/mk-query-digest.rb', line 79 def version @version end |
#watch_server ⇒ Object
(No # value)
80 81 82 |
# File 'lib/maatkit-ruby/mk-query-digest.rb', line 80 def watch_server @watch_server end |
#zero_admin ⇒ Object
TRUE
81 82 83 |
# File 'lib/maatkit-ruby/mk-query-digest.rb', line 81 def zero_admin @zero_admin end |
#zero_bool ⇒ Object
TRUE
82 83 84 |
# File 'lib/maatkit-ruby/mk-query-digest.rb', line 82 def zero_bool @zero_bool end |
Instance Method Details
#start(options = nil) ⇒ Object
Execute the command
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 |
# File 'lib/maatkit-ruby/mk-query-digest.rb', line 98 def start( = nil) tmp = Tempfile.new('tmp') command = option_string() + .to_s + " 2> " + tmp.path success = system(command) if success begin while (line = tmp.readline) line.chomp selected_string = line end rescue EOFError tmp.close end return selected_string else tmp.close! return success end end |