public function getRpSum($rp, $metric, $tags, $startDt = null, $endDt = null) {
        if (null == $rp || null == $metric) {
            return 0;
        }
        
        $where = [];
        
        if (isset($startDt)) {
            $where[] = "time >= '" . $startDt . "'";
        }
        
        if (!isset($endDt)) {
            $endDt = '2100-01-01T00:00:00Z';
        }
        $where[] = "time <= '" . $endDt . "'";
    
        foreach ($tags as $key => $val) {
            $where[] = "$key = '" . $val . "'";
        }

        $points = $this->db->getQueryBuilder()
                ->retentionPolicy($rp)
                ->from($metric)
                ->where($where)
                ->sum('value')
                ->getResultSet()
                ->getPoints();
                
        return isset($points[0]) && isset($points[0]["sum"]) ? $points[0]["sum"] : 0;
    }
public function getRpSum($rp, $metric, $tags, $startDt = null, $endDt = null) {
        if (null == $rp || null == $metric) {
            return 0;
        }
        
        $where = [];
        
        if (isset($startDt)) {
            $where[] = "time >= '" . $startDt . "'";
        }
        
        if (!isset($endDt)) {
            $endDt = '2100-01-01T00:00:00Z';
        }
        $where[] = "time <= '" . $endDt . "'";
    
        foreach ($tags as $key => $val) {
            $where[] = "$key = '" . $val . "'";
        }

        $points = $this->db->getQueryBuilder()
                ->retentionPolicy($rp)
                ->from($metric)
                ->where($where)
                ->sum('value')
                ->getResultSet()
                ->getPoints();
                
        return isset($points[0]) && isset($points[0]["sum"]) ? $points[0]["sum"] : 0;
    }
public function getRpSum ( $ rp , $ metric , $ tags , $ startDt = null , $ endDt = null ) { if ( null == $ rp || null == $ metric ) { return 0 ; } $ where = [ ] ; if ( isset ( $ startDt ) ) { $ where [ ] = "time >= '" . $ startDt . "'" ; } if ( ! isset ( $ endDt ) ) { $ endDt = '2100-01-01T00:00:00Z' ; } $ where [ ] = "time <= '" . $ endDt . "'" ; foreach ( $ tags as $ key => $ val ) { $ where [ ] = "$key = '" . $ val . "'" ; } $ points = $ this -> db -> getQueryBuilder ( ) -> retentionPolicy ( $ rp ) -> from ( $ metric ) -> where ( $ where ) -> sum ( 'value' ) -> getResultSet ( ) -> getPoints ( ) ; return isset ( $ points [ 0 ] ) && isset ( $ points [ 0 ] [ "sum" ] ) ? $ points [ 0 ] [ "sum" ] : 0 ; }
Get total from retention policy

@param string $rp
@param string $metric
@param array $tags
@param string $startDt
@param string $endDt
@return int
Get total from retention policy