Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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

…-php-client
  • Loading branch information...
commit 0033f800e3216c11c2fee0227cc250362c2c6d99 1 parent d8dc2a4
@liuggio authored
View
6 Monolog/Handler/StatsDHandler.php
@@ -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);
}
}
View
9 Resources/config/services.yml
@@ -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%
View
2  Resources/doc/advanced.md
@@ -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;
View
2  Resources/doc/installation.md
@@ -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');
```
View
2  StatsCollector/DbalStatsCollector.php
@@ -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);
}
View
2  StatsCollector/ExceptionStatsCollector.php
@@ -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++;
View
2  StatsCollector/MemoryStatsCollector.php
@@ -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;
View
2  StatsCollector/UserStatsCollector.php
@@ -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;
View
2  StatsCollector/VisitorStatsCollector.php
@@ -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;
}
View
4 Tests/Monolog/Handler/StatsDHandlerTest.php
@@ -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);
View
4 Tests/StatsCollector/DbalStatsCollectorTest.php
@@ -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;
View
4 Tests/StatsCollector/ExceptionStatsCollectorTest.php
@@ -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;
View
4 Tests/StatsCollector/MemoryStatsCollectorTest.php
@@ -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);
View
4 Tests/StatsCollector/UserStatsCollectorTest.php
@@ -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
4 Tests/StatsCollector/VisitorStatsCollectorTest.php
@@ -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
1  composer.json
@@ -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": {
View
203 composer.lock
@@ -1,5 +1,5 @@
{
- "hash": "b12c9de9ec40571437e07ff135eb0a1d",
+ "hash": "3beb40a189d304d75efc1b1a27968301",
"packages": [
{
"name": "doctrine/common",
@@ -65,41 +65,28 @@
]
},
{
- "name": "monolog/monolog",
- "version": "1.2.1",
+ "name": "liuggio/statsd-php-client",
+ "version": "v1.0.0-RC2",
"source": {
"type": "git",
- "url": "https://github.com/Seldaek/monolog",
- "reference": "1.2.1"
+ "url": "https://github.com/liuggio/statsd-php-client",
+ "reference": "v1.0.0-RC2"
},
"dist": {
"type": "zip",
- "url": "https://github.com/Seldaek/monolog/zipball/1.2.1",
- "reference": "1.2.1",
+ "url": "https://github.com/liuggio/statsd-php-client/zipball/v1.0.0-RC2",
+ "reference": "v1.0.0-RC2",
"shasum": ""
},
"require": {
- "php": ">=5.3.0"
+ "php": ">=5.2"
},
- "require-dev": {
- "mlehner/gelf-php": "1.0.*"
- },
- "suggest": {
- "mlehner/gelf-php": "Allow sending log messages to a GrayLog2 server",
- "ext-amqp": "Allow sending log messages to an AMQP server (1.0+ required)",
- "ext-mongo": "Allow sending log messages to a MongoDB server"
- },
- "time": "2012-08-29 07:53:20",
+ "time": "2012-10-31 09:28:57",
"type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "1.3.x-dev"
- }
- },
"installation-source": "dist",
"autoload": {
"psr-0": {
- "Monolog": "src/"
+ "Liuggio": "src/"
}
},
"license": [
@@ -107,38 +94,39 @@
],
"authors": [
{
- "name": "Jordi Boggiano",
- "email": "j.boggiano@seld.be",
- "homepage": "http://seld.be",
- "role": "Developer"
+ "name": "Liuggio",
+ "email": "liuggio@gmail.com",
+ "homepage": "https://github.com/Liuggio"
}
],
- "description": "Logging for PHP 5.3",
- "homepage": "http://github.com/Seldaek/monolog",
+ "description": "Statsd (Object Oriented) client library for PHP",
+ "homepage": "http://github.com/liuggio/statsd-client",
"keywords": [
- "log",
- "logging"
+ "php",
+ "monitoring",
+ "statsd",
+ "etsy"
]
},
{
"name": "symfony/config",
- "version": "v2.1.1",
+ "version": "v2.1.3",
"target-dir": "Symfony/Component/Config",
"source": {
"type": "git",
"url": "https://github.com/symfony/Config",
- "reference": "v2.1.0-RC2"
+ "reference": "v2.1.3"
},
"dist": {
"type": "zip",
- "url": "https://github.com/symfony/Config/zipball/v2.1.0-RC2",
- "reference": "v2.1.0-RC2",
+ "url": "https://github.com/symfony/Config/zipball/v2.1.3",
+ "reference": "v2.1.3",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
- "time": "2012-08-22 07:48:41",
+ "time": "2012-10-20 00:10:30",
"type": "library",
"extra": {
"branch-alias": {
@@ -169,17 +157,17 @@
},
{
"name": "symfony/dependency-injection",
- "version": "v2.1.1",
+ "version": "v2.1.3",
"target-dir": "Symfony/Component/DependencyInjection",
"source": {
"type": "git",
"url": "https://github.com/symfony/DependencyInjection",
- "reference": "v2.1.1"
+ "reference": "v2.1.3"
},
"dist": {
"type": "zip",
- "url": "https://github.com/symfony/DependencyInjection/zipball/v2.1.1",
- "reference": "v2.1.1",
+ "url": "https://github.com/symfony/DependencyInjection/zipball/v2.1.3",
+ "reference": "v2.1.3",
"shasum": ""
},
"require": {
@@ -193,7 +181,7 @@
"symfony/yaml": "2.1.*",
"symfony/config": "2.1.*"
},
- "time": "2012-09-10 04:53:42",
+ "time": "2012-10-22 07:37:12",
"type": "library",
"extra": {
"branch-alias": {
@@ -224,17 +212,17 @@
},
{
"name": "symfony/event-dispatcher",
- "version": "v2.1.1",
+ "version": "v2.1.3",
"target-dir": "Symfony/Component/EventDispatcher",
"source": {
"type": "git",
"url": "https://github.com/symfony/EventDispatcher",
- "reference": "v2.1.1"
+ "reference": "v2.1.3"
},
"dist": {
"type": "zip",
- "url": "https://github.com/symfony/EventDispatcher/zipball/v2.1.1",
- "reference": "v2.1.1",
+ "url": "https://github.com/symfony/EventDispatcher/zipball/v2.1.3",
+ "reference": "v2.1.3",
"shasum": ""
},
"require": {
@@ -247,7 +235,7 @@
"symfony/dependency-injection": "2.1.*",
"symfony/http-kernel": "2.1.*"
},
- "time": "2012-09-10 04:53:42",
+ "time": "2012-10-04 08:17:57",
"type": "library",
"extra": {
"branch-alias": {
@@ -278,23 +266,23 @@
},
{
"name": "symfony/filesystem",
- "version": "v2.1.1",
+ "version": "v2.1.3",
"target-dir": "Symfony/Component/Filesystem",
"source": {
"type": "git",
"url": "https://github.com/symfony/Filesystem",
- "reference": "v2.1.0-RC2"
+ "reference": "v2.1.3"
},
"dist": {
"type": "zip",
- "url": "https://github.com/symfony/Filesystem/zipball/v2.1.0-RC2",
- "reference": "v2.1.0-RC2",
+ "url": "https://github.com/symfony/Filesystem/zipball/v2.1.3",
+ "reference": "v2.1.3",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
- "time": "2012-08-22 07:48:41",
+ "time": "2012-10-20 00:10:30",
"type": "library",
"extra": {
"branch-alias": {
@@ -325,17 +313,17 @@
},
{
"name": "symfony/framework-bundle",
- "version": "v2.1.1",
+ "version": "v2.1.3",
"target-dir": "Symfony/Bundle/FrameworkBundle",
"source": {
"type": "git",
"url": "https://github.com/symfony/FrameworkBundle",
- "reference": "v2.1.1"
+ "reference": "v2.1.3"
},
"dist": {
"type": "zip",
- "url": "https://github.com/symfony/FrameworkBundle/zipball/v2.1.1",
- "reference": "v2.1.1",
+ "url": "https://github.com/symfony/FrameworkBundle/zipball/v2.1.3",
+ "reference": "v2.1.3",
"shasum": ""
},
"require": {
@@ -359,7 +347,7 @@
"symfony/form": "2.1.*",
"symfony/validator": "2.1.*"
},
- "time": "2012-09-10 04:53:42",
+ "time": "2012-10-24 08:35:37",
"type": "symfony-bundle",
"extra": {
"branch-alias": {
@@ -390,23 +378,23 @@
},
{
"name": "symfony/http-foundation",
- "version": "v2.1.1",
+ "version": "v2.1.3",
"target-dir": "Symfony/Component/HttpFoundation",
"source": {
"type": "git",
"url": "https://github.com/symfony/HttpFoundation",
- "reference": "v2.1.1"
+ "reference": "v2.1.3"
},
"dist": {
"type": "zip",
- "url": "https://github.com/symfony/HttpFoundation/zipball/v2.1.1",
- "reference": "v2.1.1",
+ "url": "https://github.com/symfony/HttpFoundation/zipball/v2.1.3",
+ "reference": "v2.1.3",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
- "time": "2012-09-04 06:24:42",
+ "time": "2012-10-20 00:10:30",
"type": "library",
"extra": {
"branch-alias": {
@@ -438,17 +426,17 @@
},
{
"name": "symfony/http-kernel",
- "version": "v2.1.1",
+ "version": "v2.1.3",
"target-dir": "Symfony/Component/HttpKernel",
"source": {
"type": "git",
"url": "https://github.com/symfony/HttpKernel",
- "reference": "v2.1.1"
+ "reference": "v2.1.3"
},
"dist": {
"type": "zip",
- "url": "https://github.com/symfony/HttpKernel/zipball/v2.1.1",
- "reference": "v2.1.1",
+ "url": "https://github.com/symfony/HttpKernel/zipball/v2.1.3",
+ "reference": "v2.1.3",
"shasum": ""
},
"require": {
@@ -474,7 +462,7 @@
"symfony/dependency-injection": "2.1.*",
"symfony/finder": "2.1.*"
},
- "time": "2012-09-10 23:00:41",
+ "time": "2012-10-30 01:14:14",
"type": "library",
"extra": {
"branch-alias": {
@@ -505,17 +493,17 @@
},
{
"name": "symfony/routing",
- "version": "v2.1.1",
+ "version": "v2.1.3",
"target-dir": "Symfony/Component/Routing",
"source": {
"type": "git",
"url": "https://github.com/symfony/Routing",
- "reference": "v2.1.1"
+ "reference": "v2.1.3"
},
"dist": {
"type": "zip",
- "url": "https://github.com/symfony/Routing/zipball/v2.1.1",
- "reference": "v2.1.1",
+ "url": "https://github.com/symfony/Routing/zipball/v2.1.3",
+ "reference": "v2.1.3",
"shasum": ""
},
"require": {
@@ -532,7 +520,7 @@
"symfony/yaml": "2.1.*",
"doctrine/common": ">=2.2,<2.4-dev"
},
- "time": "2012-09-10 04:53:42",
+ "time": "2012-10-26 02:26:42",
"type": "library",
"extra": {
"branch-alias": {
@@ -563,23 +551,23 @@
},
{
"name": "symfony/templating",
- "version": "v2.1.1",
+ "version": "v2.1.3",
"target-dir": "Symfony/Component/Templating",
"source": {
"type": "git",
"url": "https://github.com/symfony/Templating",
- "reference": "v2.1.1"
+ "reference": "v2.1.3"
},
"dist": {
"type": "zip",
- "url": "https://github.com/symfony/Templating/zipball/v2.1.1",
- "reference": "v2.1.1",
+ "url": "https://github.com/symfony/Templating/zipball/v2.1.3",
+ "reference": "v2.1.3",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
- "time": "2012-08-22 07:48:41",
+ "time": "2012-10-20 00:10:30",
"type": "library",
"extra": {
"branch-alias": {
@@ -610,17 +598,17 @@
},
{
"name": "symfony/translation",
- "version": "v2.1.1",
+ "version": "v2.1.3",
"target-dir": "Symfony/Component/Translation",
"source": {
"type": "git",
"url": "https://github.com/symfony/Translation",
- "reference": "v2.1.1"
+ "reference": "v2.1.3"
},
"dist": {
"type": "zip",
- "url": "https://github.com/symfony/Translation/zipball/v2.1.1",
- "reference": "v2.1.1",
+ "url": "https://github.com/symfony/Translation/zipball/v2.1.3",
+ "reference": "v2.1.3",
"shasum": ""
},
"require": {
@@ -634,7 +622,7 @@
"symfony/config": "2.1.*",
"symfony/yaml": "2.1.*"
},
- "time": "2012-09-10 04:53:42",
+ "time": "2012-10-20 00:10:30",
"type": "library",
"extra": {
"branch-alias": {
@@ -662,53 +650,6 @@
],
"description": "Symfony Translation Component",
"homepage": "http://symfony.com"
- },
- {
- "name": "symfony/yaml",
- "version": "v2.1.1",
- "target-dir": "Symfony/Component/Yaml",
- "source": {
- "type": "git",
- "url": "https://github.com/symfony/Yaml",
- "reference": "v2.1.0-RC2"
- },
- "dist": {
- "type": "zip",
- "url": "https://github.com/symfony/Yaml/zipball/v2.1.0-RC2",
- "reference": "v2.1.0-RC2",
- "shasum": ""
- },
- "require": {
- "php": ">=5.3.3"
- },
- "time": "2012-08-22 07:48:41",
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "2.1-dev"
- }
- },
- "installation-source": "dist",
- "autoload": {
- "psr-0": {
- "Symfony\\Component\\Yaml": ""
- }
- },
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "Fabien Potencier",
- "email": "fabien@symfony.com"
- },
- {
- "name": "Symfony Community",
- "homepage": "http://symfony.com/contributors"
- }
- ],
- "description": "Symfony Yaml Component",
- "homepage": "http://symfony.com"
}
],
"packages-dev": null,
@@ -716,7 +657,7 @@
],
"minimum-stability": "stable",
- "stability-flags": [
-
- ]
+ "stability-flags": {
+ "liuggio/statsd-php-client": 5
+ }
}
Please sign in to comment.
Something went wrong with that request. Please try again.