Metrics filter - MySQL

The Metrics filter collects information about what SQL commands are being run, how long they take to execute, and how much data they return.

This filter is a duplex filter because it needs to collect information both from the client and the server. For instance, when the client sends a Command packet of type QUERY or STMT_PREPARE, this filter makes a note of it and starts a timer. It will then keep track of ResultsetRow packets being sent back as a result of this query.

This filter can output a summary of what it has seen so far (since the Gallium Data engine started) either in a file, or to a logger, or to standard out.

Note that the SQL statements are "cleaned up" for display, meaning extra spaces and line breaks are removed. This is only for display, obviously this filter does not affect the actual statements.


This filter takes the following parameters:

  • Output type : can be either file (output to a file), log (output to a logger as info messages), or out (output to standard out).

  • Output name : if the output is set to file, this should be the name of the file to write to. If the output is set to log, this should be the name of the logger to write to.

  • Use timestamp : if the output is set to file, selecting this option will cause a timestamp to be added to the file name.

  • Output frequency : how often to output a report, in minutes. This is a minimum: if there is no activity, no report will be output.

  • Max statements : this filter keeps track of the top 200 statements by default, you can change that number here.

  • Max reports : when outputting a report, only the top 10 statements will be shown by default. You can change that number here.


Typical output from this filter:

Packet type: Command

bytes in:57024

packets in:125

bytes out:0

packets out:0

Packet type: ResultsetRow

bytes in:0

packets in:0

bytes out:1115387

packets out:2307

Statement: SET SQL_SELECT_LIMIT=1000

# execs: 10

total: 541.6ms

avg: 54.2ms

total rows: 0

avg rows/req: .0

total bytes: 0

avg bytes/req: .0

Statement: SELECT * FROM `gallium_demo`.`customers`

# execs: 4

total: 140.7ms

avg: 35.2ms

total rows: 104

avg rows/req: 26.0

total bytes: 3300

avg bytes/req: 825.0