https://github.com/ntidev/metricsbundle
StatsD Client
https://github.com/ntidev/metricsbundle
Last synced: over 1 year ago
JSON representation
StatsD Client
- Host: GitHub
- URL: https://github.com/ntidev/metricsbundle
- Owner: ntidev
- License: mit
- Created: 2018-01-23T14:24:36.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2020-08-12T16:06:33.000Z (almost 6 years ago)
- Last Synced: 2025-03-03T00:35:04.270Z (over 1 year ago)
- Language: PHP
- Homepage:
- Size: 20.5 KB
- Stars: 0
- Watchers: 7
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# MetricsBundle
StatsD Client
### Installation
1. Install the bundle using composer:
```bash
$ composer require nti/metrics-bundle "dev-master"
```
2. Add the bundle configuration to the AppKernel
```php
public function registerBundles()
{
$bundles = array(
...
new NTI\MetricsBundle\NTIMetricsBundle(),
...
);
}
3. Setup the configuration in the ``config.yml``
```yaml
# NTI Metrics
nti_metrics:
host: "statsDserver" # default: localhost
port: 8125 # default: 8125
prefix: "greenlink." # default: ""
```
### Usage
1. Get the Metrics Client service
```php
$collector = $container->get('nti.metrics');
```
The following methods are available for send metrics:
```php
$collector->increment('glbs.email.send'); # Same as send "glbs.email.send:1|c"
$collector->decrement('glbs.email.send'); # Same as send "glbs.email.send:-1|c"
```
To send the values to statsD server you have to call the following method:
```php
$collector->flush();
```