Skip to content

Commit

Permalink
Merge branch 'pinba' into 1.0-wapstart
Browse files Browse the repository at this point in the history
  • Loading branch information
dovg committed Aug 29, 2011
2 parents 5ca908f + 40d1929 commit 0b52209
Show file tree
Hide file tree
Showing 3 changed files with 87 additions and 1 deletion.
9 changes: 9 additions & 0 deletions doc/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
2011-07-20 Evgeny V. Kokovikhin

* core/Cache/Memcached.class.php, core/Cache/PeclMemcached.class.php,
core/DB/PgSQL.class.php, global.inc.php.tpl,
main/Monitoring/PinbaClient.class.php, main/Monitoring/PinbedMemcached.class.php,
main/Monitoring/PinbedPeclMemcached.class.php,
main/Monitoring/PinbedPgSQL.class.php: wrapper for pinba added.
see http://pinba.org/wiki/Main_Page for details

2011-08-18 Evgeny V. Kokovikhin

* main/Criteria/Projections/CountProjection.class.php,
Expand Down
77 changes: 77 additions & 0 deletions main/Monitoring/PinbedPeclMemcached.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
**/
final class PinbedPeclMemcached extends PeclMemcached
{
private $host = null;
private $port = null;

/**
* @return PinbedPeclMemcached
**/
Expand All @@ -30,6 +33,9 @@ public function __construct(
$port = Memcached::DEFAULT_PORT
)
{
$this->host = $host;
$this->port = $port;

if (PinbaClient::isEnabled())
PinbaClient::me()->timerStart(
'pecl_memcached_'.$host.'_'.$port.'_connect',
Expand All @@ -43,5 +49,76 @@ public function __construct(
'pecl_memcached_'.$host.'_'.$port.'_connect'
);
}

public function append($key, $data)
{
$this->log(__METHOD__);
$result = parent::append($key, $data);
$this->stopLog(__METHOD__);

return $result;
}

public function decrement($key, $value)
{
$this->log(__METHOD__);
$result = parent::decrement($key, $value);
$this->stopLog(__METHOD__);

return $result;
}

public function delete($index)
{
$this->log(__METHOD__);
$result = parent::delete($index);
$this->stopLog(__METHOD__);

return $result;
}

public function get($index)
{
$this->log(__METHOD__);
$result = parent::get($index);
$this->stopLog(__METHOD__);

return $result;
}

public function getList($indexes)
{
$this->log(__METHOD__);
$result = parent::getList($indexes);
$this->stopLog(__METHOD__);

return $result;
}

public function increment($key, $value)
{
$this->log(__METHOD__);
$result = parent::increment($key, $value);
$this->stopLog(__METHOD__);

return $result;
}

/*void */ private function log($methodName)
{
if (PinbaClient::isEnabled())
PinbaClient::me()->timerStart(
'pecl_memcached_'.$this->host.'_'.$this->port.'_'.$methodName,
array('pecl_memcached_'.__METHOD__ => $this->host.'_'.$this->port)
);
}

/*void */ private function stopLog($methodName)
{
if (PinbaClient::isEnabled())
PinbaClient::me()->timerStop(
'pecl_memcached_'.$this->host.'_'.$this->port.'_'.$methodName
);
}
}
?>
2 changes: 1 addition & 1 deletion main/Monitoring/PinbedPgSQL.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
****************************************************************************/

/**
* @ingroup Cache
* @ingroup DB
**/
final class PinbedPgSQL extends PgSQL
{
Expand Down

0 comments on commit 0b52209

Please sign in to comment.