MySQL Forums
Forum List  »  Router & Proxy

Re: Lua script to count executed queries
Posted by: Jan Kneschke
Date: April 02, 2008 10:36AM

if not proxy.global.stats then
  proxy.global.stats = {
  }
end

function read_query(packet)
  local stats = proxy.global.stats
  local db    = proxy.connection.client.default_db

  if not stats[db] then
    stats[db] = {
      queries = 0
    }
  end

  stats[db].queries = stats[db].queries + 1
end

That's all you have to do. Check the code in the lib-folder how to intercept queries to return the counters.

--
Jan Kneschke, MySQL Enterprise Tools

Options: Reply• Quote


Subject
Views
Written By
Posted
Re: Lua script to count executed queries
2846
April 02, 2008 10:36AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.