Permalink
Browse files

first commit truing to get the factory,Service,Entity from the statsd…

…-php-client
  • Loading branch information...
1 parent d8dc2a4 commit 0033f800e3216c11c2fee0227cc250362c2c6d99 @liuggio committed Oct 31, 2012
@@ -132,14 +132,14 @@ protected function write(array $record)
if ($record['formatted']) {
$messageKey = sprintf("%s.%s", $levelKey, $this->toAscii($record['formatted']));
- $this->buffer[] = $this->statsDFactory->createStatsDataIncrement($messageKey);
+ $this->buffer[] = $this->statsDFactory->increment($messageKey);
}
- $this->buffer[] = $this->statsDFactory->createStatsDataIncrement($levelKey);
+ $this->buffer[] = $this->statsDFactory->increment($levelKey);
if ($this->getContextLogging()) {
foreach ($record['context'] as $key => $parameter) {
$contextKey = sprintf("%s.context.%s.%s", $levelKey, $this->toAscii($key), $this->toAscii($parameter));
- $this->buffer[] = $this->statsDFactory->createStatsDataIncrement($contextKey);
+ $this->buffer[] = $this->statsDFactory->increment($contextKey);
}
}
@@ -1,9 +1,10 @@
parameters:
- liuggio_stats_d_client.service.class: Liuggio\StatsDClientBundle\Service\StatsDClientService
+ liuggio_stats_d_client.service.class: Liuggio\StatsdClient\StatsdClient
+ liuggio_stats_d_client.entity.class: Liuggio\StatsdClient\Entity\StatsdData
+ liuggio_stats_d_client.factory.class: Liuggio\StatsdClient\Factory\StatsdDataFactory
+
liuggio_stats_d_client.collector.service.class: Liuggio\StatsDClientBundle\Service\StatsDCollectorService
liuggio_stats_d_client.collector.listener.class: Liuggio\StatsDClientBundle\Listener\StatsDCollectorListener
- liuggio_stats_d_client.entity.class: Liuggio\StatsDClientBundle\Entity\StatsData
- liuggio_stats_d_client.factory.class: Liuggio\StatsDClientBundle\Service\StatsDataFactory
liuggio_stats_d_client.collector.dbal.class: Liuggio\StatsDClientBundle\StatsCollector\DbalStatsCollector
# monolog handler
liuggio_stats_d_client.monolog_handler.class: Liuggio\StatsDClientBundle\Monolog\Handler\StatsDHandler
@@ -18,7 +19,7 @@ parameters:
services:
liuggio_stats_d_client.service:
class: %liuggio_stats_d_client.service.class%
- arguments: [%liuggio_stats_d_client.connection.host%, %liuggio_stats_d_client.connection.port%, %liuggio_stats_d_client.connection.fail_silently%]
+ arguments: [%liuggio_stats_d_client.connection.host%, %liuggio_stats_d_client.connection.port%, %liuggio_stats_d_client.connection.fail_silently%, %liuggio_stats_d_client.connection.fail_silently%]
liuggio_stats_d_client.collector.service:
class: %liuggio_stats_d_client.collector.service.class%
@@ -19,7 +19,7 @@ class ExceptionStatsCollector extends StatsCollector
public function collect(Request $request, Response $response, \Exception $exception = null)
{
if ...
- $statData = $this->getStatsDataFactory()->createStatsDataIncrement($this->getStatsDataKey());
+ $statData = $this->getStatsDataFactory()->increment($this->getStatsDataKey());
$this->addStatsData($statData);
return true;
@@ -53,7 +53,7 @@ This service creates the (StatsDataInterface) object to send
Reference: `liuggio_stats_d_client.factory`
```
-$data = $this->get('liuggio_stats_d_client.factory')->createStatsDataIncrement('log.error');
+$data = $this->get('liuggio_stats_d_client.factory')->increment('log.error');
```
@@ -33,7 +33,7 @@ public function startQuery($sql, array $params = null, array $types = null)
return;
}
- $statData = $this->getStatsDataFactory()->createStatsDataIncrement($key);
+ $statData = $this->getStatsDataFactory()->increment($key);
$this->addStatsData($statData);
}
@@ -36,7 +36,7 @@ public function collect(Request $request, Response $response, \Exception $except
$key = sprintf('%s.exception', $this->getStatsDataKey());
- $statData = $this->getStatsDataFactory()->createStatsDataIncrement($key);
+ $statData = $this->getStatsDataFactory()->increment($key);
$this->addStatsData($statData);
self::$counter++;
@@ -27,7 +27,7 @@ private function getMemoryUsage()
*/
public function collect(Request $request, Response $response, \Exception $exception = null)
{
- $statData = $this->getStatsDataFactory()->createStatsDataGauge($this->getStatsDataKey(), $this->getMemoryUsage());
+ $statData = $this->getStatsDataFactory()->gauge($this->getStatsDataKey(), $this->getMemoryUsage());
$this->addStatsData($statData);
return true;
@@ -34,7 +34,7 @@ public function collect(Request $request, Response $response, \Exception $except
} catch (AuthenticationCredentialsNotFoundException $exception) {
//do nothing
}
- $statData = $this->getStatsDataFactory()->createStatsDataIncrement($key);
+ $statData = $this->getStatsDataFactory()->increment($key);
$this->addStatsData($statData);
return true;
@@ -18,7 +18,7 @@ class VisitorStatsCollector extends StatsCollector
*/
public function collect(Request $request, Response $response, \Exception $exception = null)
{
- $statData = $this->getStatsDataFactory()->createStatsDataIncrement($this->getStatsDataKey());
+ $statData = $this->getStatsDataFactory()->increment($this->getStatsDataKey());
$this->addStatsData($statData);
return true;
}
@@ -65,9 +65,9 @@ public function mockStatsDFactory() {
$phpunit = $this;
- $statsDFactory = $this->getMock("\StdClass", array('createStatsDataIncrement'));
+ $statsDFactory = $this->getMock("\StdClass", array('increment'));
$statsDFactory->expects($this->any())
- ->method('createStatsDataIncrement')
+ ->method('increment')
->will($this->returnCallback(function ($input) use ($phpunit) {
return new StatsDEntity($input);
@@ -19,13 +19,13 @@ public function mockStatsDFactory($compare)
$phpunit = $this;
$statsDFactory = $this->getMockBuilder('Liuggio\StatsDClientBundle\Service\StatsDataFactory')
->disableOriginalConstructor()
- ->setMethods(array('createStatsDataIncrement'))
+ ->setMethods(array('increment'))
->getMock();
$dataMock = $this->getMock('Liuggio\StatsDClientBundle\Model\StatsDataInterface');
$statsDFactory->expects($this->any())
- ->method('createStatsDataIncrement')
+ ->method('increment')
->will($this->returnCallback(function ($input) use ($phpunit, $compare, $dataMock) {
$phpunit->assertEquals($compare, $input);
return $dataMock;
@@ -21,13 +21,13 @@ public function mockStatsDFactory($compare)
$phpunit = $this;
$statsDFactory = $this->getMockBuilder('Liuggio\StatsDClientBundle\Service\StatsDataFactory')
->disableOriginalConstructor()
- ->setMethods(array('createStatsDataIncrement'))
+ ->setMethods(array('increment'))
->getMock();
$dataMock = $this->getMock('Liuggio\StatsDClientBundle\Model\StatsDataInterface');
$statsDFactory->expects($this->any())
- ->method('createStatsDataIncrement')
+ ->method('increment')
->will($this->returnCallback(function ($input) use ($phpunit, $compare, $dataMock) {
$phpunit->assertEquals($compare, $input);
return $dataMock;
@@ -20,13 +20,13 @@ public function mockStatsDFactory($compare)
$phpunit = $this;
$statsDFactory = $this->getMockBuilder('Liuggio\StatsDClientBundle\Service\StatsDataFactory')
->disableOriginalConstructor()
- ->setMethods(array('createStatsDataGauge'))
+ ->setMethods(array('gauge'))
->getMock();
$dataMock = $this->getMock('Liuggio\StatsDClientBundle\Model\StatsDataInterface');
$statsDFactory->expects($this->any())
- ->method('createStatsDataGauge')
+ ->method('gauge')
->will($this->returnCallback(function ($input, $value) use ($phpunit, $compare, $dataMock) {
$phpunit->assertInternalType('integer',$value);
$phpunit->assertEquals($compare, $input);
@@ -18,13 +18,13 @@ public function mockStatsDFactory($compare)
$phpunit = $this;
$statsDFactory = $this->getMockBuilder('Liuggio\StatsDClientBundle\Service\StatsDataFactory')
->disableOriginalConstructor()
- ->setMethods(array('createStatsDataIncrement'))
+ ->setMethods(array('increment'))
->getMock();
$dataMock = $this->getMock('Liuggio\StatsDClientBundle\Model\StatsDataInterface');
$statsDFactory->expects($this->any())
- ->method('createStatsDataIncrement')
+ ->method('increment')
->will($this->returnCallback(function ($input) use ($phpunit, $compare, $dataMock) {
$phpunit->assertEquals($compare, $input);
return $dataMock;
@@ -18,13 +18,13 @@ public function mockStatsDFactory($compare)
$phpunit = $this;
$statsDFactory = $this->getMockBuilder('Liuggio\StatsDClientBundle\Service\StatsDataFactory')
->disableOriginalConstructor()
- ->setMethods(array('createStatsDataIncrement'))
+ ->setMethods(array('increment'))
->getMock();
$dataMock = $this->getMock('Liuggio\StatsDClientBundle\Model\StatsDataInterface');
$statsDFactory->expects($this->any())
- ->method('createStatsDataIncrement')
+ ->method('increment')
->will($this->returnCallback(function ($input) use ($phpunit, $compare, $dataMock) {
$phpunit->assertEquals($compare, $input);
return $dataMock;
View
@@ -17,6 +17,7 @@
],
"require": {
"php": ">=5.3.2",
+ "liuggio/statsd-php-client": ">=1.0.0-RC2",
"symfony/framework-bundle": ">=2.0,<2.2-dev"
},
"require-dev": {
Oops, something went wrong.

0 comments on commit 0033f80

Please sign in to comment.