Where to go in Kibana to see Span details for APM?

The reason for this issue might be the fact that the transaction is begun but not ended.
There is actually no need to start a transaction since there's always a default transaction that is automatically started (Public API | APM PHP Agent Reference [1.x] | Elastic) and ended by Elastic APM PHP agent itself.
So one way to fix it:

<?php

use Elastic\Apm\ElasticApm;

$transaction = ElasticApm::getCurrentTransaction();

$span = $transaction->beginCurrentSpan(
    'spangled_banner',
    'span_type',
    'span_sub-type', // optional
    'span_action' // optional
);
try {
    // do your thing ...
    echo 'start sleep';
    sleep(3);
    echo 'done sleeping';
} finally {
    $span->end();
}

2 Likes