Generating Callgraph Traces

If you want to generate a trace for either a webpage or a PHP script, there are three different possibilities for achieving this.

  1. Use the Chrome Extension,which is the preferred way.

  2. Use the Commandline Tool

  3. Append a query string (GET) parameter, as described in the Trigger Trace dialog, inside your application.

With the Chrome extension, you only have to be logged in to the Profiler to make it work. After that, select the application that you want to generate a trace with, start the profiling, refresh the page, and then stop profiling.

To get the hash for using the GET parameter, log into the Profiler and go to the Settings section of the application you want to trace. Copy the parameter and append it to the page you want to trace.

REST-APIs

You can generate traces for REST-APIs by sending an additional header. The easy way to do this is using the Profiler command line client, as it automatically passes the necessary HTTP Headers to either curl, wget or http (httpie) programs, without you having to bother.

After installing the Tideways command line tool, run it, as in the following example.

tideways run acme/myapp42 curl http://myapp42/api/call

Commandline Scripts

To generate a trace for a command-line PHP script, there are two options. The easier one is using the command line client, that will automatically pass the necessary environment variables without you having to bother. After installing the Tideways command line tool, run it, as in the following example.

tideways run acme/myapp42 php app/console slow:command

It you disabled auto-start, you should look into the PHP Library documentation for how to setup the Profiler.

Ajax Requests

Ajax requests cannot be easily traced directly. This is because they usually require both an active/authenticated session and are called asynchronously in your application.

This makes it hard to generate a trace with cURL. However, it is possible to generate traces for Ajax requests using the Chrome Extension.

The extension sets a cookie for a domain and forces all your requests to that domain to be collected for a limited amount of time. To use it, refresh a page which triggers the AJAX request(s) which you want to trace.

Still need help? Email [email protected]