Code Tracing

Zend Server Code Tracing is an in-depth diagnostic tool that enables real-time execution flow recording in production environments that allows you to drill-down to the function level to view actual performance related information and statistics. Code Tracing enables deep analysis of PHP execution and flow using drill-down requests related to an event (event rule), or triggered manually.

How do I work with Code Tracing?

The component focuses on collecting key data points, such as application functions and main PHP function calls, high-resolution timing and memory usage of execution elements and key PHP engine services such as Web server interface calls.

The information collection process focuses on keeping relevant information based on either user-defined parameters that trigger events, or a specific URL that is manually entered to be traced. For monitor events, each time an event is triggered the information is kept for further use. Otherwise, the information will be discarded to preserve disk-space. Events can also be triggered to generate a trace file for a specific URL.

Trace information is a capture of the function tree and enables deep tracing of the functions of the server parameters, including returns, memory and time (ms).

Tip!

To optimize performance in production environments, Zend Code Tracing for events can be activated for a set amount of time (120 seconds by default). For more information on configuring Code Tracing to maximize performance, see Configuring Code Tracing.

Workflows

The trace displayed in Zend Server functions like a DVD player, showing the recorded execution history of the application. Users can follow the footsteps of a single problematic request in order to quickly pinpoint the root cause of the problem:

  • Manual Workflow - The code tracing of a single request can be generated manually through the Code Tracing page in Zend Server (Debugging | Code Tracing). By executing a request, the full application execution is captured and stored in a trace file. The captured trace data can undergo collaborative reviewed leaving no need for developers and test engineers to pore over the symptoms of the defect and no room for misinterpretation of the events leading up to the error.
  • Event Monitoring Workflow - Collected as an additional level of event information by the Event Rules mechanism to generate a trace when an event occurs. Code tracing in Zend Server has very low performance overhead. This therefore enables its use either while running a load test in the lab or while running in production.

By leveraging the Zend Server event monitoring mechanism, code tracing can save trace data only when a problem occurs. For example, when the performance of a checkout process in a Web application drops below a predefined threshold, Zend Server can send an alert and capture the entire execution of the poorly performing request. The combination of knowing that a problem has occurred, while recording the entire execution flow, allows for quick identification and correction even before other users may notice.

Root Cause Analysis

The trace displayed in Zend Server enables you to view the execution history of your application and follow in the footsteps of an individual, problematic request to quickly pinpoint the root cause. Furthermore, the Export option allows you to transfer this information into Zend Server allowing you to transfer the information to developers.

Code Tracing Tree

The Code Tracing Tree tab displays the call tree for a selected event or trace file.

Code Tracing Statistics

The Statistics per Function tab provides a statistical perspective of the data captured in the request.