|
@@ -8,6 +8,7 @@ import com.jjt.biz.mapper.AlarmRecordMapper;
|
|
|
import com.jjt.biz.mapper.BizObjMetricsDataMapper;
|
|
|
import com.jjt.biz.mapper.BizObjMetricsMapper;
|
|
|
import com.jjt.biz.service.*;
|
|
|
+import com.jjt.biz.vo.AgentVO;
|
|
|
import com.jjt.common.exception.ServiceException;
|
|
|
import com.jjt.common.utils.DateUtils;
|
|
|
import com.jjt.common.utils.StringUtils;
|
|
@@ -47,7 +48,7 @@ public class BizObjMetricsServiceImpl implements IBizObjMetricsService {
|
|
|
@Resource
|
|
|
private IBizObjService objService;
|
|
|
@Resource
|
|
|
- private IBizObjAppService appService;
|
|
|
+ private IBizObjPpAgentService agentService;
|
|
|
@Resource
|
|
|
private IPinpointService pinpointService;
|
|
|
@Resource
|
|
@@ -342,19 +343,29 @@ public class BizObjMetricsServiceImpl implements IBizObjMetricsService {
|
|
|
// 获取应用程序的code
|
|
|
String appName = bizObj.getObjAddr();
|
|
|
|
|
|
- Long time = Long.parseLong(configService.selectConfigByKey("pp.api.time"));
|
|
|
+ long time = Long.parseLong(configService.selectConfigByKey("pp.api.time"));
|
|
|
LocalDateTime endTime = LocalDateTime.now();
|
|
|
|
|
|
LocalDateTime startTime = endTime.minusMinutes(time);
|
|
|
Map<String, String> appMap = pinpointService.getApps();
|
|
|
String appType = appMap.get(appName);
|
|
|
|
|
|
+ List<AgentVO> agentList = pinpointService.agentList(appName, startTime, endTime);
|
|
|
// 获取监控数据
|
|
|
-// Float tps = pinpointService.tps(appName, startTime, endTime);
|
|
|
-// int openFiles = pinpointService.openFile(appName, startTime, endTime);
|
|
|
-// Map<String, Object> jvmInfo = pinpointService.jvmMemory(appName, startTime, endTime);
|
|
|
-// float heapUsage = (float) jvmInfo.get("usage");
|
|
|
-// int gcCount = (int) jvmInfo.get("gc");
|
|
|
+ agentList.forEach(vo -> {
|
|
|
+ if (vo.getCode() == 100) {
|
|
|
+ Float tps = pinpointService.tps(vo.getAgentId(), startTime, endTime);
|
|
|
+ int openFiles = pinpointService.openFile(vo.getAgentId(), startTime, endTime);
|
|
|
+ Map<String, Object> jvmInfo = pinpointService.jvmMemory(vo.getAgentId(), startTime, endTime);
|
|
|
+ float heapUsage = (float) jvmInfo.get("usage");
|
|
|
+ int gcCount = (int) jvmInfo.get("gc");
|
|
|
+
|
|
|
+ vo.setTps(tps);
|
|
|
+ vo.setOpenFiles(openFiles);
|
|
|
+ vo.setHeapUsage(heapUsage);
|
|
|
+ vo.setGcCount(gcCount);
|
|
|
+ }
|
|
|
+ });
|
|
|
|
|
|
JSONObject linkData = pinpointService.link(appName, appType, startTime, endTime);
|
|
|
JSONArray nodeDataArray = linkData.getJSONObject("applicationMapData").getJSONArray("nodeDataArray");
|
|
@@ -373,14 +384,15 @@ public class BizObjMetricsServiceImpl implements IBizObjMetricsService {
|
|
|
}
|
|
|
|
|
|
// 1.更新 BIZ_OBJ_PP 表
|
|
|
- updateBizObjPpTable(objId, pinpointVOList);
|
|
|
+ updateBizObjPpTable(objId, pinpointVOList, agentList);
|
|
|
|
|
|
// 2.更新业务对象指标表
|
|
|
- updateBizObjMetrics(objId, null, 0, 0, 0, pinpointVOList, date);
|
|
|
+ updateBizObjMetrics(objId, agentList, pinpointVOList, date);
|
|
|
// updateBizObjMetrics(objId, tps, openFiles, heapUsage, gcCount, pinpointVOList, date);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+
|
|
|
/**
|
|
|
* 根据objId获取prometheus指标值
|
|
|
*
|
|
@@ -491,6 +503,7 @@ public class BizObjMetricsServiceImpl implements IBizObjMetricsService {
|
|
|
}
|
|
|
}
|
|
|
om.setDValue(dv);
|
|
|
+
|
|
|
BizObjMetricsData data = new BizObjMetricsData();
|
|
|
data.setObjMetricsId(om.getObjMetricsId());
|
|
|
data.setdValue(om.getDValue());
|
|
@@ -620,16 +633,48 @@ public class BizObjMetricsServiceImpl implements IBizObjMetricsService {
|
|
|
|
|
|
/**
|
|
|
* 更新BIZ_OBJ_PP
|
|
|
+ * 更新agent
|
|
|
*
|
|
|
* @param objId 对象ID
|
|
|
* @param pinpointVOList PP组成
|
|
|
+ * @param agentList agentId列表
|
|
|
*/
|
|
|
- private void updateBizObjPpTable(Long objId, List<PinpointVO> pinpointVOList) {
|
|
|
+ private void updateBizObjPpTable(Long objId, List<PinpointVO> pinpointVOList, List<AgentVO> agentList) {
|
|
|
+ List<BizObjPpAgent> existingAgentList = agentService.selectBizObjPpAgentListByObjId(objId);
|
|
|
+ Set<String> ags = agentList.stream()
|
|
|
+ .map(AgentVO::getAgentId)
|
|
|
+ .collect(Collectors.toSet());
|
|
|
+ //删除表中存在,agentList中不存在的记录
|
|
|
+ existingAgentList.forEach(ag -> {
|
|
|
+ if (!ags.contains(ag.getAgentId())) {
|
|
|
+ agentService.delete(ag);
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+
|
|
|
+ Set<String> existingAgents = existingAgentList.stream()
|
|
|
+ .map(BizObjPpAgent::getAgentId)
|
|
|
+ .collect(Collectors.toSet());
|
|
|
+
|
|
|
List<BizObjPp> existingPpList = ppService.selectBizObjPpListByObjId(objId);
|
|
|
Set<String> existingNames = existingPpList.stream()
|
|
|
.map(BizObjPp::getPpName)
|
|
|
.collect(Collectors.toSet());
|
|
|
|
|
|
+ List<BizObjPpAgent> agents = new ArrayList<>();
|
|
|
+ List<BizObjPp> pps = new ArrayList<>();
|
|
|
+ agentList.forEach(vo -> {
|
|
|
+ //如果没有,则添加
|
|
|
+ if (!existingAgents.contains(vo.getAgentId()) && vo.getCode() == 100) {
|
|
|
+ BizObjPpAgent agent = new BizObjPpAgent();
|
|
|
+ agent.setAgentId(vo.getAgentId());
|
|
|
+ agent.setObjId(objId);
|
|
|
+ agentService.insertBizObjPpAgent(agent);
|
|
|
+ agents.add(agent);
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+
|
|
|
pinpointVOList.stream()
|
|
|
.filter(vo -> !existingNames.contains(vo.getApplicationName()))
|
|
|
.forEach(vo -> {
|
|
@@ -639,66 +684,85 @@ public class BizObjMetricsServiceImpl implements IBizObjMetricsService {
|
|
|
pp.setPpName(vo.getApplicationName());
|
|
|
pp.setPpType(vo.getCategory());
|
|
|
ppService.insertBizObjPp(pp);
|
|
|
-
|
|
|
- // 根据模板更新业务对象指标表
|
|
|
- updateBizObjMetricsFromTemplate(objId, pp);
|
|
|
- existingPpList.add(pp);
|
|
|
+ pps.add(pp);
|
|
|
});
|
|
|
+ updateBizObjMetricsFromTemplate(objId, agents, pps);
|
|
|
}
|
|
|
|
|
|
+
|
|
|
/**
|
|
|
* 根据模板更新业务对象指标表
|
|
|
*
|
|
|
- * @param objId 对象ID
|
|
|
- * @param pp pp对象
|
|
|
+ * @param objId 对象ID
|
|
|
+ * @param agents agent对象
|
|
|
+ * @param pps pp对象
|
|
|
*/
|
|
|
- private void updateBizObjMetricsFromTemplate(Long objId, BizObjPp pp) {
|
|
|
+ private void updateBizObjMetricsFromTemplate(Long objId, List<BizObjPpAgent> agents, List<BizObjPp> pps) {
|
|
|
List<BizObjTpl> templateList = objTplService.selectTplList4objId(objId);
|
|
|
- templateList.forEach(template -> insertOrUpdateMetricsFromTemplate(objId, template.getTplId(), pp));
|
|
|
+ templateList.forEach(template -> insertOrUpdateMetricsFromTemplate(objId, template.getTplId(), agents, pps));
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 更新模板中的pinpoint指标到业务对象指标
|
|
|
*
|
|
|
- * @param objId 对象ID
|
|
|
- * @param tplId 模板ID
|
|
|
- * @param pp pinpoint组成
|
|
|
+ * @param objId 对象ID
|
|
|
+ * @param tplId 模板ID
|
|
|
+ * @param agents agent对象
|
|
|
+ * @param pps pp对象
|
|
|
*/
|
|
|
- private void insertOrUpdateMetricsFromTemplate(Long objId, Long tplId, BizObjPp pp) {
|
|
|
+ private void insertOrUpdateMetricsFromTemplate(Long objId, Long tplId, List<BizObjPpAgent> agents, List<BizObjPp> pps) {
|
|
|
MetricsTplDetail query = new MetricsTplDetail();
|
|
|
query.setTplId(tplId);
|
|
|
List<MetricsTplDetail> list = detailService.selectMetricsTplDetailList(query);
|
|
|
List<BizObjMetrics> objMetrics = new ArrayList<>();
|
|
|
list.forEach(d -> {
|
|
|
- if ("1".equals(d.getMetricsDef().getMetricsType()) && !d.getMetricsDef().getMetricsCode().startsWith("pp.jvm.")) {
|
|
|
- //如果是pinpoint,需要
|
|
|
- // 1.获取对象pinpoint组成
|
|
|
- BizObjMetrics ms = new BizObjMetrics();
|
|
|
- ms.setObjId(objId);
|
|
|
- ms.setTplId(tplId);
|
|
|
- ms.setMetricsId(d.getMetricsId());
|
|
|
- ms.setMetricsName(pp.getPpType() + "/" + d.getMetricsDef().getMetricsName());
|
|
|
- ms.setMetricsCode(d.getMetricsDef().getMetricsCode());
|
|
|
- if (pp.getPpType().equals("REDIS")) {
|
|
|
- //redis需要将1s换成100ms 3s换成300ms 5s换成500ms
|
|
|
- if (d.getMetricsCode().endsWith("1s")) {
|
|
|
- ms.setMetricsName(ms.getMetricsName().replace("1s", "100ms"));
|
|
|
- ms.setMetricsCode(ms.getMetricsCode().replace("1s", "100ms"));
|
|
|
- }
|
|
|
- if (d.getMetricsCode().endsWith("3s")) {
|
|
|
- ms.setMetricsName(ms.getMetricsName().replace("3s", "300ms"));
|
|
|
- ms.setMetricsCode(ms.getMetricsCode().replace("3s", "300ms"));
|
|
|
- }
|
|
|
- if (d.getMetricsCode().endsWith("5s")) {
|
|
|
- ms.setMetricsName(ms.getMetricsName().replace("5s", "500ms"));
|
|
|
- ms.setMetricsCode(ms.getMetricsCode().replace("5s", "500ms"));
|
|
|
- }
|
|
|
+ if ("1".equals(d.getMetricsDef().getMetricsType())) {
|
|
|
+ if (!d.getMetricsDef().getMetricsCode().startsWith("pp.jvm.")) {
|
|
|
+ //如果是pinpoint链路指标,需要
|
|
|
+ // 1.获取对象pinpoint组成
|
|
|
+ pps.forEach(pp -> {
|
|
|
+ BizObjMetrics ms = new BizObjMetrics();
|
|
|
+ ms.setObjId(objId);
|
|
|
+ ms.setTplId(tplId);
|
|
|
+ ms.setMetricsId(d.getMetricsId());
|
|
|
+ ms.setMetricsName(pp.getPpType() + "/" + d.getMetricsDef().getMetricsName());
|
|
|
+ ms.setMetricsCode(d.getMetricsDef().getMetricsCode());
|
|
|
+ if (pp.getPpType().equals("REDIS")) {
|
|
|
+ //redis需要将1s换成100ms 3s换成300ms 5s换成500ms
|
|
|
+ if (d.getMetricsCode().endsWith("1s")) {
|
|
|
+ ms.setMetricsName(ms.getMetricsName().replace("1s", "100ms"));
|
|
|
+ ms.setMetricsCode(ms.getMetricsCode().replace("1s", "100ms"));
|
|
|
+ }
|
|
|
+ if (d.getMetricsCode().endsWith("3s")) {
|
|
|
+ ms.setMetricsName(ms.getMetricsName().replace("3s", "300ms"));
|
|
|
+ ms.setMetricsCode(ms.getMetricsCode().replace("3s", "300ms"));
|
|
|
+ }
|
|
|
+ if (d.getMetricsCode().endsWith("5s")) {
|
|
|
+ ms.setMetricsName(ms.getMetricsName().replace("5s", "500ms"));
|
|
|
+ ms.setMetricsCode(ms.getMetricsCode().replace("5s", "500ms"));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ms.setDataExp(ms.getMetricsCode());
|
|
|
+ ms.setAlarmLow(d.getAlarmLow());
|
|
|
+ ms.setAlarmMid(d.getAlarmMid());
|
|
|
+ ms.setAlarmHigh(d.getAlarmHigh());
|
|
|
+ objMetrics.add(ms);
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ agents.forEach(agent -> {
|
|
|
+ BizObjMetrics ms = new BizObjMetrics();
|
|
|
+ ms.setObjId(objId);
|
|
|
+ ms.setTplId(tplId);
|
|
|
+ ms.setMetricsId(d.getMetricsId());
|
|
|
+ ms.setMetricsName(agent.getAgentId() + "/" + d.getMetricsDef().getMetricsName());
|
|
|
+ ms.setMetricsCode(d.getMetricsDef().getMetricsCode());
|
|
|
+ ms.setDataExp(ms.getMetricsCode());
|
|
|
+ ms.setAlarmLow(d.getAlarmLow());
|
|
|
+ ms.setAlarmMid(d.getAlarmMid());
|
|
|
+ ms.setAlarmHigh(d.getAlarmHigh());
|
|
|
+ objMetrics.add(ms);
|
|
|
+ });
|
|
|
}
|
|
|
- ms.setDataExp(ms.getMetricsCode());
|
|
|
- ms.setAlarmLow(d.getAlarmLow());
|
|
|
- ms.setAlarmMid(d.getAlarmMid());
|
|
|
- ms.setAlarmHigh(d.getAlarmHigh());
|
|
|
- objMetrics.add(ms);
|
|
|
}
|
|
|
});
|
|
|
if (objMetrics.size() > 0) {
|
|
@@ -710,43 +774,42 @@ public class BizObjMetricsServiceImpl implements IBizObjMetricsService {
|
|
|
* 更新指标
|
|
|
*
|
|
|
* @param objId 对象ID
|
|
|
- * @param tps 系统压力
|
|
|
- * @param openFiles 打开文件数量
|
|
|
- * @param heapUsage 堆内存使用率
|
|
|
- * @param gcCount gc次数
|
|
|
+ * @param agentVOList jvm信息
|
|
|
* @param pinpointVOList 链路列表数据
|
|
|
* @param date 时间
|
|
|
*/
|
|
|
- private void updateBizObjMetrics(Long objId, Float tps, int openFiles, float heapUsage, int gcCount, List<PinpointVO> pinpointVOList, Date date) {
|
|
|
+ private void updateBizObjMetrics(Long objId, List<AgentVO> agentVOList, List<
|
|
|
+ PinpointVO> pinpointVOList, Date date) {
|
|
|
//查询当前对象所有正在告警列表
|
|
|
Map<Long, AlarmRecord> recordMap = alarmRecordService.selectAlarmRecordListCurr(objId);
|
|
|
//查询当前对象未结束事件列表
|
|
|
Map<Long, HlEvent> eventMap = eventService.selectHlEventListCurr(objId);
|
|
|
- //TODO 暂时取消jvm相关指标
|
|
|
-// updateJvmMetrics(objId, tps, heapUsage, openFiles, gcCount, date, recordMap, eventMap);
|
|
|
+ updateJvmMetrics(objId, agentVOList, date, recordMap, eventMap);
|
|
|
updateLinkMetrics(objId, pinpointVOList, date, recordMap, eventMap);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 更新jvm指标
|
|
|
*
|
|
|
- * @param objId 对象ID
|
|
|
- * @param tps 系统压力
|
|
|
- * @param openFiles 打开文件数量
|
|
|
- * @param heapUsage 堆内存使用率
|
|
|
- * @param gcCount gc次数
|
|
|
- * @param date 数据时间
|
|
|
+ * @param objId 对象ID
|
|
|
+ * * @param agentVOList jvm信息
|
|
|
+ * @param date 数据时间
|
|
|
*/
|
|
|
- private void updateJvmMetrics(Long objId, Float tps, float heapUsage, int openFiles, int gcCount, Date date, Map<Long, AlarmRecord> recordMap, Map<Long, HlEvent> eventMap) {
|
|
|
+ private void updateJvmMetrics(Long objId, List<AgentVO> agentVOList, Date
|
|
|
+ date, Map<Long, AlarmRecord> recordMap, Map<Long, HlEvent> eventMap) {
|
|
|
BizObjMetrics jvmMetrics = new BizObjMetrics();
|
|
|
jvmMetrics.setObjId(objId);
|
|
|
-
|
|
|
jvmMetrics.setMetricsCode("pp.jvm.");
|
|
|
List<BizObjMetrics> omList = selectBizObjMetricsList(jvmMetrics);
|
|
|
- updateMetricsValues(omList, "tps", BigDecimal.valueOf(tps), date, recordMap, eventMap);
|
|
|
- updateMetricsValues(omList, "heap.usage", BigDecimal.valueOf(heapUsage), date, recordMap, eventMap);
|
|
|
- updateMetricsValues(omList, "open", BigDecimal.valueOf(openFiles), date, recordMap, eventMap);
|
|
|
- updateMetricsValues(omList, "gc", BigDecimal.valueOf(gcCount), date, recordMap, eventMap);
|
|
|
+ for (AgentVO vo : agentVOList) {
|
|
|
+ if (vo.getCode() == 100) {
|
|
|
+ updateMetricsValues(omList, "tps", vo.getAgentId(), BigDecimal.valueOf(vo.getTps()), date, recordMap, eventMap);
|
|
|
+ updateMetricsValues(omList, "heap.usage", vo.getAgentId(), BigDecimal.valueOf(vo.getHeapUsage()), date, recordMap, eventMap);
|
|
|
+ updateMetricsValues(omList, "open", vo.getAgentId(), BigDecimal.valueOf(vo.getOpenFiles()), date, recordMap, eventMap);
|
|
|
+ updateMetricsValues(omList, "gc", vo.getAgentId(), BigDecimal.valueOf(vo.getGcCount()), date, recordMap, eventMap);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -755,16 +818,18 @@ public class BizObjMetricsServiceImpl implements IBizObjMetricsService {
|
|
|
* @param omList jvm指标列表
|
|
|
* @param metricSuffix 指标后缀
|
|
|
* @param value 值
|
|
|
+ * @param agentId agentId
|
|
|
* @param date 数据时间
|
|
|
*/
|
|
|
- private void updateMetricsValues(List<BizObjMetrics> omList, String metricSuffix, BigDecimal value, Date date, Map<Long, AlarmRecord> recordMap, Map<Long, HlEvent> eventMap) {
|
|
|
+ private void updateMetricsValues(List<BizObjMetrics> omList, String metricSuffix, String agentId, BigDecimal value, Date
|
|
|
+ date, Map<Long, AlarmRecord> recordMap, Map<Long, HlEvent> eventMap) {
|
|
|
List<BizObjMetricsData> dataList = new ArrayList<>();
|
|
|
List<AlarmRecord> addRList = new ArrayList<>();
|
|
|
List<AlarmRecord> updateRList = new ArrayList<>();
|
|
|
List<HlEvent> addEList = new ArrayList<>();
|
|
|
List<HlEvent> updateEList = new ArrayList<>();
|
|
|
omList.stream()
|
|
|
- .filter(om -> om.getMetricsCode().endsWith(metricSuffix))
|
|
|
+ .filter(om -> om.getMetricsCode().endsWith(metricSuffix) && om.getMetricsName().startsWith(agentId + "/"))
|
|
|
.forEach(om -> {
|
|
|
om.setDValue(value);
|
|
|
updateBizObjMetrics(om);
|
|
@@ -794,7 +859,8 @@ public class BizObjMetricsServiceImpl implements IBizObjMetricsService {
|
|
|
batchUpdate(null, dataList, addRList, updateRList, addEList, updateEList);
|
|
|
}
|
|
|
|
|
|
- private void batchUpdate(List<BizObjMetrics> metricsToUpdate, List<BizObjMetricsData> dataList, List<AlarmRecord> addRList, List<AlarmRecord> updateRList, List<HlEvent> addEList, List<HlEvent> updateEList) {
|
|
|
+ private void batchUpdate
|
|
|
+ (List<BizObjMetrics> metricsToUpdate, List<BizObjMetricsData> dataList, List<AlarmRecord> addRList, List<AlarmRecord> updateRList, List<HlEvent> addEList, List<HlEvent> updateEList) {
|
|
|
// 更新所有需要更新的BizObjMetrics对象
|
|
|
try (SqlSession sqlSession = factory.openSession(ExecutorType.BATCH, false)) {
|
|
|
BizObjMetricsMapper mapper = sqlSession.getMapper(BizObjMetricsMapper.class);
|
|
@@ -830,7 +896,8 @@ public class BizObjMetricsServiceImpl implements IBizObjMetricsService {
|
|
|
* @param pinpointVOList 链路列表
|
|
|
* @param date 时间
|
|
|
*/
|
|
|
- private void updateLinkMetrics(Long objId, List<PinpointVO> pinpointVOList, Date date, Map<Long, AlarmRecord> recordMap, Map<Long, HlEvent> eventMap) {
|
|
|
+ private void updateLinkMetrics(Long objId, List<PinpointVO> pinpointVOList, Date
|
|
|
+ date, Map<Long, AlarmRecord> recordMap, Map<Long, HlEvent> eventMap) {
|
|
|
Map<String, List<BizObjMetrics>> metricsMap = getAllMetricsForObjId(objId);
|
|
|
pinpointVOList.forEach(vo -> updateMetricsValues(metricsMap, vo, date, recordMap, eventMap));
|
|
|
}
|
|
@@ -843,7 +910,8 @@ public class BizObjMetricsServiceImpl implements IBizObjMetricsService {
|
|
|
* @param vo pp链路对象
|
|
|
* @param date 时间
|
|
|
*/
|
|
|
- private void updateMetricsValues(Map<String, List<BizObjMetrics>> metricsMap, PinpointVO vo, Date date, Map<Long, AlarmRecord> recordMap, Map<Long, HlEvent> eventMap) {
|
|
|
+ private void updateMetricsValues(Map<String, List<BizObjMetrics>> metricsMap, PinpointVO vo, Date
|
|
|
+ date, Map<Long, AlarmRecord> recordMap, Map<Long, HlEvent> eventMap) {
|
|
|
List<BizObjMetricsData> dataList = new ArrayList<>();
|
|
|
List<AlarmRecord> addRList = new ArrayList<>();
|
|
|
List<AlarmRecord> updateRList = new ArrayList<>();
|
|
@@ -870,7 +938,7 @@ public class BizObjMetricsServiceImpl implements IBizObjMetricsService {
|
|
|
if (time1 == null) {
|
|
|
time1 = vo.getTime100ms();
|
|
|
}
|
|
|
- BigDecimal rate = BigDecimal.valueOf(time1).divide(BigDecimal.valueOf(vo.getTot()), 2, RoundingMode.HALF_UP);
|
|
|
+ BigDecimal rate = BigDecimal.valueOf(time1).divide(BigDecimal.valueOf(vo.getTot()), 4, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100));
|
|
|
updateMetric(om, "pp.rate", rate, date, dataList);
|
|
|
if (om.getDValue() != null) {
|
|
|
//处理告警
|
|
@@ -922,7 +990,8 @@ public class BizObjMetricsServiceImpl implements IBizObjMetricsService {
|
|
|
* @param value 值
|
|
|
* @param date 时间
|
|
|
*/
|
|
|
- private void updateMetric(BizObjMetrics om, String suffix, Number value, Date date, List<BizObjMetricsData> dataList) {
|
|
|
+ private void updateMetric(BizObjMetrics om, String suffix, Number value, Date
|
|
|
+ date, List<BizObjMetricsData> dataList) {
|
|
|
if (om.getMetricsCode().endsWith(suffix) && value != null) {
|
|
|
om.setDValue(BigDecimal.valueOf(value.doubleValue()));
|
|
|
updateBizObjMetrics(om);
|