Skip to content
This repository has been archived by the owner on Jun 10, 2022. It is now read-only.

Commit

Permalink
fixed sql detail 500 error
Browse files Browse the repository at this point in the history
fixed sql detail 500 error and upgrade to 0.5.6.2
  • Loading branch information
137-rick committed Feb 6, 2018
1 parent 6bae440 commit 2b8d845
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 15 deletions.
2 changes: 1 addition & 1 deletion logpusher/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>fiery-all</artifactId>
<groupId>com.weiboad.ragnar</groupId>
<version>0.5.6.2-beta</version>
<version>0.5.6.3-beta</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.weiboad.ragnar</groupId>
<artifactId>fiery-all</artifactId>
<version>0.5.6.2-beta</version>
<version>0.5.6.3-beta</version>
<packaging>pom</packaging>

<name>fiery</name>
Expand Down
2 changes: 1 addition & 1 deletion server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>fiery-all</artifactId>
<groupId>com.weiboad.ragnar</groupId>
<version>0.5.6.2-beta</version>
<version>0.5.6.3-beta</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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")) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<Long, SqlStatisticStruct> hourMap = new HashMap<Long, SqlStatisticStruct>();
addHourMap(hourMap, sqlStrPure, hour, costTime);
addHourMap(hourMap, sqlStr, hour, costTime);
SQLKey sqlKey = new SQLKey();
sqlKey.setHash(hash1);
sqlKey.setPureSql(sqlStrPure);
Expand Down Expand Up @@ -188,13 +188,21 @@ public Map<String, Map<String, String>> 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<SQLKey, Map<Long, SqlStatisticStruct>> 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<Long, SqlStatisticStruct> hourmap : _sqlMap.get(sql).entrySet()) {
for (Map.Entry<Long, SqlStatisticStruct> hourmap : _sqlMap.get(sqlkey).entrySet()) {
if (hourmap.getKey() < start || hourmap.getKey() > end) {
continue;
}
Expand All @@ -204,7 +212,7 @@ public Map<String, Map<String, String>> 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());
Expand Down
2 changes: 1 addition & 1 deletion server/src/main/resources/templates/sqlstatistic.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
<td>${item.twenty}</td>
<td>
<a type="button" class="btn btn-primary"
href='sqlstatisticdetail?sql=${key?url}&daytime=${datelist_selected}'>查看
href="sqlstatisticdetail?sql=${key?url}&daytime=${datelist_selected}">查看
</a>
</td>
</tr>
Expand Down

0 comments on commit 2b8d845

Please sign in to comment.