public function getQueriesOverTime(int $rootPageId, int $days = 30, int $bucketSeconds = 3600) : array
    {
        $now = time();
        $timeStart = $now - 86400 * intval($days); // 86400 seconds/day

        $queryBuilder = $this->getQueryBuilder();
        $result = $queryBuilder
            ->addSelectLiteral(
                'FLOOR(`tstamp`/' . $bucketSeconds . ') AS `bucket`',
                '(`tstamp` - (`tstamp` % 86400)) AS `timestamp`',
                $queryBuilder->expr()->count('*', 'numQueries')
            )
            ->from($this->table)
            ->andWhere(
                $queryBuilder->expr()->gt('tstamp', $timeStart),
                $queryBuilder->expr()->eq('root_pid', $rootPageId)
            )
            ->groupBy('bucket', 'timestamp')
            ->orderBy('bucket', 'ASC')
            ->execute()->fetchAll();

        return $result;
    }
public function getQueriesOverTime(int $rootPageId, int $days = 30, int $bucketSeconds = 3600) : array
    {
        $now = time();
        $timeStart = $now - 86400 * intval($days); // 86400 seconds/day

        $queryBuilder = $this->getQueryBuilder();
        $result = $queryBuilder
            ->addSelectLiteral(
                'FLOOR(`tstamp`/' . $bucketSeconds . ') AS `bucket`',
                '(`tstamp` - (`tstamp` % 86400)) AS `timestamp`',
                $queryBuilder->expr()->count('*', 'numQueries')
            )
            ->from($this->table)
            ->andWhere(
                $queryBuilder->expr()->gt('tstamp', $timeStart),
                $queryBuilder->expr()->eq('root_pid', $rootPageId)
            )
            ->groupBy('bucket', 'timestamp')
            ->orderBy('bucket', 'ASC')
            ->execute()->fetchAll();

        return $result;
    }
public function getQueriesOverTime ( int $ rootPageId , int $ days = 30 , int $ bucketSeconds = 3600 ) : array { $ now = time ( ) ; $ timeStart = $ now - 86400 * intval ( $ days ) ; // 86400 seconds/day $ queryBuilder = $ this -> getQueryBuilder ( ) ; $ result = $ queryBuilder -> addSelectLiteral ( 'FLOOR(`tstamp`/' . $ bucketSeconds . ') AS `bucket`' , '(`tstamp` - (`tstamp` % 86400)) AS `timestamp`' , $ queryBuilder -> expr ( ) -> count ( '*' , 'numQueries' ) ) -> from ( $ this -> table ) -> andWhere ( $ queryBuilder -> expr ( ) -> gt ( 'tstamp' , $ timeStart ) , $ queryBuilder -> expr ( ) -> eq ( 'root_pid' , $ rootPageId ) ) -> groupBy ( 'bucket' , 'timestamp' ) -> orderBy ( 'bucket' , 'ASC' ) -> execute ( ) -> fetchAll ( ) ; return $ result ; }
Get number of queries over time

@param int $rootPageId
@param int $days number of days of history to query
@param int $bucketSeconds Seconds per bucket
@return array [labels, data]
Get number of queries over time