Benjamin Benjamin 24.11.2014

New Extension Release: Auto-Start Profiler

We released an important milestone with the Tideways Profiler extension today. The new version allows you to start profiling and monitoring your applications without any code modifications. Documentation and setup guides will be adjusted to reflect this much simpler installation in the next days.

When you install the PECL extension in version 1.3.2 from the Debian/Ubuntu repository or the Tarball, the dependency to the PHP library is now bundled. During request startup the PHP library is loaded directly from the extension. The Tideways\Profiler class is available in every request as if it was a built in PHP class.

The API Key, sampling rate and transaction function can then be configured from the php.ini:

# php.ini
tideways.api_key=abcdefg
tideways.sample_rate=10
tideways.transaction_function=Symfony\Bundle\FrameworkBundle\Controller\ControllerResolver::createController

Or alternativly by setting the values as environment values, for example in PHP-FPM Pool

env[TIDEWAYS_APIKEY]=abcdefg
env[TIDEWAYS_SAMPLERATE]=10
env[TIDEWAYS_TRANSACTION_NAME]=Symfony\Bundle\FrameworkBundle\Controller\ControllerResolver::createController

or Apache2 Configuration:

SetEnv TIDEWAYS_APIKEY abcdefg
SetEnv TIDEWAYS_SAMPLERATE 10
SetEnv TIDEWAYS_TRANSACTION_NAME "Symfony\Bundle\FrameworkBundle\Controller\ControllerResolver::createController"

In combination with the daemon installation, which already requires zero interaction, it is now possible for operations to fully automate the installation of the Profiler using orchestration tools like Puppet, Chef or Ansible.

Please note that auto-starting the Profiler is entirely optional. If you prefer starting the Profiler explicitly from your application this is still possible.

You can control the auto-start behavior of the extension with two additional php.ini variables:

  • tideways.load_library=0 will disable loading Tideways.php entirely.
  • tideways.auto_start=0 will only disable the autostarting functionality and you have to call Tideways\Profiler::start() yourself. Autostarting only works when the API Key is provided in the INI as well.

With the introduction of the INI variables for api-key and sample-rate, passing them to the start() method becomes optional:

<?php

\Tideways\Profiler::start();

This will force the generation of a trace for this console script invocation.

We have also updated the daemon to a new version 0.3.1, which contains improvements in error handling, error logging and data transfer encoding.

You can find pre-compiled binaries for the PECL extension and the Daemon on our downloads page.

Note: We have found that loading PHP code from within an extension is not compatible with Xdebug yet. In case you use Xdebug the auto-loading feature is automatically disabled and the Tideways\Profiler class will not be available to you. A fix for this problem is already merged to the current stable branch of Xdebug and should be part of the next Xdebug 2.2.7 release.