|
|
@@ -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); |
|
|
|
}}; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|