WANG 5 年之前
父节点
当前提交
e8f65d8c03

+ 8 - 1
src/main/java/cn/com/qmth/examcloud/web/support/ExamCloudController.java

@@ -2,6 +2,7 @@ package cn.com.qmth.examcloud.web.support;
 
 import java.util.Collections;
 
+import org.apache.commons.lang3.RandomUtils;
 import org.springframework.http.HttpEntity;
 import org.springframework.http.HttpHeaders;
 import org.springframework.http.HttpMethod;
@@ -9,6 +10,7 @@ import org.springframework.http.HttpStatus;
 import org.springframework.http.ResponseEntity;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
 import cn.com.qmth.examcloud.commons.logging.ExamCloudLog;
@@ -29,7 +31,12 @@ public class ExamCloudController {
 
 	@Naked
 	@RequestMapping(value = {"/", ""}, method = RequestMethod.GET)
-	public String get() {
+	public String get(@RequestParam(required = false) Boolean bug) {
+		if (bug) {
+			if (RandomUtils.nextBoolean()) {
+				throw new RuntimeException("Ha Ha Ha ... ...");
+			}
+		}
 		return DateUtil.chinaNow();
 	}
 

+ 52 - 43
src/main/resources/api-status.html

@@ -4,8 +4,17 @@
 <meta charset="UTF-8">
 <title>API status</title>
 <style type="text/css">
-.data {
-	padding: 2px 10px 2px 10px;
+table {
+	border: 1px solid #D0D0D0;
+}
+
+th {
+	cursor: pointer;
+	padding: 2px 2px 2px 2px;
+}
+
+td {
+	padding: 2px 5px 2px 5px;
 }
 </style>
 <script type="text/javascript">
@@ -15,59 +24,59 @@
 </script>
 </head>
 <body>
-	<table style="border: 1px solid #D0D0D0;" border="1" cellspacing="0" align="center">
+	<table border="1" cellspacing="0" align="center">
 		<caption>date: ${dateTime?string('yyyy-MM-dd HH:mm:ss')}</caption>
 		<tr style="background-color: #E0E0E0;">
-			<th rowspan="2" onclick="order('mapping')" style="cursor: pointer;">mapping</th>
-			<th rowspan="2" onclick="order('description')" style="cursor: pointer;">description</th>
-			<th rowspan="2" onclick="order('count')" style="cursor: pointer;">total</th>
+			<th rowspan="2" onclick="order('mapping')">mapping</th>
+			<th rowspan="2" onclick="order('description')">description</th>
+			<th rowspan="2" onclick="order('count')">total</th>
 			<th colspan="4">rate (calls/s)</th>
 			<th colspan="3">cost (ms)</th>
 			<th colspan="5">Line (<= ms)</th>
-			<th rowspan="2" onclick="order('exceptionCount')" style="cursor: pointer;">error</th>
+			<th rowspan="2" onclick="order('exceptionCount')">error</th>
 			<th colspan="5">error percent (%)</th>
 		</tr>
 		<tr style="background-color: #E0E0E0;">
-			<th onclick="order('meanRate')" style="cursor: pointer;">mean</th>
-			<th onclick="order('oneMinuteRate')" style="cursor: pointer;">1-min</th>
-			<th onclick="order('fiveMinuteRate')" style="cursor: pointer;">5-min</th>
-			<th onclick="order('fifteenMinuteRate')" style="cursor: pointer;">15-min</th>
-			<th onclick="order('min')" style="cursor: pointer;">min</th>
-			<th onclick="order('max')" style="cursor: pointer;">max</th>
-			<th onclick="order('mean')" style="cursor: pointer;">mean</th>
-			<th onclick="order('p50')" style="cursor: pointer;">50%</th>
-			<th onclick="order('p75')" style="cursor: pointer;">75%</th>
-			<th onclick="order('p95')" style="cursor: pointer;">95%</th>
-			<th onclick="order('p98')" style="cursor: pointer;">98%</th>
-			<th onclick="order('p99')" style="cursor: pointer;">99%</th>
-			<th onclick="order('exceptionMeanPercent')" style="cursor: pointer;">mean</th>
-			<th onclick="order('exceptionOneMinutePercent')" style="cursor: pointer;">1-min</th>
-			<th onclick="order('exceptionFiveMinutePercent')" style="cursor: pointer;">5-min</th>
-			<th onclick="order('exceptionFifteenMinutePercent')" style="cursor: pointer;">15-min</th>
+			<th onclick="order('meanRate')">mean</th>
+			<th onclick="order('oneMinuteRate')">1-min</th>
+			<th onclick="order('fiveMinuteRate')">5-min</th>
+			<th onclick="order('fifteenMinuteRate')">15-min</th>
+			<th onclick="order('min')">min</th>
+			<th onclick="order('max')">max</th>
+			<th onclick="order('mean')">mean</th>
+			<th onclick="order('p50')">50%</th>
+			<th onclick="order('p75')">75%</th>
+			<th onclick="order('p95')">95%</th>
+			<th onclick="order('p98')">98%</th>
+			<th onclick="order('p99')">99%</th>
+			<th onclick="order('exceptionMeanPercent')">mean</th>
+			<th onclick="order('exceptionOneMinutePercent')">1-min</th>
+			<th onclick="order('exceptionFiveMinutePercent')">5-min</th>
+			<th onclick="order('exceptionFifteenMinutePercent')">15-min</th>
 		</tr>
 		<#list data as cur>
 		<tr style="color: #009999;">
-			<td class="data">${cur.mapping?replace("][","]<br>[","f")}
+			<td>${cur.mapping?replace("][","]<br>[","f")}
 			</td>
-			<td class="data">${cur.description!}</td>
-			<td class="data">${cur.count?c}</td>
-			<td class="data">${cur.meanRate?string("#.##")}</td>
-			<td class="data">${cur.oneMinuteRate?string("#.##")}</td>
-			<td class="data">${cur.fiveMinuteRate?string("#.##")}</td>
-			<td class="data">${cur.fifteenMinuteRate?string("#.##")}</td>
-			<td class="data">${cur.min?string("#.##")}</td>
-			<td class="data">${cur.max?string("#.##")}</td>
-			<td class="data">${cur.mean?string("#.##")}</td>
-			<td class="data">${cur.p50?string("#.##")}</td>
-			<td class="data">${cur.p75?string("#.##")}</td>
-			<td class="data">${cur.p95?string("#.##")}</td>
-			<td class="data">${cur.p98?string("#.##")}</td>
-			<td class="data">${cur.p99?string("#.##")}</td>
-			<td class="data">${cur.exceptionCount?c}</td>
-			<td class="data">${cur.exceptionMeanPercent?string.percent}</td>
-			<td class="data">${cur.exceptionOneMinutePercent?string.percent}</td>
-			<td class="data">${cur.exceptionFiveMinutePercent?string.percent}</td>
-			<td class="data">${cur.exceptionFifteenMinutePercent?string.percent}</td>
+			<td>${cur.description!}</td>
+			<td>${cur.count?c}</td>
+			<td>${cur.meanRate?string("#.##")}</td>
+			<td>${cur.oneMinuteRate?string("#.##")}</td>
+			<td>${cur.fiveMinuteRate?string("#.##")}</td>
+			<td>${cur.fifteenMinuteRate?string("#.##")}</td>
+			<td>${cur.min?string("#.##")}</td>
+			<td>${cur.max?string("#.##")}</td>
+			<td>${cur.mean?string("#.##")}</td>
+			<td>${cur.p50?string("#.##")}</td>
+			<td>${cur.p75?string("#.##")}</td>
+			<td>${cur.p95?string("#.##")}</td>
+			<td>${cur.p98?string("#.##")}</td>
+			<td>${cur.p99?string("#.##")}</td>
+			<td>${cur.exceptionCount?c}</td>
+			<td>${cur.exceptionMeanPercent?string.percent}</td>
+			<td>${cur.exceptionOneMinutePercent?string.percent}</td>
+			<td>${cur.exceptionFiveMinutePercent?string.percent}</td>
+			<td>${cur.exceptionFifteenMinutePercent?string.percent}</td>
 		</tr>
 		</#list>
 	</table>