aboutsummaryrefslogtreecommitdiff
path: root/spark-common/src
diff options
context:
space:
mode:
Diffstat (limited to 'spark-common/src')
-rw-r--r--spark-common/src/main/java/me/lucko/spark/common/monitor/net/NetworkMonitor.java7
1 files changed, 4 insertions, 3 deletions
diff --git a/spark-common/src/main/java/me/lucko/spark/common/monitor/net/NetworkMonitor.java b/spark-common/src/main/java/me/lucko/spark/common/monitor/net/NetworkMonitor.java
index dadd4e5..79ab8d9 100644
--- a/spark-common/src/main/java/me/lucko/spark/common/monitor/net/NetworkMonitor.java
+++ b/spark-common/src/main/java/me/lucko/spark/common/monitor/net/NetworkMonitor.java
@@ -41,8 +41,9 @@ public enum NetworkMonitor {
// Latest readings
private static final AtomicReference<Map<String, NetworkInterfaceInfo>> SYSTEM = new AtomicReference<>();
- // a pattern to match the interface names to calculate rolling averages for
- private static final Pattern INTERFACES_TO_MONITOR = Pattern.compile("^(eth\\d+)|(lo)$");
+ // a pattern to match the interface names to exclude from monitoring
+ // ignore: virtual eth adapters + container bridge networks
+ private static final Pattern INTERFACES_TO_IGNORE = Pattern.compile("^(veth\\w+)|(br-\\w+)$");
// Rolling averages for system/process data over 15 mins
private static final Map<String, NetworkInterfaceAverages> SYSTEM_AVERAGES = new ConcurrentHashMap<>();
@@ -96,7 +97,7 @@ public enum NetworkMonitor {
private static void submit(Map<String, NetworkInterfaceAverages> rollingAveragesMap, Map<String, NetworkInterfaceInfo> values) {
// ensure all incoming keys are present in the rolling averages map
for (String key : values.keySet()) {
- if (INTERFACES_TO_MONITOR.matcher(key).matches()) {
+ if (!INTERFACES_TO_IGNORE.matcher(key).matches()) {
rollingAveragesMap.computeIfAbsent(key, k -> new NetworkInterfaceAverages(WINDOW_SIZE));
}
}