5.8.1.2 Command Probes

The command probes are executed before and after a client command is executed, including any SQL statement that might be executed during that period. Commands include operations such as the initialization of the DB, use of the COM_CHANGE_USER operation (supported by the MySQL protocol), and manipulation of prepared statements. Many of these commands are used only by the MySQL client API from various connectors such as PHP and Java.

command-start(connectionid, command, user, host)
command-done(status)
  • command-start: Triggered when a command is submitted to the server.

    • connectionid: The connection ID of the client executing the command.

    • command: An integer representing the command that was executed. Possible values are shown in the following table.

      Value Name Description
      00 COM_SLEEP Internal thread state
      01 COM_QUIT Close connection
      02 COM_INIT_DB Select database (USE ...)
      03 COM_QUERY Execute a query
      04 COM_FIELD_LIST Get a list of fields
      05 COM_CREATE_DB Create a database (deprecated)
      06 COM_DROP_DB Drop a database (deprecated)
      07 COM_REFRESH Refresh connection
      08 COM_SHUTDOWN Shutdown server
      09 COM_STATISTICS Get statistics
      10 COM_PROCESS_INFO Get processes (SHOW PROCESSLIST)
      11 COM_CONNECT Initialize connection
      12 COM_PROCESS_KILL Kill process
      13 COM_DEBUG Get debug information
      14 COM_PING Ping
      15 COM_TIME Internal thread state
      16 COM_DELAYED_INSERT Internal thread state
      17 COM_CHANGE_USER Change user
      18 COM_BINLOG_DUMP Used by a replication slave or mysqlbinlog to initiate a binary log read
      19 COM_TABLE_DUMP Used by a replication slave to get the master table information
      20 COM_CONNECT_OUT Used by a replication slave to log a connection to the server
      21 COM_REGISTER_SLAVE Used by a replication slave during registration
      22 COM_STMT_PREPARE Prepare a statement
      23 COM_STMT_EXECUTE Execute a statement
      24 COM_STMT_SEND_LONG_DATA Used by a client when requesting extended data
      25 COM_STMT_CLOSE Close a prepared statement
      26 COM_STMT_RESET Reset a prepared statement
      27 COM_SET_OPTION Set a server option
      28 COM_STMT_FETCH Fetch a prepared statement
    • user: The user executing the command.

    • host: The client host.

  • command-done: Triggered when the command execution completes. The status argument contains 0 if the command executed successfully, or 1 if the statement was terminated before normal completion.

The command-start and command-done probes are best used when combined with the statement probes to get an idea of overall execution time.