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/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.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; } diff --git a/com.creditease.uav.threadanalysis/src/main/java/com/creditease/uav/threadanalysis/http/ThreadAnalysisQueryHandler.java b/com.creditease.uav.threadanalysis/src/main/java/com/creditease/uav/threadanalysis/http/ThreadAnalysisQueryHandler.java index 92e334a1..cbe20d81 100644 --- a/com.creditease.uav.threadanalysis/src/main/java/com/creditease/uav/threadanalysis/http/ThreadAnalysisQueryHandler.java +++ b/com.creditease.uav.threadanalysis/src/main/java/com/creditease/uav/threadanalysis/http/ThreadAnalysisQueryHandler.java @@ -163,9 +163,10 @@ private void queryDistinct(UAVHttpMessage data) { try { String ipport = data.getRequest("ipport"); - AggregationBuilder agg = AggregationBuilders.terms("unique_time").field("time") + // TODO ES aggregation 默认最多查10条, 这里暂时改到1000,待refine + AggregationBuilder agg = AggregationBuilders.terms("unique_time").field("time").size(1000) .order(Terms.Order.term(false)) - .subAggregation(AggregationBuilders.terms("unique_user").field("user")); + .subAggregation(AggregationBuilders.terms("unique_user").field("user").size(1000)); String date = data.getRequest("indexdate"); String currentIndex;