Commit 6c1fbf96 by 徐高华

好办加好友统计

parent 42f44a17
......@@ -3,9 +3,8 @@ package com.gic.haoban.manage.service.pojo;
public class HBQwMonitorBO {
private String host ;
private String type ;
private int num ;
private int failNum ;
public String getHost() {
return host;
}
......@@ -14,14 +13,6 @@ public class HBQwMonitorBO {
this.host = host;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public int getNum() {
return num;
}
......@@ -29,4 +20,12 @@ public class HBQwMonitorBO {
public void setNum(int num) {
this.num = num;
}
public int getFailNum() {
return failNum;
}
public void setFailNum(int failNum) {
this.failNum = failNum;
}
}
......@@ -41,9 +41,19 @@ public class HBQwMonitorUtils {
public static void addByTimer() {
List<String> ipList = DubboInvokeUtil.getServiceHostList(MemberUnionidRelatedApiService.class) ;
logger.info("add timer");
for(int i=0;i<keyList.size();i++) {
for(String ip : ipList) {
String key = keyList.get(i)+ip ;
int totalNum = getNum(keyList.get(0),ip) ;
int failNum = getNum(keyList.get(1),ip);
HBQwMonitorBO bo = new HBQwMonitorBO() ;
bo.setHost(ip);
bo.setNum(totalNum);
bo.setFailNum(failNum);
InfluxDbMonitorUtils.getInstance().friendAdd(bo);
}
}
private static int getNum(String key , String ip) {
int count = 0 ;
Object countObj = RedisUtil.getCache(key) ;
if(null != countObj) {
......@@ -51,13 +61,7 @@ public class HBQwMonitorUtils {
}
RAtomicLong cache = RedisUtil.getRedisClient().getAtomicLong(key);
cache.addAndGet(-count) ;
HBQwMonitorBO bo = new HBQwMonitorBO() ;
bo.setHost(ip);
bo.setType(""+i);
bo.setNum(count);
InfluxDbMonitorUtils.getInstance().friendAdd(bo);
}
}
return count ;
}
......
......@@ -58,9 +58,9 @@ public class InfluxDbMonitorUtils {
influxDB.write(Point.measurement("hb_qw_friend_monitor")
.time(System.currentTimeMillis(), TimeUnit.MILLISECONDS)
.addField("num", bo.getNum())
.addField("failNum",bo.getFailNum())
.tag("application","haoban-manage3")
.tag("host", bo.getHost())
.tag("type", bo.getType())
.build());
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment