IcingaConfig: use Benchmark
This commit is contained in:
parent
d26a7b07da
commit
5138501dc1
|
@ -8,6 +8,7 @@ use Icinga\Module\Director\Util;
|
||||||
use Icinga\Module\Director\Objects\IcingaHost;
|
use Icinga\Module\Director\Objects\IcingaHost;
|
||||||
use Icinga\Module\Director\Objects\IcingaZone;
|
use Icinga\Module\Director\Objects\IcingaZone;
|
||||||
use Icinga\Module\Director\Objects\IcingaEndpoint;
|
use Icinga\Module\Director\Objects\IcingaEndpoint;
|
||||||
|
use Icinga\Application\Benchmark;
|
||||||
use Icinga\Web\Hook;
|
use Icinga\Web\Hook;
|
||||||
use Exception;
|
use Exception;
|
||||||
|
|
||||||
|
@ -386,12 +387,14 @@ throw $e;
|
||||||
protected function createFileFromDb($type)
|
protected function createFileFromDb($type)
|
||||||
{
|
{
|
||||||
$class = 'Icinga\\Module\\Director\\Objects\\Icinga' . ucfirst($type);
|
$class = 'Icinga\\Module\\Director\\Objects\\Icinga' . ucfirst($type);
|
||||||
|
Benchmark::measure(sprintf('Prefetching %s', $type));
|
||||||
$objects = $class::prefetchAll($this->connection);
|
$objects = $class::prefetchAll($this->connection);
|
||||||
return $this->createFileForObjects($type, $objects);
|
return $this->createFileForObjects($type, $objects);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function createFileForObjects($type, $objects)
|
protected function createFileForObjects($type, $objects)
|
||||||
{
|
{
|
||||||
|
Benchmark::measure(sprintf('Generating %d %s', count($objects), $type));
|
||||||
if (empty($objects)) return $this;
|
if (empty($objects)) return $this;
|
||||||
$masterZone = $this->getMasterZoneName();
|
$masterZone = $this->getMasterZoneName();
|
||||||
$globalZone = $this->getGlobalZoneName();
|
$globalZone = $this->getGlobalZoneName();
|
||||||
|
|
Loading…
Reference in New Issue