dashboard: Filter internal virtual resources in MetricFetcher
- also fix pom.xml to suppress warnings Signed-off-by: Eric Zhao <sczyh16@gmail.com>
This commit is contained in:
parent
f8ebbbccf4
commit
4182c013c8
|
|
@ -139,6 +139,7 @@
|
|||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<version>${spring.boot.version}</version>
|
||||
<configuration>
|
||||
<fork>true</fork>
|
||||
<mainClass>com.alibaba.csp.sentinel.dashboard.DashboardApplication</mainClass>
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ import java.net.ConnectException;
|
|||
import java.net.SocketTimeoutException;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.Date;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
|
@ -34,6 +35,7 @@ import java.util.concurrent.ThreadPoolExecutor.DiscardPolicy;
|
|||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
|
||||
import com.alibaba.csp.sentinel.Constants;
|
||||
import com.alibaba.csp.sentinel.concurrent.NamedThreadFactory;
|
||||
import com.alibaba.csp.sentinel.config.SentinelConfig;
|
||||
import com.alibaba.csp.sentinel.dashboard.datasource.entity.MetricEntity;
|
||||
|
|
@ -322,7 +324,10 @@ public class MetricFetcher {
|
|||
for (String line : lines) {
|
||||
try {
|
||||
MetricNode node = MetricNode.fromThinString(line);
|
||||
/**
|
||||
if (shouldFilterOut(node.getResource())) {
|
||||
continue;
|
||||
}
|
||||
/*
|
||||
* aggregation metrics by app_resource_timeSecond, ignore ip and port.
|
||||
*/
|
||||
String key = buildMetricKey(machine.getApp(), node.getResource(), node.getTimestamp());
|
||||
|
|
@ -355,6 +360,16 @@ public class MetricFetcher {
|
|||
return app + "__" + resource + "__" + (timestamp / 1000);
|
||||
}
|
||||
|
||||
private boolean shouldFilterOut(String resource) {
|
||||
return RES_EXCLUSION_SET.contains(resource);
|
||||
}
|
||||
|
||||
private static final Set<String> RES_EXCLUSION_SET = new HashSet<String>() {{
|
||||
add(Constants.TOTAL_IN_RESOURCE_NAME);
|
||||
add(Constants.SYSTEM_LOAD_RESOURCE_NAME);
|
||||
add(Constants.CPU_USAGE_RESOURCE_NAME);
|
||||
}};
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue