public static function load()
    {
        if (!extension_loaded('opencensus')) {
            trigger_error('opencensus extension required to load Doctrine integrations.', E_USER_WARNING);
            return;
        }

        PDO::load();

        $persisterClass = (Version::compare('2.5.0') < 0)
            ? 'Doctrine\ORM\Persisters\Entity\BasicEntityPersister'    // Doctrine 2.5 or greater
            : 'Doctrine\ORM\Persisters\BasicEntityPersister';          // Doctrine 2.4 or earlier

        // public function load(array $criteria, $entity = null, $assoc = null, array $hints = array(),
        //      $lockMode = null, $limit = null, array $orderBy = null)
        opencensus_trace_method($persisterClass, 'load', function ($bep) {
            return [
                'name' => 'doctrine/load',
                'attributes' => ['entity' => $bep->getClassMetadata()->name],
                'kind' => Span::KIND_CLIENT
            ];
        });

        // public function loadAll(array $criteria = array(), array $orderBy = null, $limit = null, $offset = null)
        opencensus_trace_method($persisterClass, 'loadAll', function ($bep) {
            return [
                'name' => 'doctrine/loadAll',
                'attributes' => ['entity' => $bep->getClassMetadata()->name],
                'kind' => Span::KIND_CLIENT
            ];
        });

        // public int PDOConnection::exec(string $query)
        opencensus_trace_method(PDOConnection::class, 'exec', function ($scope, $query) {
            return [
                'name' => 'doctrine/exec',
                'attributes' => ['query' => $query],
                'kind' => Span::KIND_CLIENT
            ];
        });
    }
public static function load()
    {
        if (!extension_loaded('opencensus')) {
            trigger_error('opencensus extension required to load Doctrine integrations.', E_USER_WARNING);
            return;
        }

        PDO::load();

        $persisterClass = (Version::compare('2.5.0') < 0)
            ? 'Doctrine\ORM\Persisters\Entity\BasicEntityPersister'    // Doctrine 2.5 or greater
            : 'Doctrine\ORM\Persisters\BasicEntityPersister';          // Doctrine 2.4 or earlier

        // public function load(array $criteria, $entity = null, $assoc = null, array $hints = array(),
        //      $lockMode = null, $limit = null, array $orderBy = null)
        opencensus_trace_method($persisterClass, 'load', function ($bep) {
            return [
                'name' => 'doctrine/load',
                'attributes' => ['entity' => $bep->getClassMetadata()->name],
                'kind' => Span::KIND_CLIENT
            ];
        });

        // public function loadAll(array $criteria = array(), array $orderBy = null, $limit = null, $offset = null)
        opencensus_trace_method($persisterClass, 'loadAll', function ($bep) {
            return [
                'name' => 'doctrine/loadAll',
                'attributes' => ['entity' => $bep->getClassMetadata()->name],
                'kind' => Span::KIND_CLIENT
            ];
        });

        // public int PDOConnection::exec(string $query)
        opencensus_trace_method(PDOConnection::class, 'exec', function ($scope, $query) {
            return [
                'name' => 'doctrine/exec',
                'attributes' => ['query' => $query],
                'kind' => Span::KIND_CLIENT
            ];
        });
    }
public static function load ( ) { if ( ! extension_loaded ( 'opencensus' ) ) { trigger_error ( 'opencensus extension required to load Doctrine integrations.' , E_USER_WARNING ) ; return ; } PDO :: load ( ) ; $ persisterClass = ( Version :: compare ( '2.5.0' ) < 0 ) ? 'Doctrine\ORM\Persisters\Entity\BasicEntityPersister' // Doctrine 2.5 or greater : 'Doctrine\ORM\Persisters\BasicEntityPersister' ; // Doctrine 2.4 or earlier // public function load(array $criteria, $entity = null, $assoc = null, array $hints = array(), //      $lockMode = null, $limit = null, array $orderBy = null) opencensus_trace_method ( $ persisterClass , 'load' , function ( $ bep ) { return [ 'name' => 'doctrine/load' , 'attributes' => [ 'entity' => $ bep -> getClassMetadata ( ) -> name ] , 'kind' => Span :: KIND_CLIENT ] ; } ) ; // public function loadAll(array $criteria = array(), array $orderBy = null, $limit = null, $offset = null) opencensus_trace_method ( $ persisterClass , 'loadAll' , function ( $ bep ) { return [ 'name' => 'doctrine/loadAll' , 'attributes' => [ 'entity' => $ bep -> getClassMetadata ( ) -> name ] , 'kind' => Span :: KIND_CLIENT ] ; } ) ; // public int PDOConnection::exec(string $query) opencensus_trace_method ( PDOConnection :: class , 'exec' , function ( $ scope , $ query ) { return [ 'name' => 'doctrine/exec' , 'attributes' => [ 'query' => $ query ] , 'kind' => Span :: KIND_CLIENT ] ; } ) ; }
Static method to add instrumentation to Doctrine ORM calls
Static method to add instrumentation to Doctrine ORM calls