in agent/php/ElasticApm/Impl/AutoInstrument/AutoInstrumentationBase.php [50:86]
public function isEnabled(?string &$reason = null): bool
{
if ($this->requiresAttachContextToExternalObjects() && !MapPerWeakObject::isSupported()) {
$reason = 'Instrumentation ' . $this->name() . ' needs to attach context to external objects'
. ' but none of the MapPerWeakObject implementations is supported by the current environment';
return false;
}
$isUserlandCodeInstrumentationEnabled = $this->tracer->getConfig()->astProcessEnabled();
if ($this->requiresUserlandCodeInstrumentation() && (!$isUserlandCodeInstrumentationEnabled)) {
$reason = 'Instrumentation ' . $this->name() . ' needs userland code instrumentation'
. ' but AST-process is the only currently supported mechanism to instrument userland code and it is DISABLED'
. ' (via ' . OptionNames::AST_PROCESS_ENABLED . ' configuration option)';
return false;
}
$disabledInstrumentationsMatcher = $this->tracer->getConfig()->disableInstrumentations();
if ($disabledInstrumentationsMatcher === null) {
return true;
}
if ($disabledInstrumentationsMatcher->match($this->name()) !== null) {
$reason = 'name (`' . $this->name() . '\') is matched by '
. OptionNames::DISABLE_INSTRUMENTATIONS . ' configuration option';
return false;
}
foreach ($this->keywords() as $keyword) {
if ($disabledInstrumentationsMatcher->match($keyword) !== null) {
$reason = 'one of keywords (`' . $keyword . '\') is matched by '
. OptionNames::DISABLE_INSTRUMENTATIONS . ' configuration option';
return false;
}
}
return true;
}