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;
    }