commit 9a9b848d10135dc64549a0819fa2d7f4a0ca5f5c Author: Karsten Loesing karsten.loesing@gmx.net Date: Mon Jun 15 15:42:53 2020 +0200
Update to BridgeDB metrics version 2. --- src/main/java/org/torproject/metrics/stats/bridgedb/Main.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/src/main/java/org/torproject/metrics/stats/bridgedb/Main.java b/src/main/java/org/torproject/metrics/stats/bridgedb/Main.java index f7e9fb4..97a24d3 100644 --- a/src/main/java/org/torproject/metrics/stats/bridgedb/Main.java +++ b/src/main/java/org/torproject/metrics/stats/bridgedb/Main.java @@ -81,8 +81,9 @@ public class Main { continue; } BridgedbMetrics bridgedbMetrics = (BridgedbMetrics) descriptor; - if (!"1".equals(bridgedbMetrics.bridgedbMetricsVersion())) { - logger.warn("Unable to process BridgeDB metrics version {} != 1.", + if (!bridgedbMetrics.bridgedbMetricsVersion().startsWith("1") + && !bridgedbMetrics.bridgedbMetricsVersion().startsWith("2")) { + logger.warn("Unable to process BridgeDB metrics version {} > 2.", bridgedbMetrics.bridgedbMetricsVersion()); continue; } @@ -99,13 +100,17 @@ public class Main { /* Unable to extract relevant key parts. */ continue; } + String distributor = keyParts[0]; + if (distributor.equals("internal")) { + /* Skip internal metrics added in BridgeDB metrics version 2. */ + continue; + } if (bridgedbMetricCount.getValue() < 10) { logger.warn("Skipping too small BridgeDB metric count {} < 10 in {}.", bridgedbMetricCount.getValue(), descriptor.getDescriptorFile().getAbsolutePath()); continue; } - String distributor = keyParts[0]; String transport = keyParts[1]; String ccOrEmail = keyParts[2]; if (ccOrEmail.equals("zz")) {