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():

if (class_exists('Tideways\Profiler')) {
 // then here selected API-Call look at Overview/Documentation
}

Overview of Tideways PHP Extension API calls

This page shows an overview of all the Extension API calls and links to dedicated documentation pages which explain the calls with more detail and different use-cases.

Profiling Programmatically in PHP Code
\Tideways\Profiler::start();
\Tideways\Profiler::stop();

Detecting Transaction Names

\Tideways\Profiler::setTransactionName($transactionName);
\Tideways\Profiler::detectTransactionFunction($transactionMethode);

Detecting Service Name

\Tideways\Profiler::setServiceName($serviceName);

Logging Errors and detecting Exceptions

\Tideways\Profiler::detectExceptionFunction('my_exception_handler');
\Tideways\Profiler::logException($e);
\Tideways\Profiler::logFatal($message, $file, $line, $typeOrClass, $frames);

Add Custom Metadata to Trace

\Tideways\Profiler::setCustomVariable($name, $value).

Add Custom Timespans to Timeline

\Tideways\Profiler::watch('Acme\Library::doSomething');
\Tideways\Profiler::watchCallback($callback)
\Tideways\Profiler::createSpan('sql');

Enable Callgraph and Timeline

These methods are only available with Tideways Extension Version 5.0.46 and higher. Please upgrade the extension to the latest version before using this API.

\Tideways\Profiler::enableCallgraphProfiler(); 
\Tideways\Profiler::enableTracingProfiler();

Trigger Callgraph when Function/Method Called

These methods are only available with Tideways Extension Version 5.0.46 and higher. Please upgrade the extension to the latest version before using this API.

\Tideways\Profiler::triggerCallgraphOn($myFunction);

Add Custom Event Marker to Timeline

These methods are only available with Tideways Extension Version 5.0.46 and higher. Please upgrade the extension to the latest version before using this API.

\Tideways\Profiler::addEventMarker('MyPointInCode');

Still need help? Write [email protected] Write [email protected]