Skip to content

Commit bc1482a

Browse files
committed
Merge pull request #46 from lafourchette/master
New concise service
2 parents e2e678c + 33df4b4 commit bc1482a

4 files changed

Lines changed: 20 additions & 2 deletions

File tree

Resources/config/services.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ parameters:
66
liuggio_stats_d_client.collector.service.class: Liuggio\StatsDClientBundle\Service\StatsDCollectorService
77
liuggio_stats_d_client.collector.listener.class: Liuggio\StatsDClientBundle\Listener\StatsDCollectorListener
88
liuggio_stats_d_client.collector.dbal.class: Liuggio\StatsDClientBundle\StatsCollector\DbalStatsCollector
9+
liuggio_stats_d.sender.class: Liuggio\StatsdClient\Service\StatsdService
910

1011
# monolog handler
1112
liuggio_stats_d_client.monolog_handler.class: Liuggio\StatsdClient\Monolog\Handler\StatsDHandler
@@ -29,4 +30,10 @@ services:
2930
class: %liuggio_stats_d_client.collector.service.class%
3031
arguments: [@liuggio_stats_d_client.service]
3132

33+
# simplified service
34+
liuggio_stats_d.service:
35+
class: %liuggio_stats_d.sender.class%
36+
arguments: [@liuggio_stats_d_client.service, @liuggio_stats_d_client.factory]
3237

38+
statsd:
39+
alias: liuggio_stats_d.service

Resources/doc/installation.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,18 @@ the `$data` is the object created by the factory
7171

7272
the send method will optimise the data sent in order to speed up the connection.
7373

74+
### Simplified StatsD service
7475

76+
Reference: `statsd`
77+
78+
This service implements `liuggio_stats_d_client.factory` methods, as well as flush.
79+
It makes using service less verbose.
80+
```php
81+
$this->get('statsd')
82+
->increment('log.error')
83+
->gauge('log.rate', 25)
84+
->flush();
85+
```
7586

7687
Working with `Monolog`
7788
-------------

Tests/StatsCollector/UserStatsCollectorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public function mockSecurityContext($return)
1414
{
1515
$phpunit = $this;
1616
$statsDFactory = $this->getMockBuilder('Symfony\Component\Security\Core\SecurityContextInterface')
17-
->setMethods(array('isGranted'))
17+
->setMethods(array('isGranted', 'getToken', 'setToken'))
1818
->getMock();
1919

2020
$statsDFactory->expects($this->any())

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
],
1818
"require": {
1919
"php": ">=5.3.2",
20-
"liuggio/statsd-php-client": "1.0.*",
20+
"liuggio/statsd-php-client": ">1.0.12",
2121
"symfony/framework-bundle": ">2.0"
2222
},
2323
"require-dev": {

0 commit comments

Comments
 (0)