...
|
...
|
@@ -10,6 +10,8 @@ import com.monitor.middleware.redis.model.TwemproxyInfo; |
|
|
import com.monitor.middleware.redis.model.TwemproxyVo;
|
|
|
import com.monitor.model.response.BaseResponse;
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
...
|
...
|
@@ -25,6 +27,7 @@ import java.util.Map; |
|
|
@RestController
|
|
|
@RequestMapping(value = "redisMonitor")
|
|
|
public class RedisCtrl {
|
|
|
public static final Logger DEBUG = LoggerFactory.getLogger(RedisCtrl.class);
|
|
|
|
|
|
@Autowired
|
|
|
IMObjectInfoService imObjectInfoService;
|
...
|
...
|
@@ -109,17 +112,28 @@ public class RedisCtrl { |
|
|
|
|
|
List<RedisVo> redisInfoList = new ArrayList<>();
|
|
|
|
|
|
try {
|
|
|
TwemproxyInfo twemproxyInfo = Constants.TWEMPROXY_INFO_MAP.get(twemproxy);
|
|
|
|
|
|
DEBUG.info("Query twemproxyinfo {} by key {}", twemproxyInfo, twemproxy);
|
|
|
|
|
|
|
|
|
for (Map.Entry<String, Long> entry : twemproxyInfo.getRequestMap().entrySet()) {
|
|
|
|
|
|
RedisInfo redisInfo = Constants.REDIS_INFO_MAP.get(entry.getKey());
|
|
|
|
|
|
DEBUG.info("Twemproxy {} contains redis {} ",twemproxy,redisInfo);
|
|
|
|
|
|
RedisVo redisVo = buildRedisVo(redisInfo);
|
|
|
|
|
|
redisInfoList.add(redisVo);
|
|
|
}
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
|
|
|
|
|
|
response.setData(redisInfoList);
|
|
|
|
|
|
return response;
|
...
|
...
|
@@ -161,7 +175,7 @@ public class RedisCtrl { |
|
|
|
|
|
redisVo.setRequestSec(String.valueOf(redisInfo.getReqCaps()));
|
|
|
|
|
|
redisVo.setHitRate(redisInfo.getHitRate()+" %");
|
|
|
redisVo.setHitRate(redisInfo.getHitRate() + " %");
|
|
|
|
|
|
return redisVo;
|
|
|
|
...
|
...
|
|