diff --git a/sentinel-adapter/sentinel-grpc-adapter/src/test/java/com/alibaba/csp/sentinel/adapter/grpc/SentinelGrpcClientInterceptorTest.java b/sentinel-adapter/sentinel-grpc-adapter/src/test/java/com/alibaba/csp/sentinel/adapter/grpc/SentinelGrpcClientInterceptorTest.java index 61fa180e63..7c6972e6cc 100755 --- a/sentinel-adapter/sentinel-grpc-adapter/src/test/java/com/alibaba/csp/sentinel/adapter/grpc/SentinelGrpcClientInterceptorTest.java +++ b/sentinel-adapter/sentinel-grpc-adapter/src/test/java/com/alibaba/csp/sentinel/adapter/grpc/SentinelGrpcClientInterceptorTest.java @@ -66,14 +66,14 @@ public void testGrpcClientInterceptor() throws Exception { ClusterNode clusterNode = ClusterBuilderSlot.getClusterNode(resourceName, EntryType.OUT); assertNotNull(clusterNode); - assertEquals((total - threshold) / 2, clusterNode.blockedRequest()); + assertEquals((total - threshold) / 2, clusterNode.blockRequest()); assertEquals(total / 2, clusterNode.totalRequest()); long totalQps = clusterNode.totalQps(); long passQps = clusterNode.passQps(); - long blockedQps = clusterNode.blockedQps(); + long blockQps = clusterNode.blockQps(); assertEquals(total, totalQps); - assertEquals(total - threshold, blockedQps); + assertEquals(total - threshold, blockQps); assertEquals(threshold, passQps); server.stop(); diff --git a/sentinel-adapter/sentinel-grpc-adapter/src/test/java/com/alibaba/csp/sentinel/adapter/grpc/SentinelGrpcServerInterceptorTest.java b/sentinel-adapter/sentinel-grpc-adapter/src/test/java/com/alibaba/csp/sentinel/adapter/grpc/SentinelGrpcServerInterceptorTest.java index d924742ca7..432a62818d 100755 --- a/sentinel-adapter/sentinel-grpc-adapter/src/test/java/com/alibaba/csp/sentinel/adapter/grpc/SentinelGrpcServerInterceptorTest.java +++ b/sentinel-adapter/sentinel-grpc-adapter/src/test/java/com/alibaba/csp/sentinel/adapter/grpc/SentinelGrpcServerInterceptorTest.java @@ -68,14 +68,14 @@ public void testGrpcServerInterceptor() throws Exception { ClusterNode clusterNode = ClusterBuilderSlot.getClusterNode(resourceName, EntryType.IN); assertNotNull(clusterNode); - assertEquals((total - threshold) / 2, clusterNode.blockedRequest()); + assertEquals((total - threshold) / 2, clusterNode.blockRequest()); assertEquals(total / 2, clusterNode.totalRequest()); long totalQps = clusterNode.totalQps(); long passQps = clusterNode.passQps(); - long blockedQps = clusterNode.blockedQps(); + long blockQps = clusterNode.blockQps(); assertEquals(total, totalQps); - assertEquals(total - threshold, blockedQps); + assertEquals(total - threshold, blockQps); assertEquals(threshold, passQps); server.stop(); diff --git a/sentinel-core/src/main/java/com/alibaba/csp/sentinel/context/Context.java b/sentinel-core/src/main/java/com/alibaba/csp/sentinel/context/Context.java index cd04899ad3..0e857b7269 100755 --- a/sentinel-core/src/main/java/com/alibaba/csp/sentinel/context/Context.java +++ b/sentinel-core/src/main/java/com/alibaba/csp/sentinel/context/Context.java @@ -139,15 +139,15 @@ public double getOriginTotalQps() { return getOriginNode() == null ? 0 : getOriginNode().totalQps(); } - public double getOriginBlockedQps() { - return getOriginNode() == null ? 0 : getOriginNode().blockedQps(); + public double getOriginBlockQps() { + return getOriginNode() == null ? 0 : getOriginNode().blockQps(); } - public double getOriginPassedReqQps() { + public double getOriginPassReqQps() { return getOriginNode() == null ? 0 : getOriginNode().successQps(); } - public double getOriginPassedQps() { + public double getOriginPassQps() { return getOriginNode() == null ? 0 : getOriginNode().passQps(); } @@ -155,8 +155,8 @@ public long getOriginTotalRequest() { return getOriginNode() == null ? 0 : getOriginNode().totalRequest(); } - public long getOriginBlockedRequest() { - return getOriginNode() == null ? 0 : getOriginNode().blockedRequest(); + public long getOriginBlockRequest() { + return getOriginNode() == null ? 0 : getOriginNode().blockRequest(); } public double getOriginAvgRt() { diff --git a/sentinel-core/src/main/java/com/alibaba/csp/sentinel/node/DefaultNode.java b/sentinel-core/src/main/java/com/alibaba/csp/sentinel/node/DefaultNode.java index 46383580d2..521c7e60a0 100755 --- a/sentinel-core/src/main/java/com/alibaba/csp/sentinel/node/DefaultNode.java +++ b/sentinel-core/src/main/java/com/alibaba/csp/sentinel/node/DefaultNode.java @@ -88,9 +88,9 @@ public Set getChildList() { } @Override - public void increaseBlockedQps() { - super.increaseBlockedQps(); - this.clusterNode.increaseBlockedQps(); + public void increaseBlockQps() { + super.increaseBlockQps(); + this.clusterNode.increaseBlockQps(); } @Override @@ -134,13 +134,13 @@ private void visitTree(int level, DefaultNode node) { if (!(node instanceof EntranceNode)) { System.out.println( String.format("%s(thread:%s pq:%s bq:%s tq:%s rt:%s 1mp:%s 1mb:%s 1mt:%s)", node.id.getShowName(), - node.curThreadNum(), node.passQps(), node.blockedQps(), node.totalQps(), node.avgRt(), - node.totalRequest() - node.blockedRequest(), node.blockedRequest(), node.totalRequest())); + node.curThreadNum(), node.passQps(), node.blockQps(), node.totalQps(), node.avgRt(), + node.totalRequest() - node.blockRequest(), node.blockRequest(), node.totalRequest())); } else { System.out.println( String.format("Entry-%s(t:%s pq:%s bq:%s tq:%s rt:%s 1mp:%s 1mb:%s 1mt:%s)", node.id.getShowName(), - node.curThreadNum(), node.passQps(), node.blockedQps(), node.totalQps(), node.avgRt(), - node.totalRequest() - node.blockedRequest(), node.blockedRequest(), node.totalRequest())); + node.curThreadNum(), node.passQps(), node.blockQps(), node.totalQps(), node.avgRt(), + node.totalRequest() - node.blockRequest(), node.blockRequest(), node.totalRequest())); } for (Node n : node.getChildList()) { DefaultNode dn = (DefaultNode)n; diff --git a/sentinel-core/src/main/java/com/alibaba/csp/sentinel/node/EntranceNode.java b/sentinel-core/src/main/java/com/alibaba/csp/sentinel/node/EntranceNode.java index cf94b1974c..e379daf424 100755 --- a/sentinel-core/src/main/java/com/alibaba/csp/sentinel/node/EntranceNode.java +++ b/sentinel-core/src/main/java/com/alibaba/csp/sentinel/node/EntranceNode.java @@ -54,19 +54,19 @@ public long avgRt() { } @Override - public long blockedQps() { + public long blockQps() { int blockQps = 0; for (Node node : getChildList()) { - blockQps += node.blockedQps(); + blockQps += node.blockQps(); } return blockQps; } @Override - public long blockedRequest() { + public long blockRequest() { long r = 0; for (Node node : getChildList()) { - r += node.blockedRequest(); + r += node.blockRequest(); } return r; } diff --git a/sentinel-core/src/main/java/com/alibaba/csp/sentinel/node/Node.java b/sentinel-core/src/main/java/com/alibaba/csp/sentinel/node/Node.java index ecd7b0188c..ff82a41c2c 100755 --- a/sentinel-core/src/main/java/com/alibaba/csp/sentinel/node/Node.java +++ b/sentinel-core/src/main/java/com/alibaba/csp/sentinel/node/Node.java @@ -29,7 +29,7 @@ public interface Node { /** - * Get incoming request per minute. {@code pass + blocked} + * Get incoming request per minute. {@code pass + block} */ long totalRequest(); @@ -41,9 +41,9 @@ public interface Node { long totalSuccess(); /** - * Get blocked request count per minute. + * Get block request count per minute. */ - long blockedRequest(); + long blockRequest(); /** * Get exception count per minute. @@ -56,12 +56,12 @@ public interface Node { long passQps(); /** - * Get blocked request per second. + * Get block request per second. */ - long blockedQps(); + long blockQps(); /** - * Get {@link #passQps()} + {@link #blockedQps()} request per second. + * Get {@link #passQps()} + {@link #blockQps()} request per second. */ long totalQps(); @@ -90,7 +90,7 @@ public interface Node { int curThreadNum(); /** - * Get last second blocked QPS. + * Get last second block QPS. */ long previousBlockQps(); @@ -110,7 +110,7 @@ public interface Node { */ void rt(long rt); - void increaseBlockedQps(); + void increaseBlockQps(); void increaseExceptionQps(); diff --git a/sentinel-core/src/main/java/com/alibaba/csp/sentinel/node/StatisticNode.java b/sentinel-core/src/main/java/com/alibaba/csp/sentinel/node/StatisticNode.java index 4158262b91..3c504bb60a 100755 --- a/sentinel-core/src/main/java/com/alibaba/csp/sentinel/node/StatisticNode.java +++ b/sentinel-core/src/main/java/com/alibaba/csp/sentinel/node/StatisticNode.java @@ -53,10 +53,10 @@ public Map metrics() { long newLastFetchTime = lastFetchTime; for (MetricNode node : nodesOfEverySecond) { if (node.getTimestamp() > lastFetchTime && node.getTimestamp() < currentTime) { - if (node.getPassedQps() != 0 - || node.getBlockedQps() != 0 + if (node.getPassQps() != 0 + || node.getBlockQps() != 0 || node.getSuccessQps() != 0 - || node.getException() != 0 + || node.getExceptionQps() != 0 || node.getRt() != 0) { metrics.put(node.getTimestamp(), node); newLastFetchTime = Math.max(newLastFetchTime, node.getTimestamp()); @@ -80,12 +80,12 @@ public long totalRequest() { } @Override - public long blockedRequest() { + public long blockRequest() { return rollingCounterInMinute.block() / 2; } @Override - public long blockedQps() { + public long blockQps() { return rollingCounterInSecond.block() / IntervalProperty.INTERVAL; } @@ -101,7 +101,7 @@ public long previousPassQps() { @Override public long totalQps() { - return passQps() + blockedQps(); + return passQps() + blockQps(); } @Override @@ -170,7 +170,7 @@ public void rt(long rt) { } @Override - public void increaseBlockedQps() { + public void increaseBlockQps() { rollingCounterInSecond.addBlock(); rollingCounterInMinute.addBlock(); } diff --git a/sentinel-core/src/main/java/com/alibaba/csp/sentinel/node/metric/MetricNode.java b/sentinel-core/src/main/java/com/alibaba/csp/sentinel/node/metric/MetricNode.java index ef0171e943..682debf1f4 100755 --- a/sentinel-core/src/main/java/com/alibaba/csp/sentinel/node/metric/MetricNode.java +++ b/sentinel-core/src/main/java/com/alibaba/csp/sentinel/node/metric/MetricNode.java @@ -22,10 +22,10 @@ public class MetricNode { private long timestamp; - private long passedQps; - private long blockedQps; + private long passQps; + private long blockQps; private long successQps; - private long exception; + private long exceptionQps; private long rt; private String resource; @@ -46,28 +46,28 @@ public void setSuccessQps(long successQps) { this.successQps = successQps; } - public long getPassedQps() { - return passedQps; + public long getPassQps() { + return passQps; } - public void setPassedQps(long passedQps) { - this.passedQps = passedQps; + public void setPassQps(long passQps) { + this.passQps = passQps; } - public long getException() { - return exception; + public long getExceptionQps() { + return exceptionQps; } - public void setException(long exception) { - this.exception = exception; + public void setExceptionQps(long exceptionQps) { + this.exceptionQps = exceptionQps; } - public long getBlockedQps() { - return blockedQps; + public long getBlockQps() { + return blockQps; } - public void setBlockedQps(long blockedQps) { - this.blockedQps = blockedQps; + public void setBlockQps(long blockQps) { + this.blockQps = blockQps; } public long getRt() { @@ -90,10 +90,10 @@ public void setResource(String resource) { public String toString() { return "MetricNode{" + "timestamp=" + timestamp + - ", passedQps=" + passedQps + - ", blockedQs=" + blockedQps + + ", passQps=" + passQps + + ", blockQps=" + blockQps + ", successQps=" + successQps + - ", exception=" + exception + + ", exceptionQps=" + exceptionQps + ", rt=" + rt + ", resource='" + resource + '\'' + '}'; @@ -103,7 +103,7 @@ public String toString() { * To formatting string. All "|" in {@link #resource} will be replaced with "_", format is: *
* - * timestamp|resource|passedQps|blockedQps|successQps|exception|rt + * timestamp|resource|passQps|blockQps|successQps|exceptionQps|rt * * * @return string format of this. @@ -113,10 +113,10 @@ public String toThinString() { sb.append(timestamp).append("|"); String legalName = resource.replaceAll("\\|", "_"); sb.append(legalName).append("|"); - sb.append(passedQps).append("|"); - sb.append(blockedQps).append("|"); + sb.append(passQps).append("|"); + sb.append(blockQps).append("|"); sb.append(successQps).append("|"); - sb.append(exception).append("|"); + sb.append(exceptionQps).append("|"); sb.append(rt); return sb.toString(); } @@ -132,10 +132,10 @@ public static MetricNode fromThinString(String line) { String[] strs = line.split("\\|"); node.setTimestamp(Long.parseLong(strs[0])); node.setResource(strs[1]); - node.setPassedQps(Long.parseLong(strs[2])); - node.setBlockedQps(Long.parseLong(strs[3])); + node.setPassQps(Long.parseLong(strs[2])); + node.setBlockQps(Long.parseLong(strs[3])); node.setSuccessQps(Long.parseLong(strs[4])); - node.setException(Long.parseLong(strs[5])); + node.setExceptionQps(Long.parseLong(strs[5])); node.setRt(Long.parseLong(strs[6])); return node; } @@ -144,7 +144,7 @@ public static MetricNode fromThinString(String line) { * To formatting string. All "|" in {@link MetricNode#resource} will be replaced with "_", format is: *
* - * timestamp|yyyy-MM-dd HH:mm:ss|resource|passedQps|blockedQps|successQps|exception|rt\n + * timestamp|yyyy-MM-dd HH:mm:ss|resource|passQps|blockQps|successQps|exceptionQps|rt\n * * * @return string format of this. @@ -157,10 +157,10 @@ public String toFatString() { sb.append(df.format(new Date(getTimestamp()))).append("|"); String legalName = getResource().replaceAll("\\|", "_"); sb.append(legalName).append("|"); - sb.append(getPassedQps()).append("|"); - sb.append(getBlockedQps()).append("|"); + sb.append(getPassQps()).append("|"); + sb.append(getBlockQps()).append("|"); sb.append(getSuccessQps()).append("|"); - sb.append(getException()).append("|"); + sb.append(getExceptionQps()).append("|"); sb.append(getRt()); sb.append('\n'); return sb.toString(); @@ -178,10 +178,10 @@ public static MetricNode fromFatString(String line) { MetricNode node = new MetricNode(); node.setTimestamp(time); node.setResource(strs[2]); - node.setPassedQps(Long.parseLong(strs[3])); - node.setBlockedQps(Long.parseLong(strs[4])); + node.setPassQps(Long.parseLong(strs[3])); + node.setBlockQps(Long.parseLong(strs[4])); node.setSuccessQps(Long.parseLong(strs[5])); - node.setException(Long.parseLong(strs[6])); + node.setExceptionQps(Long.parseLong(strs[6])); node.setRt(Long.parseLong(strs[7])); return node; } diff --git a/sentinel-core/src/main/java/com/alibaba/csp/sentinel/slots/statistic/StatisticSlot.java b/sentinel-core/src/main/java/com/alibaba/csp/sentinel/slots/statistic/StatisticSlot.java index 093adbe387..67ddc4a92d 100755 --- a/sentinel-core/src/main/java/com/alibaba/csp/sentinel/slots/statistic/StatisticSlot.java +++ b/sentinel-core/src/main/java/com/alibaba/csp/sentinel/slots/statistic/StatisticSlot.java @@ -72,13 +72,13 @@ public void entry(Context context, ResourceWrapper resourceWrapper, DefaultNode context.getCurEntry().setError(e); // Add block count. - node.increaseBlockedQps(); + node.increaseBlockQps(); if (context.getCurEntry().getOriginNode() != null) { - context.getCurEntry().getOriginNode().increaseBlockedQps(); + context.getCurEntry().getOriginNode().increaseBlockQps(); } if (resourceWrapper.getType() == EntryType.IN) { - Constants.ENTRY_NODE.increaseBlockedQps(); + Constants.ENTRY_NODE.increaseBlockQps(); } for (ProcessorSlotEntryCallback handler : StatisticSlotCallbackRegistry.getEntryCallbacks()) { diff --git a/sentinel-core/src/main/java/com/alibaba/csp/sentinel/slots/statistic/metric/ArrayMetric.java b/sentinel-core/src/main/java/com/alibaba/csp/sentinel/slots/statistic/metric/ArrayMetric.java index 684c8365ef..f6a9277fd4 100755 --- a/sentinel-core/src/main/java/com/alibaba/csp/sentinel/slots/statistic/metric/ArrayMetric.java +++ b/sentinel-core/src/main/java/com/alibaba/csp/sentinel/slots/statistic/metric/ArrayMetric.java @@ -144,9 +144,9 @@ public List details() { continue; } MetricNode node = new MetricNode(); - node.setBlockedQps(window.value().block()); - node.setException(window.value().exception()); - node.setPassedQps(window.value().pass()); + node.setBlockQps(window.value().block()); + node.setExceptionQps(window.value().exception()); + node.setPassQps(window.value().pass()); long passQps = window.value().success(); node.setSuccessQps(passQps); if (passQps != 0) { diff --git a/sentinel-dashboard/src/main/java/com/taobao/csp/sentinel/dashboard/datasource/entity/MetricEntity.java b/sentinel-dashboard/src/main/java/com/taobao/csp/sentinel/dashboard/datasource/entity/MetricEntity.java index c8c2806a7a..fd3314f6a2 100755 --- a/sentinel-dashboard/src/main/java/com/taobao/csp/sentinel/dashboard/datasource/entity/MetricEntity.java +++ b/sentinel-dashboard/src/main/java/com/taobao/csp/sentinel/dashboard/datasource/entity/MetricEntity.java @@ -30,16 +30,13 @@ public class MetricEntity { */ private Date timestamp; private String resource; - private Long passedQps; + private Long passQps; private Long successQps; - private Long blockedQps; - /** - * 发生异常的次数 - */ - private Long exception; + private Long blockQps; + private Long exceptionQps; /** - * 所有successQps的Rt的和。 + * summary rt of all success exit qps. */ private double rt; @@ -58,26 +55,26 @@ public static MetricEntity copyOf(MetricEntity oldEntity) { entity.setApp(oldEntity.getApp()); entity.setTimestamp(oldEntity.getTimestamp()); entity.setResource(oldEntity.getResource()); - entity.setPassedQps(oldEntity.getPassedQps()); - entity.setBlockedQps(oldEntity.getBlockedQps()); + entity.setPassQps(oldEntity.getPassQps()); + entity.setBlockQps(oldEntity.getBlockQps()); entity.setSuccessQps(oldEntity.getSuccessQps()); - entity.setException(oldEntity.getException()); + entity.setExceptionQps(oldEntity.getExceptionQps()); entity.setRt(oldEntity.getRt()); entity.setCount(oldEntity.getCount()); entity.setResource(oldEntity.getResource()); return entity; } - public synchronized void addPassedQps(Long passedQps) { - this.passedQps += passedQps; + public synchronized void addPassQps(Long passQps) { + this.passQps += passQps; } - public synchronized void addBlockedQps(Long blockedQps) { - this.blockedQps += blockedQps; + public synchronized void addBlockQps(Long blockQps) { + this.blockQps += blockQps; } - public synchronized void addException(Long exception) { - this.exception += exception; + public synchronized void addExceptionQps(Long exceptionQps) { + this.exceptionQps += exceptionQps; } public synchronized void addCount(int count) { @@ -149,28 +146,28 @@ public void setResource(String resource) { this.resourceCode = resource.hashCode(); } - public Long getPassedQps() { - return passedQps; + public Long getPassQps() { + return passQps; } - public void setPassedQps(Long passedQps) { - this.passedQps = passedQps; + public void setPassQps(Long passQps) { + this.passQps = passQps; } - public Long getBlockedQps() { - return blockedQps; + public Long getBlockQps() { + return blockQps; } - public void setBlockedQps(Long blockedQps) { - this.blockedQps = blockedQps; + public void setBlockQps(Long blockQps) { + this.blockQps = blockQps; } - public Long getException() { - return exception; + public Long getExceptionQps() { + return exceptionQps; } - public void setException(Long exception) { - this.exception = exception; + public void setExceptionQps(Long exceptionQps) { + this.exceptionQps = exceptionQps; } public double getRt() { @@ -210,10 +207,10 @@ public String toString() { ", app='" + app + '\'' + ", timestamp=" + timestamp + ", resource='" + resource + '\'' + - ", passedQps=" + passedQps + - ", blockedQps=" + blockedQps + + ", passQps=" + passQps + + ", blockQps=" + blockQps + ", successQps=" + successQps + - ", exception=" + exception + + ", exceptionQps=" + exceptionQps + ", rt=" + rt + ", count=" + count + ", resourceCode=" + resourceCode + diff --git a/sentinel-dashboard/src/main/java/com/taobao/csp/sentinel/dashboard/domain/ResourceTreeNode.java b/sentinel-dashboard/src/main/java/com/taobao/csp/sentinel/dashboard/domain/ResourceTreeNode.java index 542a081498..8011ff8b9d 100755 --- a/sentinel-dashboard/src/main/java/com/taobao/csp/sentinel/dashboard/domain/ResourceTreeNode.java +++ b/sentinel-dashboard/src/main/java/com/taobao/csp/sentinel/dashboard/domain/ResourceTreeNode.java @@ -32,13 +32,13 @@ public class ResourceTreeNode { private Integer threadNum; private Long passQps; - private Long blockedQps; + private Long blockQps; private Long totalQps; private Long averageRt; private Long successQps; private Long exceptionQps; - private Long oneMinutePassed; - private Long oneMinuteBlocked; + private Long oneMinutePass; + private Long oneMinuteBlock; private Long oneMinuteException; private Long oneMinuteTotal; @@ -74,13 +74,13 @@ public static ResourceTreeNode fromNodeVo(NodeVo vo) { node.resource = vo.getResource(); node.threadNum = vo.getThreadNum(); node.passQps = vo.getPassQps(); - node.blockedQps = vo.getBlockedQps(); + node.blockQps = vo.getBlockQps(); node.totalQps = vo.getTotalQps(); node.averageRt = vo.getAverageRt(); node.successQps = vo.getSuccessQps(); node.exceptionQps = vo.getExceptionQps(); - node.oneMinutePassed = vo.getOneMinutePassed(); - node.oneMinuteBlocked = vo.getOneMinuteBlocked(); + node.oneMinutePass = vo.getOneMinutePass(); + node.oneMinuteBlock = vo.getOneMinuteBlock(); node.oneMinuteException = vo.getOneMinuteException(); node.oneMinuteTotal = vo.getOneMinuteTotal(); return node; @@ -151,12 +151,12 @@ public void setPassQps(Long passQps) { this.passQps = passQps; } - public Long getBlockedQps() { - return blockedQps; + public Long getBlockQps() { + return blockQps; } - public void setBlockedQps(Long blockedQps) { - this.blockedQps = blockedQps; + public void setBlockQps(Long blockQps) { + this.blockQps = blockQps; } public Long getTotalQps() { @@ -191,20 +191,20 @@ public void setExceptionQps(Long exceptionQps) { this.exceptionQps = exceptionQps; } - public Long getOneMinutePassed() { - return oneMinutePassed; + public Long getOneMinutePass() { + return oneMinutePass; } - public void setOneMinutePassed(Long oneMinutePassed) { - this.oneMinutePassed = oneMinutePassed; + public void setOneMinutePass(Long oneMinutePass) { + this.oneMinutePass = oneMinutePass; } - public Long getOneMinuteBlocked() { - return oneMinuteBlocked; + public Long getOneMinuteBlock() { + return oneMinuteBlock; } - public void setOneMinuteBlocked(Long oneMinuteBlocked) { - this.oneMinuteBlocked = oneMinuteBlocked; + public void setOneMinuteBlock(Long oneMinuteBlock) { + this.oneMinuteBlock = oneMinuteBlock; } public Long getOneMinuteException() { diff --git a/sentinel-dashboard/src/main/java/com/taobao/csp/sentinel/dashboard/metric/MetricFetcher.java b/sentinel-dashboard/src/main/java/com/taobao/csp/sentinel/dashboard/metric/MetricFetcher.java index dce727f02c..6ffd2b78de 100755 --- a/sentinel-dashboard/src/main/java/com/taobao/csp/sentinel/dashboard/metric/MetricFetcher.java +++ b/sentinel-dashboard/src/main/java/com/taobao/csp/sentinel/dashboard/metric/MetricFetcher.java @@ -304,19 +304,19 @@ private void handleBody(String[] lines, MachineInfo machine, Map listResourcesOfApp(String app) { MetricEntity newEntity = metrics.getValue(); if (resourceCount.containsKey(resourceMetrics.getKey())) { MetricEntity oldEntity = resourceCount.get(resourceMetrics.getKey()); - oldEntity.addPassedQps(newEntity.getPassedQps()); + oldEntity.addPassQps(newEntity.getPassQps()); oldEntity.addRtAndSuccessQps(newEntity.getRt(), newEntity.getSuccessQps()); - oldEntity.addBlockedQps(newEntity.getBlockedQps()); - oldEntity.addException(newEntity.getException()); + oldEntity.addBlockQps(newEntity.getBlockQps()); + oldEntity.addExceptionQps(newEntity.getExceptionQps()); oldEntity.addCount(1); } else { resourceCount.put(resourceMetrics.getKey(), MetricEntity.copyOf(newEntity)); @@ -129,11 +129,11 @@ public List listResourcesOfApp(String app) { .sorted((o1, o2) -> { MetricEntity e1 = o1.getValue(); MetricEntity e2 = o2.getValue(); - int t = e2.getBlockedQps().compareTo(e1.getBlockedQps()); + int t = e2.getBlockQps().compareTo(e1.getBlockQps()); if (t != 0) { return t; } - return e2.getPassedQps().compareTo(e1.getPassedQps()); + return e2.getPassQps().compareTo(e1.getPassQps()); }) .map(Entry::getKey) .collect(Collectors.toList()); diff --git a/sentinel-dashboard/src/main/java/com/taobao/csp/sentinel/dashboard/view/vo/MetricVo.java b/sentinel-dashboard/src/main/java/com/taobao/csp/sentinel/dashboard/view/vo/MetricVo.java index fd9296b474..c2e73713b3 100755 --- a/sentinel-dashboard/src/main/java/com/taobao/csp/sentinel/dashboard/view/vo/MetricVo.java +++ b/sentinel-dashboard/src/main/java/com/taobao/csp/sentinel/dashboard/view/vo/MetricVo.java @@ -29,11 +29,11 @@ public class MetricVo implements Comparable { private String app; private Long timestamp; private Long gmtCreate = System.currentTimeMillis(); - private String identity; - private Long passedQps; - private Long blockedQps; + private String resource; + private Long passQps; + private Long blockQps; private Long successQps; - private Long exception; + private Long exceptionQps; /** * average rt */ @@ -78,11 +78,11 @@ public static MetricVo fromMetricEntity(MetricEntity entity) { vo.app = entity.getApp(); vo.timestamp = entity.getTimestamp().getTime(); vo.gmtCreate = entity.getGmtCreate().getTime(); - vo.identity = entity.getResource(); - vo.passedQps = entity.getPassedQps(); - vo.blockedQps = entity.getBlockedQps(); + vo.resource = entity.getResource(); + vo.passQps = entity.getPassQps(); + vo.blockQps = entity.getBlockQps(); vo.successQps = entity.getSuccessQps(); - vo.exception = entity.getException(); + vo.exceptionQps = entity.getExceptionQps(); if (entity.getSuccessQps() != 0) { vo.rt = entity.getRt() / entity.getSuccessQps(); } else { @@ -96,18 +96,18 @@ public static MetricVo parse(String line) { String[] strs = line.split("\\|"); long timestamp = Long.parseLong(strs[0]); String identity = strs[1]; - long passedQps = Long.parseLong(strs[2]); - long blockedQps = Long.parseLong(strs[3]); + long passQps = Long.parseLong(strs[2]); + long blockQps = Long.parseLong(strs[3]); long exception = Long.parseLong(strs[4]); double rt = Double.parseDouble(strs[5]); long successQps = Long.parseLong(strs[6]); MetricVo vo = new MetricVo(); vo.timestamp = timestamp; - vo.identity = identity; - vo.passedQps = passedQps; - vo.blockedQps = blockedQps; + vo.resource = identity; + vo.passQps = passQps; + vo.blockQps = blockQps; vo.successQps = successQps; - vo.exception = exception; + vo.exceptionQps = exception; vo.rt = rt; vo.count = 1; return vo; @@ -145,28 +145,28 @@ public void setGmtCreate(Long gmtCreate) { this.gmtCreate = gmtCreate; } - public String getIdentity() { - return identity; + public String getResource() { + return resource; } - public void setIdentity(String identity) { - this.identity = identity; + public void setResource(String resource) { + this.resource = resource; } - public Long getPassedQps() { - return passedQps; + public Long getPassQps() { + return passQps; } - public void setPassedQps(Long passedQps) { - this.passedQps = passedQps; + public void setPassQps(Long passQps) { + this.passQps = passQps; } - public Long getBlockedQps() { - return blockedQps; + public Long getBlockQps() { + return blockQps; } - public void setBlockedQps(Long blockedQps) { - this.blockedQps = blockedQps; + public void setBlockQps(Long blockQps) { + this.blockQps = blockQps; } public Long getSuccessQps() { @@ -177,12 +177,12 @@ public void setSuccessQps(Long successQps) { this.successQps = successQps; } - public Long getException() { - return exception; + public Long getExceptionQps() { + return exceptionQps; } - public void setException(Long exception) { - this.exception = exception; + public void setExceptionQps(Long exceptionQps) { + this.exceptionQps = exceptionQps; } public Double getRt() { diff --git a/sentinel-dashboard/src/main/java/com/taobao/csp/sentinel/dashboard/view/vo/ResourceVo.java b/sentinel-dashboard/src/main/java/com/taobao/csp/sentinel/dashboard/view/vo/ResourceVo.java index a84096a312..bbba8b473e 100755 --- a/sentinel-dashboard/src/main/java/com/taobao/csp/sentinel/dashboard/view/vo/ResourceVo.java +++ b/sentinel-dashboard/src/main/java/com/taobao/csp/sentinel/dashboard/view/vo/ResourceVo.java @@ -32,13 +32,13 @@ public class ResourceVo { private Integer threadNum; private Long passQps; - private Long blockedQps; + private Long blockQps; private Long totalQps; private Long averageRt; private Long passRequestQps; private Long exceptionQps; - private Long oneMinutePassed; - private Long oneMinuteBlocked; + private Long oneMinutePass; + private Long oneMinuteBlock; private Long oneMinuteException; private Long oneMinuteTotal; @@ -64,12 +64,12 @@ public static List fromNodeVoList(List nodeVos) { vo.resource = nodeVo.getResource(); vo.threadNum = nodeVo.getThreadNum(); vo.passQps = nodeVo.getPassQps(); - vo.blockedQps = nodeVo.getBlockedQps(); + vo.blockQps = nodeVo.getBlockQps(); vo.totalQps = nodeVo.getTotalQps(); vo.averageRt = nodeVo.getAverageRt(); vo.exceptionQps = nodeVo.getExceptionQps(); - vo.oneMinutePassed = nodeVo.getOneMinutePassed(); - vo.oneMinuteBlocked = nodeVo.getOneMinuteBlocked(); + vo.oneMinutePass = nodeVo.getOneMinutePass(); + vo.oneMinuteBlock = nodeVo.getOneMinuteBlock(); vo.oneMinuteException = nodeVo.getOneMinuteException(); vo.oneMinuteTotal = nodeVo.getOneMinuteTotal(); list.add(vo); @@ -103,12 +103,12 @@ private static void visit(ResourceTreeNode node, List list, boolean vo.resource = node.getResource(); vo.threadNum = node.getThreadNum(); vo.passQps = node.getPassQps(); - vo.blockedQps = node.getBlockedQps(); + vo.blockQps = node.getBlockQps(); vo.totalQps = node.getTotalQps(); vo.averageRt = node.getAverageRt(); vo.exceptionQps = node.getExceptionQps(); - vo.oneMinutePassed = node.getOneMinutePassed(); - vo.oneMinuteBlocked = node.getOneMinuteBlocked(); + vo.oneMinutePass = node.getOneMinutePass(); + vo.oneMinuteBlock = node.getOneMinuteBlock(); vo.oneMinuteException = node.getOneMinuteException(); vo.oneMinuteTotal = node.getOneMinuteTotal(); vo.visible = node.isVisible(); @@ -159,12 +159,12 @@ public void setPassQps(Long passQps) { this.passQps = passQps; } - public Long getBlockedQps() { - return blockedQps; + public Long getBlockQps() { + return blockQps; } - public void setBlockedQps(Long blockedQps) { - this.blockedQps = blockedQps; + public void setBlockQps(Long blockQps) { + this.blockQps = blockQps; } public Long getTotalQps() { @@ -207,20 +207,20 @@ public void setOneMinuteException(Long oneMinuteException) { this.oneMinuteException = oneMinuteException; } - public Long getOneMinutePassed() { - return oneMinutePassed; + public Long getOneMinutePass() { + return oneMinutePass; } - public void setOneMinutePassed(Long oneMinutePassed) { - this.oneMinutePassed = oneMinutePassed; + public void setOneMinutePass(Long oneMinutePass) { + this.oneMinutePass = oneMinutePass; } - public Long getOneMinuteBlocked() { - return oneMinuteBlocked; + public Long getOneMinuteBlock() { + return oneMinuteBlock; } - public void setOneMinuteBlocked(Long oneMinuteBlocked) { - this.oneMinuteBlocked = oneMinuteBlocked; + public void setOneMinuteBlock(Long oneMinuteBlock) { + this.oneMinuteBlock = oneMinuteBlock; } public Long getOneMinuteTotal() { diff --git a/sentinel-dashboard/src/main/webapp/resources/app/scripts/controllers/metric.js b/sentinel-dashboard/src/main/webapp/resources/app/scripts/controllers/metric.js index 8f85300761..558495a5a4 100755 --- a/sentinel-dashboard/src/main/webapp/resources/app/scripts/controllers/metric.js +++ b/sentinel-dashboard/src/main/webapp/resources/app/scripts/controllers/metric.js @@ -75,13 +75,13 @@ app.controller('MetricCtl', ['$scope', '$stateParams', 'MetricService', '$interv type: 'time', mask: 'YYYY-MM-DD HH:mm:ss' }); - chart.scale('passedQps', { + chart.scale('passQps', { min: 0, fine: true, alias: 'p_qps' // max: 10 }); - chart.scale('blockedQps', { + chart.scale('blockQps', { min: 0, fine: true, alias: 'b_qps', @@ -94,7 +94,7 @@ app.controller('MetricCtl', ['$scope', '$stateParams', 'MetricService', '$interv grid: null, label: null }); - chart.axis('blockedQps', { + chart.axis('blockQps', { grid: null, label: null }); @@ -118,17 +118,17 @@ app.controller('MetricCtl', ['$scope', '$stateParams', 'MetricService', '$interv allowAllCanceled: true, itemFormatter: function (val) { // console.log('val=', val); - if ('passedQps' === val) { + if ('passQps' === val) { return 'p_qps'; } - if ('blockedQps' === val) { + if ('blockQps' === val) { return 'b_qps'; } return val; }, items: [ - { value: 'passedQps', marker: { symbol: 'hyphen', stroke: 'green', radius: 5, lineWidth: 2 } }, - { value: 'blockedQps', marker: { symbol: 'hyphen', stroke: 'blue', radius: 5, lineWidth: 2 } }, + { value: 'passQps', marker: { symbol: 'hyphen', stroke: 'green', radius: 5, lineWidth: 2 } }, + { value: 'blockQps', marker: { symbol: 'hyphen', stroke: 'blue', radius: 5, lineWidth: 2 } }, // { value: 'rt', marker: {symbol: 'hyphen', stroke: 'gray', radius: 5, lineWidth: 2} }, ], onClick: function (ev) { @@ -148,8 +148,8 @@ app.controller('MetricCtl', ['$scope', '$stateParams', 'MetricService', '$interv } } }); - chart.line().position('timestamp*passedQps').size(1).color('green').shape('smooth'); - chart.line().position('timestamp*blockedQps').size(1).color('blue').shape('smooth'); + chart.line().position('timestamp*passQps').size(1).color('green').shape('smooth'); + chart.line().position('timestamp*blockQps').size(1).color('blue').shape('smooth'); // chart.line().position('timestamp*rt').size(1).color('gray'); G2.track(false); chart.render(); @@ -214,8 +214,8 @@ app.controller('MetricCtl', ['$scope', '$stateParams', 'MetricService', '$interv for (var j = lastTime + 1; j < curTime; j++) { filledData.push({ "timestamp": j * 1000, - "passedQps": 0, - "blockedQps": 0, + "passQps": 0, + "blockQps": 0, "successQps": 0, "exception": 0, "rt": 0, diff --git a/sentinel-dashboard/src/main/webapp/resources/app/views/identity.html b/sentinel-dashboard/src/main/webapp/resources/app/views/identity.html index 682f71bba2..03eba209bb 100755 --- a/sentinel-dashboard/src/main/webapp/resources/app/views/identity.html +++ b/sentinel-dashboard/src/main/webapp/resources/app/views/identity.html @@ -61,13 +61,13 @@ {{resource.passQps}} - {{resource.blockedQps}} + {{resource.blockQps}} {{resource.threadNum}} {{resource.averageRt}} - {{resource.oneMinutePassed}} + {{resource.oneMinutePass}} - {{resource.oneMinuteBlocked}} - {{resource.oneMinuteBlocked}} + {{resource.oneMinuteBlock}} + {{resource.oneMinuteBlock}}