diff --git a/com.creditease.uav.agent.heartbeat/.gitignore b/com.creditease.uav.agent.heartbeat/.gitignore index 80a3a8ba..3eb663ab 100644 --- a/com.creditease.uav.agent.heartbeat/.gitignore +++ b/com.creditease.uav.agent.heartbeat/.gitignore @@ -2,3 +2,4 @@ /target /logs /metadata +/bin/ diff --git a/com.creditease.uav.agent/src/main/java/com/creditease/agent/feature/logagent/RuleFilterFactory.java b/com.creditease.uav.agent/src/main/java/com/creditease/agent/feature/logagent/RuleFilterFactory.java index 406403e2..927067d0 100644 --- a/com.creditease.uav.agent/src/main/java/com/creditease/agent/feature/logagent/RuleFilterFactory.java +++ b/com.creditease.uav.agent/src/main/java/com/creditease/agent/feature/logagent/RuleFilterFactory.java @@ -97,14 +97,14 @@ public LogFilterAndRuleBuilder newBuilder() { protected List getAidLogFilterAndRuleList(String id) { - id = id.replace('\\', '/'); + // id = id.replace('\\', '/'); return aidlogcollection.getIfPresent(id); } // this key should be absFilePath --- by hongqiang public LogFilterAndRule getLogFilterAndRule(String id) { - id = id.replace('\\', '/'); + // id = id.replace('\\', '/'); LogFilterAndRule lfar = null; lfar = logcollection.getIfPresent(id); @@ -275,9 +275,10 @@ public LogFilterAndRule build(String classname) { AppLogPatternInfoCollection profileMap = logAgent.getLatestLogProfileDataMap(); LogPatternInfo logPatternInfo = profileMap.get(serverid + "-" + appid, serverid + "-" + appid + "-" + logid); - logcollection.put(logPatternInfo.getAbsolutePath(), mainLogFAR); - if (aidLogFARlist != null) - aidlogcollection.put(logPatternInfo.getAbsolutePath(), aidLogFARlist); + pubLogFilterAndRule(logPatternInfo.getAbsolutePath(), mainLogFAR); + if (aidLogFARlist != null) { + pubAidLogFilterAndRule(logPatternInfo.getAbsolutePath(), aidLogFARlist); + } return mainLogFAR; } @@ -382,6 +383,14 @@ public void pubLogFilterAndRule(String id, LogFilterAndRule lfar) { logcollection.put(id, lfar); } + public void pubAidLogFilterAndRule(String id, List lfar) { + + // 保证路径不存在多余的'/'等 + id = new File(id).getAbsolutePath(); + + aidlogcollection.put(id, lfar); + } + public boolean hasLogFilterAndRule(String id) { LogFilterAndRule lfar = logcollection.getIfPresent(id); diff --git a/com.creditease.uav.base/src/main/java/com/creditease/agent/profile/api/StandardProfileModeler.java b/com.creditease.uav.base/src/main/java/com/creditease/agent/profile/api/StandardProfileModeler.java index 6c58fc4f..a86984db 100644 --- a/com.creditease.uav.base/src/main/java/com/creditease/agent/profile/api/StandardProfileModeler.java +++ b/com.creditease.uav.base/src/main/java/com/creditease/agent/profile/api/StandardProfileModeler.java @@ -849,7 +849,7 @@ private void getSpringMVCURLs(String springMVCBaseUrl, Map> // check if there is suffix, such as *.do if (allIndex != realSpringMVCBaseUrl.length() - 1) { - suffix = realSpringMVCBaseUrl.substring(allIndex + 1); + suffix = realSpringMVCBaseUrl.substring(allIndex + 1, realSpringMVCBaseUrl.length() - 1); } // get the real access path @@ -946,7 +946,9 @@ private void getSpringMVCURLs(String springMVCBaseUrl, Map> methodServiceURL = formatRelativePath(serviceURL + "/" + methodRelativePath); } else { - methodServiceURL = formatRelativePath(serviceURL + "/" + methodRelativePath + suffix); + // endwith "#" means the suffix is added from springMVCBaseUrl,should be removed while on query + methodServiceURL = formatRelativePath( + serviceURL + "/" + methodRelativePath + suffix + "#"); } compServicesURLs.add(methodServiceURL); diff --git a/com.creditease.uav.console/src/main/webapp/apphub/css/comp.tablist.css b/com.creditease.uav.console/src/main/webapp/apphub/css/comp.tablist.css index 1f7f3056..701ea0bf 100644 --- a/com.creditease.uav.console/src/main/webapp/apphub/css/comp.tablist.css +++ b/com.creditease.uav.console/src/main/webapp/apphub/css/comp.tablist.css @@ -37,4 +37,17 @@ !text-shadow: rgba(0,0,0,0.5) 0px 1px 1px; text-align:left; background:#f8f8f8; + height:25px; +} + +.GroupTag { + font-size: 12px; + color:#888; + display:inline-block; + background:#fff; + padding-left:5px; + padding-right:5px; + border:1px solid #a8a8a8; + border-radius:10px; + height:16px; } \ No newline at end of file diff --git a/com.creditease.uav.console/src/main/webapp/apphub/js/common/tablist.js b/com.creditease.uav.console/src/main/webapp/apphub/js/common/tablist.js index eb3d4e9a..6bda47a6 100644 --- a/com.creditease.uav.console/src/main/webapp/apphub/js/common/tablist.js +++ b/com.creditease.uav.console/src/main/webapp/apphub/js/common/tablist.js @@ -100,7 +100,7 @@ function AppHubTabList(_config) { if (groupObjs[groupId]==undefined) { var groupElemId=config["id"]+"-group-"+groupId; groupDiv=HtmlHelper.newElem("div",{"id":groupElemId,"class":"AppHubTabListGroup"}); - groupDiv.innerHTML="
"+groupId+"
"; + groupDiv.innerHTML="
"+groupId+"
"; groupObjs[groupId]={id:groupId, elem:function() { @@ -108,6 +108,8 @@ function AppHubTabList(_config) { },members:new Map(),elemTitle:function() { return HtmlHelper.id(groupElemId+"_title"); + },elemTag:function() { + return HtmlHelper.id(groupElemId+"_tag"); }}; mdiv.appendChild(groupDiv); @@ -160,7 +162,7 @@ function AppHubTabList(_config) { } } - //delete group withour any member + //delete group without any member for(var key in groupObjs) { var gpElemId=config.id+"-group-"+key; @@ -172,6 +174,20 @@ function AppHubTabList(_config) { delete groupObjs[key]; } } + + //show group tag + for(var key in groupObjs) { + + var gpElemId=config.id+"-group-"+key; + + var gpElem=HtmlHelper.id(gpElemId); + + var childNum=gpElem.children.length-1; + + var groupObj=groupObjs[key]; + + groupObj.elemTag().innerHTML=childNum; + } }; this.doGroupClick=function(groupId) { diff --git a/com.creditease.uav.console/src/main/webapp/uavapp_godeye/appmonitor/js/uav.appmonitor.js b/com.creditease.uav.console/src/main/webapp/uavapp_godeye/appmonitor/js/uav.appmonitor.js index 2501bf40..9af58407 100644 --- a/com.creditease.uav.console/src/main/webapp/uavapp_godeye/appmonitor/js/uav.appmonitor.js +++ b/com.creditease.uav.console/src/main/webapp/uavapp_godeye/appmonitor/js/uav.appmonitor.js @@ -4192,7 +4192,7 @@ var mvcObj={ * App Service URL 性能显示 */ sb.append("
"); - sb.append("
"+(i+1)+""+url+"
"); + sb.append("
"+(i+1)+""+url.replace("#","")+"
"); sb.append("
"); sb.append("QPM-  " + "全程平均响应(ms)-  " + @@ -4240,6 +4240,21 @@ var mvcObj={ */ monitorCfg.url.ip=sObj.ip; monitorCfg.url.svrid=sObj.svrid; + + //url以"#"结尾意味着需要去除后缀, + for(var i=0;i lastSeparatorIndex){ + sObj.urls[i] = sObj.urls[i].substring(0,suffixIndex); + } + } monitorCfg.url.urls=sObj.urls; /** * Step 2: refresh service url @@ -4265,6 +4280,21 @@ var mvcObj={ var urlMO=urlMOs[key]; + //正常情况下返回结果的key应该在appURLQPSCfg.seriesMap,若不在说明做了后缀的截取,需要恢复 + if(!(key in appURLQPSCfg.seriesMap)){ + for(var seriesMapKey in appURLQPSCfg.seriesMap){ + //按照去除后缀的逻辑把seriesMapKey里的后缀去掉,若与当前key相同说明是同一个url + var lastSeparatorIndex = seriesMapKey.lastIndexOf("/"); + var suffixIndex = seriesMapKey.lastIndexOf("."); + if(suffixIndex > lastSeparatorIndex && key == seriesMapKey.substring(0,suffixIndex)){ + //将key替换成含有后缀的形式,保证数据可以正确设置 + key = seriesMapKey; + //将urlMO["id"]替换成含有后缀形式,保证数据可以正常显示 + urlMO["id"]=key; + break; + } + } + } var tps = urlMO["tps"]; var tavg = urlMO["tavg"]; var err = urlMO["err"]; @@ -4718,7 +4748,7 @@ var mvcObj={ for(var i=0;i"+cptservice[i]+"
"); + sb.append("
"+cptservice[i].replace("#","")+"
"); } diff --git a/com.creditease.uav.healthmanager/src/main/java/com/creditease/uav/feature/runtimenotify/scheduler/NodeInfoWatcher.java b/com.creditease.uav.healthmanager/src/main/java/com/creditease/uav/feature/runtimenotify/scheduler/NodeInfoWatcher.java index 9e59f8bd..e3937154 100644 --- a/com.creditease.uav.healthmanager/src/main/java/com/creditease/uav/feature/runtimenotify/scheduler/NodeInfoWatcher.java +++ b/com.creditease.uav.healthmanager/src/main/java/com/creditease/uav/feature/runtimenotify/scheduler/NodeInfoWatcher.java @@ -346,13 +346,14 @@ private void judgeProcCrash() { String[] procKeyBakArray = procKeyBak.split("_", -1); String ipBak = procKeyBakArray[0]; String nameBak = procKeyBakArray[1]; - List portsBak = new ArrayList(Arrays.asList(procKeyBakArray[2].split(":"))); if (procKeyBakArray[2].equals("") || !(ipBak + nameBak).equals(ip + name) || procKeyBak.equals(procKey) || delKeys.contains(procKeyBak)) { continue; } + List portsBak = new ArrayList(Arrays.asList(procKeyBakArray[2].split(":"))); + for (String port : ports) { if (portsBak.contains(port)) { if (time >= timeBak) { @@ -579,7 +580,7 @@ private Map buildMDF(String node) { /** * 拼接判断进程死亡所用的key * - * 1.存在固定端口进程 ip_name_port:port:__ + * 1.存在固定端口进程 ip_name_port#port#__ * * 2.不存在固定端口的非java进程 ip_name___ * @@ -643,7 +644,7 @@ private void putDiskInfo(Map infoMap) { Map dv = (Map) disk.get(dk); for (String dvk : dv.keySet()) { String dvv = dv.get(dvk).toString(); - if ("useRate".equals(dvk)||"useRateInode".equals(dvk)) { + if ("useRate".equals(dvk) || "useRateInode".equals(dvk)) { dvv = dvv.replace("%", ""); // cut '%' } infoMap.put("os.io.disk" + pk + dvk, dvv); diff --git a/com.creditease.uav.hook.redis/pom.xml b/com.creditease.uav.hook.redis/pom.xml index a82f4d9a..6f1a6108 100644 --- a/com.creditease.uav.hook.redis/pom.xml +++ b/com.creditease.uav.hook.redis/pom.xml @@ -14,7 +14,7 @@ com.creditease.moniter - com.creditease.uav.base + com.creditease.uav.monitorframework diff --git a/com.creditease.uav.monitorframework/src/main/java/com/creditease/uav/appserver/listeners/AppFrkHookFactoryListener.java b/com.creditease.uav.monitorframework/src/main/java/com/creditease/uav/appserver/listeners/AppFrkHookFactoryListener.java index 44137ec2..5e098377 100644 --- a/com.creditease.uav.monitorframework/src/main/java/com/creditease/uav/appserver/listeners/AppFrkHookFactoryListener.java +++ b/com.creditease.uav.monitorframework/src/main/java/com/creditease/uav/appserver/listeners/AppFrkHookFactoryListener.java @@ -76,11 +76,13 @@ public void handleEvent(InterceptContext context) { } } + @SuppressWarnings("unchecked") private void initHookFactory() { String config = System.getProperty("com.creditease.uav.hookfactory.config"); - hookConfig = JSONHelper.toObjectArray(config, Map.class); + // make an ordered JSONObject cause by "adapts" must be ordered on injecting + hookConfig = JSONHelper.toObject(config, List.class, true); String hookFactoryClassStr = System .getProperty("com.creditease.uav." + vendor.toString().toLowerCase() + ".hookfactory"); diff --git a/com.creditease.uav.monitorframework/src/main/java/com/creditease/uav/profiling/spi/ProfileServiceMapMgr.java b/com.creditease.uav.monitorframework/src/main/java/com/creditease/uav/profiling/spi/ProfileServiceMapMgr.java index 84932355..39b62012 100644 --- a/com.creditease.uav.monitorframework/src/main/java/com/creditease/uav/profiling/spi/ProfileServiceMapMgr.java +++ b/com.creditease.uav.monitorframework/src/main/java/com/creditease/uav/profiling/spi/ProfileServiceMapMgr.java @@ -100,7 +100,18 @@ public boolean match(String targetUrl) { } /** - * Step 3: if the targetUrl possible has path param, need check if the path param count match + * Step 3: if there is a suffix such as xxx.do,remove the suffix and try to match again + */ + int suffixIndex = targetUrl.lastIndexOf("."); + if (suffixIndex > -1) { + String targetUrlWithoutSuffix = targetUrl.substring(0, suffixIndex); + if (targetUrlWithoutSuffix.endsWith(this.pathPattern) == true) { + return true; + } + } + + /** + * Step 4: if the targetUrl possible has path param, need check if the path param count match */ String pathParamStr = targetUrl.substring(index + this.pathPattern.length()); @@ -111,7 +122,7 @@ public boolean match(String targetUrl) { } /** - * Step 4: check if allow abMatch,if yes, as part, then return true, mostly for servlet or filter + * Step 5: check if allow abMatch,if yes, as part, then return true, mostly for servlet or filter */ if (this.allowAbMatch == true) { return true; diff --git a/com.creditease.uav.monitorframework/src/main/java/com/creditease/uav/util/MonitorServerUtil.java b/com.creditease.uav.monitorframework/src/main/java/com/creditease/uav/util/MonitorServerUtil.java index d5fbcc99..311837e6 100644 --- a/com.creditease.uav.monitorframework/src/main/java/com/creditease/uav/util/MonitorServerUtil.java +++ b/com.creditease.uav.monitorframework/src/main/java/com/creditease/uav/util/MonitorServerUtil.java @@ -336,9 +336,20 @@ public static String getApplicationId(String contextroot, String basePath) { appid = contextroot; } + // 去除最开始的"/" if (appid.indexOf("/") == 0) { appid = appid.substring(1); } + /** + * tomcat等容器在配置了多层虚拟路径以后,appid会存在特殊字符"/",如: + * 由于存在使用appid创建文件的情况,此处统一将特殊字符进行转义 + */ + if (appid.indexOf("/") > -1) { + appid = appid.replace("/", "--"); + } + if (appid.indexOf("\\") > -1) { + appid = appid.replace("\\", "--"); + } return appid; }