Custom Instrumentation

Tideways provides a very flexible extension API to customize the integration with your application code for the best possible profiling experience.  With the PHP Extension API you can trigger additional profiling features, add custom metadata, events, timespans to the timeline and more.

To prevent class not exists fatal errors, when the Tideways extension is not loaded, you use a defensive guard clause by calling class_exists():

<?php

if (class_exists('Tideways\Profiler')) {
 // then here selected API-Call look at Overview/Documentation
}
  • Profiling Programmatically in PHP Code: The Tideways Profiler [can be enabled and disabled in PHP code, when more control is needed than automatically starting via PHP.ini settings. One such use case is long-running worker scripts or background jobs.

  • Detecting Transaction Names: By setting appropriate transaction names, the Tideways Profiler can separate the profiling results of different application endpoints. Transaction names can be set both manually and in code. However, transaction names are automatically set for supported frameworks.

  • Detecting Service Name: By creating additional services, in addition to the default two, the Tideways Profiler can differentiate between different types of application users. This is helpful when the needs and timing of one class of users is notably different from another type.

  • Logging Errors and Detecting exceptions: In addition to logging PHP fatal errors and exceptions from supported framework, you can instrument your code to log errors and exceptions.

  • Add Custom Metadata to Traces: You can add custom metadata to traces to provide greater context about them. This can be helpful when reviewing them at a future point in time.

  • Add Custom Timespans to Timeline: Three APIs are available for adding additional timespans for your application, such as for SQL queries and HTTP requests. These can help the Timeline Profiler provide greater granularity to analysis of an application.

  • Enable Callgraph and Timeline: When you are debugging performance problems, enabling a full callgraph of every function call can give you more detailed insights than a regular timeline trace.

  • Trigger Callgraph When Function/Method Called: Triggering a callgraph only when a function or method is called helps avoid the overhead of the Callgraph Profiler, yet provides the rich, detailed granularity of analysis which only the Callgraph Profiler can provide.

  • Add Custom Event Marker to Timeline: Instead of only seeing a request from the beginning until the end, you can add more context to the Tideways Trace Timelines by marking points in your own code. This allows you to add greater context when a function or an operation starts, for example, by adding additional metadata at key execution points.

Still need help? Email [email protected]