diff --git a/logpusher/pom.xml b/logpusher/pom.xml index 1b46540..33dafb9 100644 --- a/logpusher/pom.xml +++ b/logpusher/pom.xml @@ -5,7 +5,7 @@ fiery-all com.weiboad.ragnar - 0.5.6.2-beta + 0.5.6.3-beta 4.0.0 diff --git a/pom.xml b/pom.xml index 8606696..19e9e55 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ 4.0.0 com.weiboad.ragnar fiery-all - 0.5.6.2-beta + 0.5.6.3-beta pom fiery diff --git a/server/pom.xml b/server/pom.xml index 579dc77..fcdc4f5 100644 --- a/server/pom.xml +++ b/server/pom.xml @@ -5,7 +5,7 @@ fiery-all com.weiboad.ragnar - 0.5.6.2-beta + 0.5.6.3-beta 4.0.0 diff --git a/server/src/main/java/org/weiboad/ragnar/server/processor/BizLogProcessor.java b/server/src/main/java/org/weiboad/ragnar/server/processor/BizLogProcessor.java index a8b7e60..63f8f3e 100644 --- a/server/src/main/java/org/weiboad/ragnar/server/processor/BizLogProcessor.java +++ b/server/src/main/java/org/weiboad/ragnar/server/processor/BizLogProcessor.java @@ -144,14 +144,16 @@ private void processData() { if (!msgObj.has("info")) { continue; } - JsonObject infoObj = msgObj.get("info").getAsJsonObject(); + if(msgObj.get("info").isJsonObject()) { + JsonObject infoObj = msgObj.get("info").getAsJsonObject(); - if (!infoObj.has("http_code")) { - continue; - } + if (!infoObj.has("http_code")) { + continue; + } - String code = infoObj.get("http_code").getAsString(); - logApi.addPerformMap(url, hourTime, costTime, code); + String code = infoObj.get("http_code").getAsString(); + logApi.addPerformMap(url, hourTime, costTime, code); + } } else if (bflog.equals("mysql")) { diff --git a/server/src/main/java/org/weiboad/ragnar/server/statistics/sql/SQLStatistic.java b/server/src/main/java/org/weiboad/ragnar/server/statistics/sql/SQLStatistic.java index 277ad22..ebb7fd1 100644 --- a/server/src/main/java/org/weiboad/ragnar/server/statistics/sql/SQLStatistic.java +++ b/server/src/main/java/org/weiboad/ragnar/server/statistics/sql/SQLStatistic.java @@ -67,14 +67,14 @@ public void addSqlMap(String sqlStr, Long hour, Double costTime) { } if (entry.getKey().getHash().hammingDistance(hash1) <= similityThreadHold) { - addHourMap(entry.getValue(), sqlStr, hour, costTime); + addHourMap(entry.getValue(), entry.getKey().getSql(), hour, costTime); issame = true; break; } } if (!issame) { Map hourMap = new HashMap(); - addHourMap(hourMap, sqlStrPure, hour, costTime); + addHourMap(hourMap, sqlStr, hour, costTime); SQLKey sqlKey = new SQLKey(); sqlKey.setHash(hash1); sqlKey.setPureSql(sqlStrPure); @@ -188,13 +188,21 @@ public Map> getOneData(Integer daytime, String sql) if (_sqlMap.size() == 0) { return null; } - if (_sqlMap.get(sql) == null) { + SQLKey sqlkey = null; + + log.info("search sql:"+sql); + for (Map.Entry> ent : _sqlMap.entrySet()) { + if(ent.getKey().getSql().equalsIgnoreCase(sql)){ + sqlkey = ent.getKey(); + } + } + if (sqlkey == null) { return null; } Long start = DateTimeHelper.getTimesMorning(DateTimeHelper.getBeforeDay(daytime)); Long end = start + 24 * 60 * 60 - 1; String sqlStr = ""; - for (Map.Entry hourmap : _sqlMap.get(sql).entrySet()) { + for (Map.Entry hourmap : _sqlMap.get(sqlkey).entrySet()) { if (hourmap.getKey() < start || hourmap.getKey() > end) { continue; } @@ -204,7 +212,7 @@ public Map> getOneData(Integer daytime, String sql) continue; } sqlStr = hourmap.getValue().sqlStr; - //performJson.put("sql",hourmap.getValue().sqlStr); + performJson.put("sql",hourmap.getValue().sqlStr); performJson.put("fasttime", getDoubleTime(hourmap.getValue().fastTime)); performJson.put("slowtime", getDoubleTime(hourmap.getValue().slowTime)); performJson.put("sumcount", sumcount.toString()); diff --git a/server/src/main/resources/templates/sqlstatistic.ftl b/server/src/main/resources/templates/sqlstatistic.ftl index 733029a..5487277 100644 --- a/server/src/main/resources/templates/sqlstatistic.ftl +++ b/server/src/main/resources/templates/sqlstatistic.ftl @@ -73,7 +73,7 @@ ${item.twenty} 查看 + href="sqlstatisticdetail?sql=${key?url}&daytime=${datelist_selected}">查看