in agent/php/ElasticApm/Impl/AutoInstrument/WordPressAutoInstrumentation.php [336:372]
private function discoverServiceFramework(): ?NameVersionData
{
if ($this->isServiceFrameworkSet) {
return $this->serviceFramework;
}
$loggerProxyDebug = $this->logger->ifDebugLevelEnabledNoLine(__FUNCTION__);
if (!$this->isReadyToWrapFilterCallbacks) {
$loggerProxyDebug && $loggerProxyDebug->log(__LINE__, 'Did not discover because expected WordPress code (_wp_filter_build_unique_id function) was not loaded');
$this->isServiceFrameworkSet = true;
return $this->serviceFramework;
}
global $wp_version;
/** @var ?string $reasonNotDiscovered */
$reasonNotDiscovered = null;
if (isset($wp_version)) {
if (is_string($wp_version)) {
$this->serviceFramework = new NameVersionData(self::SERVICE_FRAMEWORK_NAME, $wp_version);
} else {
$reasonNotDiscovered = '$wp_version global variable is set but it is not a string; $wp_version: '
. LoggableToString::convert(['type' => DbgUtil::getType($wp_version), 'value' => $wp_version]);
}
} else {
$reasonNotDiscovered = '$wp_version global variable is not set';
}
if ($reasonNotDiscovered === null) {
$loggerProxyDebug && $loggerProxyDebug->log(__LINE__, 'Discovered', ['serviceFramework' => $this->serviceFramework]);
} else {
$loggerProxyDebug && $loggerProxyDebug->log(__LINE__, 'Did not discover because ' . $reasonNotDiscovered);
}
$this->isServiceFrameworkSet = true;
return $this->serviceFramework;
}