Skip to content

Commit

Permalink
[PINBA] revamp pinba tags
Browse files Browse the repository at this point in the history
  • Loading branch information
mathieu-gillot committed Jul 22, 2015
1 parent 49531c5 commit 5f4dfdf
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions MyDBD.php
Expand Up @@ -374,8 +374,17 @@ public function query()
if ($this->options['enable_pinba'])
{
$toRemove = array('(', ')');
$method = str_replace($toRemove, '', trim(strtolower(explode(' ', $query)[0])));
$pinbaTimer = pinba_timer_start(array('group' => 'db', 'method' => $method));
$queryArray = explode(' ', $query);
$method = str_replace($toRemove, '', trim(strtolower($queryArray[0])));
$index = array_search('FROM', $queryArray);
$tableName = $queryArray[$index + 1];
$tags = [
'mysql' => $this->connectionInfo['database'] . '.' . $tableName,
'group' => 'mysql',
'method' => $method
];

$pinbaTimer = pinba_timer_start($tags);
}

if (count($params) > 0)
Expand Down

0 comments on commit 5f4dfdf

Please sign in to comment.