Skip to content

Releases: fabfuel/prophiler

PHP 7 Support (No PHP 5.4 support anymore)

16 Sep 06:52
Compare
Choose a tag to compare

New Features

  • PHP 7.0 and 7.1 support

Changes

Fixes

  • Fixed trailing
  • Convert special characters to HTML entities

Aggregations

08 Aug 13:33
Compare
Choose a tag to compare

New Features

  • Aggregations
  • Phalcon Cache Backend Decorator
  • ElasticSearch Client Decorator
  • Automatic EventsManger registration

Changes

  • internally handling all durations in milliseconds (instead of seconds)
  • Docker config improvements

Aggregations

Prophiler now features benchmark aggregations. These give you a lot more insights and are extremely useful to:

  • quickly see the total number of recurring executions (e.g. database or cache queries)
  • analyze minimum, maximum and average execution times of recurring executions
  • easily see (e.g. accidentally) recurring executions of the same database query
  • get a warning, if the total number of executions exceeds a custom threshold
  • get a warning, if the maximum execution time exceeds a custom threshold

Setup

Prophiler comes with some aggregators, but you can easily create your own. To Set up an aggregator, all you need to do is to register the aggregator at the profiler instance:

$profiler->addAggregator(new \Fabfuel\Prophiler\Aggregator\Database\QueryAggregator());
$profiler->addAggregator(new \Fabfuel\Prophiler\Aggregator\Cache\CacheAggregator());

That's it. You immediately see all database and cache queries, grouped by command/query, including the total number of executions, the total duration of all executions as well as the minimum, maximum and average execution time.

Phalcon Cache Backend Decorator

To profile Phalcon cache backend requests, you only need to decorate the cache backend with the BackendDecorator. It will benchmark all cache operations automatically. Here is an example with the APC backend:

$cacheFrontend = new \Phalcon\Cache\Frontend\Data(['lifetime' => 172800]);
$cacheBackend = new \Phalcon\Cache\Backend\Apc($cacheFrontend, ['prefix' => 'app-data']);

$cache = \Fabfuel\Prophiler\Decorator\Phalcon\Cache\BackendDecorator($cacheBackend, $profiler);

ElasticSearch Client Decorator

To profile Elasticsearch requests, you only need to decorate the Elasticsearch client with the ClientDecorator:

$elasticsearch = new Elasticsearch\Client(['your' => 'config']);
$client = new \Fabfuel\Prophiler\Decorator\Elasticsearch\ClientDecorator($client, $profiler);

Automatic EventsManger registration

Prophiler now uses existing EventsManagers when attaching the Db, Dispatcher and View plugins and uses the default one as fallback, if no EventsManager is defined.