nti / metrics-bundle
Send metrics to StatsD Server.
Installs: 1 074
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 7
Forks: 0
Open Issues: 0
Requires
- php: >=5.6
Requires (Dev)
- phpunit/phpunit: ^6
- symfony/console: ^2.4 || ^3.0
This package is auto-updated.
Last update: 2024-11-13 01:44:03 UTC
README
StatsD Client
Installation
-
Install the bundle using composer:
$ composer require nti/metrics-bundle "dev-master"
-
Add the bundle configuration to the AppKernel
public function registerBundles() { $bundles = array( ... new NTI\MetricsBundle\NTIMetricsBundle(), ... ); }
-
Setup the configuration in the
config.yml
# NTI Metrics nti_metrics: host: "statsDserver" # default: localhost port: 8125 # default: 8125 prefix: "greenlink." # default: ""
Usage
- Get the Metrics Client service
$collector = $container->get('nti.metrics');
The following methods are available for send metrics:
$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:
$collector->flush();