Download the PHP package troopers/metrics-bundle without Composer
On this page you can find all versions of the php package troopers/metrics-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download troopers/metrics-bundle
More information about troopers/metrics-bundle
Files in troopers/metrics-bundle
Package metrics-bundle
Short Description Symfony Bundle for Metrics management
License MIT
Homepage http://www.doctrine-project.org
Informations about the package metrics-bundle
MetricsBundle
Synopsis
This bundle works with Monolog and is used to improve monitoring or metric logging process thanks to ELK (Elasticsearch, Logstash, Kibana).
Install
composer require troopers/metrics-bundle
and registrer in AppKernel
Be sure some serializer is enabled:
Processors
UserProcessor
This processor will automatically add user informations to every log.
Among availables informations, we can know if the user is authenticated
(authenticated: true/false), when appropriate his id
and username
.
Furthermore, this processor will check if you defined some serializer groups in the metrics.serializer_user_groups
config.
The config below will tell the symfony serializer to serialize the authenticated user by using the profile group:
By default, this processor, is only available for the app
channel, you can add an other or ovveride the service declaration to use on other handler or channel.
The results will be prefixed by user_
(user_id, user_city...) and you don't need to give any additional context.
ContextSerializerProcessor
This processor stands for serializing objects in order to avoid you to pass serializer every where you need to log something.
To communicate with this processor and tell it to do its job, you'll need to wrap your objects in a ContextSerializerProcessor
and give them to the contexts like below:
The processor'll handle the context and start to work when it'll find your SerializeContextItems and add the serialized objects to the context by using the groups given in 2nd constructor argument. If an alias is given, it will use it to store the property, else it will prefix with the class name.
AlterDateTimeProcessor
For some reason, you may want to log an event in the past (or future why not ?).
The AlterDateTimeProcessor
will do it for you, all you need to do is to define the @datetime
context property with the wanted \DateTime value.
By default, this processor, is only available for the app
channel, you can add an other or ovveride the service declaration to use on other handler or channel.
DomainProcessor
In some case, you need to add some extra information to improve your logs: application name, environment...
You can add them in extra_fields
Only scalar
values are allowed. (string, integer, boolean, float, null)
This processor also add request Uri when she his defined
By default, this processor is available for all channels.
GitProcessor
This processor try to find git revision with git command or in REVISION
file at the root of application
By default, this processor is available for all channels.
Log sandbox
Sometime, we just want to send log to test something, this log sandbox to help you to accomplish this small thing.
Check the metrics routes are registered (in your app/config/routing.yml
or routing_dev.yml
):
and go to /metrics/sandbox/newLog
to get your console:
Dashboard and time filter
Once you finished to build your dashboard in kibana, you'll be able to get an iframe to embed it in your website. To handle dashboard in your admin with a time filter, add a row in the database like this:
Then, embed the MetricsBundle:Dashboard:show
and override (or not) the available blocks:
Time filters
Kibana doesn't integrate its time filter in embed dashboard. The TimeFilter
and TimeFilterForm
is here to navigate into dashboards.
Although, TimeFilter is an entity, so you can add some relations between your user and some dashboard.
Here are the available time filters:
- Today
- This week
- This month
- This year
- Yesterday
- Day before yesterday
- Last 15 minutes
- Last 30 minutes
- Last 1 hour
- Last 4 hours
- Last 12 hours
- Last 24 hours
- Last 7 days
- Last 30 days
- Last 60 days
- Last 90 days
- Last 6 months
- Last 1 year
- Last 2 years
- Last 5 years
All versions of metrics-bundle with dependencies
doctrine/common Version ~2.3
elasticsearch/elasticsearch Version ~2.1
graylog2/gelf-php Version ^1.5
monolog/monolog Version 1.*
symfony/framework-bundle Version ~2.7|~3.0