adgoal / statsd-client-bundle
Provides a statsd client and simple ready-to-use support for #Symfony2 Application
Installs: 3 963
Dependents: 0
Suggesters: 1
Security: 0
Stars: 0
Watchers: 1
Forks: 43
Type:symfony-bundle
Requires
- php: ^7.1
- ext-sockets: *
- adgoal/statsd-php-client: ~1.1
- symfony/framework-bundle: ^3.0 || ^4.0 || ^5.0
Requires (Dev)
- doctrine/dbal: >=2.2.0
- monolog/monolog: >=1.2.0
- phpunit/phpunit: ^5.7 || ^6.0 || ^7.0
- symfony/yaml: ^3.0 || ^4.0 || ^5.0
Suggests
- doctrine/dbal: Doctrine DBAL, collect statistic to/from the database (>=2.2.0 required)
- monolog/monolog: Monolog, in order to generate statistic from log >=1.2.0)
- dev-master
- 2.0.x-dev
- v1.9.0
- 1.8.1
- 1.8.0
- v1.7.0
- v1.6.9
- v1.6.8
- v1.6.7
- v1.6.6
- v1.6.5
- v1.6.4
- v1.6.3
- v1.6.1
- v1.4.4
- v1.4.2
- v1.2.4
- v1.2.3
- v1.2.2
- v1.2.0
- v1.2.0-RC2
- v1.2.0-RC1
- v1.0.4
- v1.0.2
- v1.0.0
- dev-ADG-1319-dg-rt-awin-export-program-rates-from-awin-rate-api-and-send-to-queue
- dev-bryglen-version-3
- dev-composer_alias
This package is auto-updated.
Last update: 2024-12-18 23:05:36 UTC
README
This bundle helps you to monitor your application.
It uses statsd-php-client as Client for the etsy/Statsd API.
It Includes
- a Service, a Factory and an Entity callable by the DIC
- a Monolog Handler
- a series of Collectors in order to aggregate your personal data.
- a series of Commands in order to execute data also from cli.
Simple usage!
$this->get('statsd') ->increment('log.error') ->gauge('log.rate', 25) ->flush();
Check out the documentation
Articles
- Article: ServerGrove - Interesting Symfony Bundles: StatsDClientBundle
- Article : Install Stats.d / Graphite on a debian server in order to monitor a Symfony2 application (1/2)
- Article : Monitor your Symfony2 application via Stats.d and Graphite (2/2)
- Slide : Building OpenSky with Symfony2 by Jonathan H. Wage
Abstract
Monitoring what is happening in your production Symfony2 application, with StatsD and Graphite.
Within this bundle you could use ready-to-go monitor for
-
Monolog
-
Amount of visitor
-
Logged vs Anonymous user
-
SQL: Verbs used (amount of select/set/update/upgrade/delete) (this feature is not suggested, please use a server monitor tool eg. nagios, munin)
-
Amount of PHP ram used
-
You could create your own using the Factory and the Service.
On dev env the data are not pushed to the socket but to syslog.
If debug mode is enabled no packet are sent over the udp socket, and you could see what's going on reading the syslog with tail -f /var/log/syslog
Mar 19 00:48:11 liuggio nginx: statsd-open
Mar 19 00:48:11 liuggio nginx: statsd-write "tvision.visitor:1|tvision.memory:43520|tvision.user.anonymous:1|tvision.query.start:1|tvision.query.insert:1|c" 118 Bytes
Mar 19 00:48:11 liuggio nginx: statsd-close
Note: by default in dev
environment debug is true.
One UDP packet to rule them all
With a proper config file, your StatsD server will receive in a single upd packet:
prefix.visitor:1|c # Increment visitor
prefix.user.anonymous:1|c # The visitor is not logged
prefix.log.app.error.user_action:1 # Stats by monolog with $this->get('logger')->error('user_action')
prefix.memory:4480|g # The php memory peak was 4480 MB
prefix.exception.exception.500:1|c # Exception occurred, the Exception code was 500
prefix.query.insert:1|c # Query Insert
prefix.query.select:1|c # Query Select
Short Theory and links
Vagrant StatSD and Graphite
see this blog post to install Easy install statsd graphite with vagrant.
StatsD
StatsD is a simple daemon for easy stats aggregation
Graphite
Graphite is a Scalable Realtime Graphing
The Client send data with UDP (faster)
https://www.google.com/search?q=tcp+vs+udp
Contribution
See CONTRIBUTING.md
Contributors
https://github.com/liuggio/StatsDClientBundle/graphs/contributors