public function astInstrumentationDirectCall()

in agent/php/ElasticApm/Impl/AutoInstrument/InterceptionManager.php [181:210]


    public function astInstrumentationDirectCall(string $method): void
    {
        $localLogger = $this->logger->inherit()->addAllContext(['method' => $method]);

        $loggerProxyTrace = $localLogger->ifTraceLevelEnabledNoLine(__FUNCTION__);
        $loggerProxyTrace && $loggerProxyTrace->log(__LINE__, 'Entered');

        $wordPressAutoInstrumIfEnabled = $this->builtinPlugin->getWordPressAutoInstrumentationIfEnabled();
        if ($wordPressAutoInstrumIfEnabled === null) {
            static $loggedOnce = false;
            if (!$loggedOnce) {
                $loggerProxyTrace && $loggerProxyTrace->log(__LINE__, 'WordPress instrumentation is DISABLED');
                $loggedOnce = true;
            }
            return;
        }

        static $dbgImplFuncDesc = null;
        if ($dbgImplFuncDesc === null) {
            $dbgImplFuncDesc = ClassNameUtil::fqToShort(WordPressAutoInstrumentation::class) . '->directCall';
        }
        /** @var string $dbgImplFuncDesc */
        $loggerProxyTrace && $loggerProxyTrace->log(__LINE__, 'Calling ' . $dbgImplFuncDesc . '...');
        try {
            $wordPressAutoInstrumIfEnabled->directCall($method);
            $loggerProxyTrace && $loggerProxyTrace->log(__LINE__, $dbgImplFuncDesc . ' completed without throwing');
        } catch (Throwable $throwable) {
            ($loggerProxy = $localLogger->ifErrorLevelEnabled(__LINE__, __FUNCTION__)) && $loggerProxy->logThrowable($throwable, $dbgImplFuncDesc . ' has thrown');
        }
    }