use of com.sohu.tv.jedis.stat.enums.ClientCollectDataTypeEnum in project cachecloud by sohutv.
the class ClientReportCostDistriServiceImpl method batchSave.
@Override
public void batchSave(ClientReportBean clientReportBean) {
try {
// 1.client上报
final String clientIp = clientReportBean.getClientIp();
final long collectTime = clientReportBean.getCollectTime();
final long reportTime = clientReportBean.getReportTimeStamp();
final List<Map<String, Object>> datas = clientReportBean.getDatas();
if (datas == null || datas.isEmpty()) {
logger.warn("datas field {} is empty", clientReportBean);
return;
}
// 2.结果集
List<AppClientCostTimeStat> appClientCostTimeStatList = new ArrayList<AppClientCostTimeStat>();
// 3.解析结果
for (Map<String, Object> map : datas) {
Integer clientDataType = MapUtils.getInteger(map, ClientReportConstant.CLIENT_DATA_TYPE, -1);
ClientCollectDataTypeEnum clientCollectDataTypeEnum = ClientCollectDataTypeEnum.MAP.get(clientDataType);
if (clientCollectDataTypeEnum == null) {
continue;
}
if (ClientCollectDataTypeEnum.COST_TIME_DISTRI_TYPE.equals(clientCollectDataTypeEnum)) {
AppClientCostTimeStat appClientCostTimeStat = generate(clientIp, collectTime, reportTime, map);
if (appClientCostTimeStat != null) {
appClientCostTimeStatList.add(appClientCostTimeStat);
}
}
}
if (CollectionUtils.isNotEmpty(appClientCostTimeStatList)) {
// 4.批量保存
appClientCostTimeStatDao.batchSave(appClientCostTimeStatList);
// 5.合并app统计结果
List<AppClientCostTimeTotalStat> appClientCostTimeTotalStatList = mergeAppClientCostTimeStat(appClientCostTimeStatList);
if (CollectionUtils.isNotEmpty(appClientCostTimeTotalStatList)) {
appClientCostTimeTotalStatDao.batchSave(appClientCostTimeTotalStatList);
}
// 6.保存应用下节点和客户端关系
appInstanceClientRelationService.batchSave(appClientCostTimeStatList);
}
} catch (Exception e) {
logger.error(e.getMessage(), e);
}
}
use of com.sohu.tv.jedis.stat.enums.ClientCollectDataTypeEnum in project cachecloud by sohutv.
the class ClientReportValueDistriServiceImplV2 method batchSave.
@Override
public void batchSave(ClientReportBean clientReportBean) {
try {
// 1.client上报
final long collectTime = clientReportBean.getCollectTime();
final long reportTime = clientReportBean.getReportTimeStamp();
final List<Map<String, Object>> datas = clientReportBean.getDatas();
if (datas == null || datas.isEmpty()) {
logger.warn("datas field {} is empty", clientReportBean);
return;
}
// 3.解析
for (Map<String, Object> map : datas) {
Integer clientDataType = MapUtils.getInteger(map, ClientReportConstant.CLIENT_DATA_TYPE, -1);
ClientCollectDataTypeEnum clientCollectDataTypeEnum = ClientCollectDataTypeEnum.MAP.get(clientDataType);
if (clientCollectDataTypeEnum == null) {
continue;
}
if (ClientCollectDataTypeEnum.VALUE_LENGTH_DISTRI_TYPE.equals(clientCollectDataTypeEnum)) {
AppClientValueDistriStatTotal appClientValueDistriStat = generate(collectTime, reportTime, map);
if (appClientValueDistriStat != null) {
appClientValueStatDao.save(appClientValueDistriStat);
}
}
}
} catch (Exception e) {
logger.error(e.getMessage(), e);
}
}
use of com.sohu.tv.jedis.stat.enums.ClientCollectDataTypeEnum in project cachecloud by sohutv.
the class ClientReportExceptionServiceImpl method batchSave.
@Override
public void batchSave(ClientReportBean clientReportBean) {
try {
// 1.client上报
final String clientIp = clientReportBean.getClientIp();
final long collectTime = clientReportBean.getCollectTime();
final long reportTime = clientReportBean.getReportTimeStamp();
final List<Map<String, Object>> datas = clientReportBean.getDatas();
if (datas == null || datas.isEmpty()) {
logger.warn("datas field {} is empty", clientReportBean);
return;
}
// 2.结果集
List<AppClientExceptionStat> appClientExceptionStatList = new ArrayList<AppClientExceptionStat>();
// 3.解析
for (Map<String, Object> map : datas) {
Integer clientDataType = MapUtils.getInteger(map, ClientReportConstant.CLIENT_DATA_TYPE, -1);
ClientCollectDataTypeEnum clientCollectDataTypeEnum = ClientCollectDataTypeEnum.MAP.get(clientDataType);
if (clientCollectDataTypeEnum == null) {
continue;
}
if (ClientCollectDataTypeEnum.EXCEPTION_TYPE.equals(clientCollectDataTypeEnum)) {
AppClientExceptionStat appClientExceptionStat = generate(clientIp, collectTime, reportTime, map);
if (appClientExceptionStat != null) {
appClientExceptionStatList.add(appClientExceptionStat);
}
}
}
// 4.批量保存
if (CollectionUtils.isNotEmpty(appClientExceptionStatList)) {
appClientExceptionStatDao.batchSave(appClientExceptionStatList);
}
} catch (Exception e) {
logger.error(e.getMessage(), e);
}
}
Aggregations