As well as adding new sensors, Instana is constantly improving and enhancing the existing ones. Adding support for new frameworks and versions along with adding new functionality, we endeavour to keep all the sensors in functional parity.
The PHP sensor is no exception to this rule, supporting from PHP versions 5.3 through to 7.2 (32 bit and 64 bit) across a number of SAPIs:
- Apache mod_php
- Limited support for CLI
Take a look at the PHP Management documentation for complete details of the capabilities.
The PHP runtime is automatically detected by the Instana agent and the sensor dynamically loaded to gather both time series metrics and automatic code instrumentation for tracing, all without the need for any code changes.
Tracing PHP Applications
Every request is automatically traced end to end. A trace is made up of a number of spans as the request traverses across different services and calls are made to data stores and external services.
The automatic tracing will capture all the supported entry and exit calls along with their stack traces. What if you have a critical bit of code you want more details on, such as timing, runtime data and error messages?
Bringing the PHP sensor into functional parity with the other supported language runtime sensors, the latest version of the PHP sensor now has the capability to add your own custom spans to the automatically captured traces. These custom spans will appear inline with the automatically captured spans. Here is an example of how you can easily achieve this.
// Instana Tracer only available when auto instrumented
$tracer = new InstanaTracer();
$span = $tracer->createSpan(‘funky’);
// interesting bit of code ;-)
Using a code snippet similar to the one above around an interesting function call will produce a trace like the one below.
The entry into PHP and the call via PDO to the MySQL database are automatically traced, notice that the custom span created with the snipped above has been included in the trace.
Shine a Light Into PHP and Microservices
With microservices most of the code executed belongs to the frameworks being used, your own code making up just a small percentage. Instana’s automatic instrumentation will provide plenty of insight into the execution of both. However, there may be occasions when a little extra insight is needed to optimise a critical code block. The PHP sensor now has that capability with custom spans, adding the ability to shine a little light into the darkest corners of code execution.