diff options
| author | wangkuan <[email protected]> | 2020-09-21 10:02:12 +0800 |
|---|---|---|
| committer | wangkuan <[email protected]> | 2020-09-21 10:02:12 +0800 |
| commit | 4c2e32a03d9be0770a4d4f6460bc6ffb4485c634 (patch) | |
| tree | 9260f81fccd54eb29d29ac09dfb3f9dbdeb08252 | |
| parent | d068af9ebe059bb6df98f10d81dcc0fb0a3552a8 (diff) | |
promethus监控调整
| -rw-r--r-- | pom.xml | 4 | ||||
| -rw-r--r-- | src/main/java/com/mesa/reportservice/service/impl/ExcuteProcessServiceImpl.java | 21 |
2 files changed, 21 insertions, 4 deletions
@@ -10,7 +10,7 @@ </parent> <groupId>com.mesa</groupId> <artifactId>galaxy-report-service</artifactId> - <version>20.09.07-report</version> + <version>20.09.21-report</version> <name>galaxy-report-service</name> <description>Demo project for Spring Boot</description> @@ -219,7 +219,7 @@ <forceTags>true</forceTags> <imageTags> - <imageTag>20.09.07</imageTag> + <imageTag>20.09.21</imageTag> </imageTags> <!--远程docker构建,供dockerfile使用--> <dockerHost>http://192.168.40.153:2375</dockerHost> diff --git a/src/main/java/com/mesa/reportservice/service/impl/ExcuteProcessServiceImpl.java b/src/main/java/com/mesa/reportservice/service/impl/ExcuteProcessServiceImpl.java index 8d849e5..9c0fc67 100644 --- a/src/main/java/com/mesa/reportservice/service/impl/ExcuteProcessServiceImpl.java +++ b/src/main/java/com/mesa/reportservice/service/impl/ExcuteProcessServiceImpl.java @@ -29,6 +29,7 @@ public class ExcuteProcessServiceImpl implements ExcuteProcessService { private HbaseService hs; @Autowired private MonitorService mons; + @Override public void updateResultMessage(JobEntity je) { @@ -48,7 +49,6 @@ public class ExcuteProcessServiceImpl implements ExcuteProcessService { je.setExcuteDetail("SUCCESS"); je.setExcuteProcess(100); je.setStatus(2); - mons.addSuccess(); logger.info("success save to hbase resultid =" + je.getResultId() + " excutesql=" + je.getQuerySql()); } else { je.setStatus(5); @@ -104,6 +104,7 @@ public class ExcuteProcessServiceImpl implements ExcuteProcessService { logger.error("save database error queryid=" + je.getResultId() + e.toString()); } finally { + saveToMonitor(je); GlobelConfig.mapresult.remove(je.getQuery_id()); } @@ -146,7 +147,7 @@ public class ExcuteProcessServiceImpl implements ExcuteProcessService { Map map = JSON.parseObject(JSON.toJSONString(listdata.get(0))); long total_rows_approx = Long.parseLong(map.get("total_rows_approx").toString()); long read_rows = Long.parseLong(map.get("read_rows").toString()); - float elapsed = Float.parseFloat(map.get("elapsed").toString())*1000; + float elapsed = Float.parseFloat(map.get("elapsed").toString()) * 1000; double persent = (read_rows * 1.00 / total_rows_approx); int result = (int) (persent * 100); if (result > 98) { @@ -189,4 +190,20 @@ public class ExcuteProcessServiceImpl implements ExcuteProcessService { return isok; } + /** + * promethus记录结果 + */ + public void saveToMonitor(JobEntity entity) { + + try { + if (entity.getStatus() == 2) { + + mons.addSuccess(); + } else { + mons.addFail(); + } + } catch (Exception e) { + logger.error("监控结果失败" + e.toString()); + } + } } |
