in prod/php/ElasticOTel/InferredSpans/InferredSpans.php [198:218]
private function filterOutAPMFrames(array &$stackTrace): ?int
{
// Filter out Elastic and Otel stack frames
$cutIndex = null;
for ($index = count($stackTrace) - 1; $index >= 0; $index--) {
$frame = $stackTrace[$index];
if (
array_key_exists('class', $frame) &&
(str_starts_with($frame['class'], 'OpenTelemetry\\') ||
str_starts_with($frame['class'], 'Elastic\\'))
) {
$cutIndex = $index;
break;
}
}
if ($cutIndex !== null) {
array_splice($stackTrace, 0, $cutIndex + 1);
}
return $cutIndex;
}