PHP Custom Instrumentation
AppSignal is compatible with OpenTelemetry instrumentation packages. This does not always include the information you need to debug issues.
For more fine-grained reporting, you can add custom instrumentation.
We support OpenTelemetry tracing as laid out in the OpenTelemetry documentation. It's possible to add more data to span using OpenTelemetry span attributes.
There are also AppSignal span attributes that can change how traces are grouped and some attributes that allow for setting sensitive data that is filtered before being sent to our servers.
Setup
When adding custom instrumentation, first create a new span:
$tracerProvider = \OpenTelemetry\API\Globals::tracerProvider(); $tracer = $tracerProvider->getTracer("custom-instrumentation"); $span = $tracer->spanBuilder("rollTheDice")->startSpan();
Or fetch the current active one:
$span = OpenTelemetry\API\Trace\Span::getCurrent();
More ways to create and get spans is documented in the OpenTelemetry PHP Manual Instrumentation page.
AppSignal attributes
Once you have created, or fetched, a span, you can set certain attributes that are specific to AppSignal to customize how the data arrives in AppSignal.
$span->setAttribute("attribute name", "attribute value")
See our guides for more information on what custom AppSignal attributes are supported.