[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [metrics-web/release] Only include Running relays in totalcw graph.



commit 9df357886ebfca86da41fb7835282a3b57d249c0
Author: Karsten Loesing <karsten.loesing@xxxxxxx>
Date:   Thu Nov 29 08:45:10 2018 +0100

    Only include Running relays in totalcw graph.
    
    Previously we included measured bandwidths of all relays in a vote in
    the totalcw graph. Now we only include relays with the Running flag in
    the vote.
    
    Implements #28137.
---
 src/main/java/org/torproject/metrics/stats/totalcw/Parser.java      | 3 ++-
 .../metrics/stats/totalcw/TotalcwRelayNetworkStatusVoteTest.java    | 6 +++---
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/main/java/org/torproject/metrics/stats/totalcw/Parser.java b/src/main/java/org/torproject/metrics/stats/totalcw/Parser.java
index 893184c..b6a35b4 100644
--- a/src/main/java/org/torproject/metrics/stats/totalcw/Parser.java
+++ b/src/main/java/org/torproject/metrics/stats/totalcw/Parser.java
@@ -19,7 +19,8 @@ class Parser {
       RelayNetworkStatusVote vote) {
     Long measuredSum = null;
     for (NetworkStatusEntry entry : vote.getStatusEntries().values()) {
-      if (entry.getMeasured() < 0L) {
+      if (null == entry.getFlags() || !entry.getFlags().contains("Running")
+          || entry.getMeasured() < 0L) {
         continue;
       }
       if (null == measuredSum) {
diff --git a/src/test/java/org/torproject/metrics/stats/totalcw/TotalcwRelayNetworkStatusVoteTest.java b/src/test/java/org/torproject/metrics/stats/totalcw/TotalcwRelayNetworkStatusVoteTest.java
index 11f931d..7c5ecc7 100644
--- a/src/test/java/org/torproject/metrics/stats/totalcw/TotalcwRelayNetworkStatusVoteTest.java
+++ b/src/test/java/org/torproject/metrics/stats/totalcw/TotalcwRelayNetworkStatusVoteTest.java
@@ -39,15 +39,15 @@ public class TotalcwRelayNetworkStatusVoteTest {
         { "2018-10-15-00-00-00-vote-27102BC123E7AF1D4741AE047E160C91ADC76B21-"
             + "049AB3179B12DACC391F06A10C2A8904E4339D33.part",
             ZonedDateTime.parse("2018-10-15T00:00:00Z").toLocalDateTime(),
-            "bastet", "27102BC123E7AF1D4741AE047E160C91ADC76B21", 138803L },
+            "bastet", "27102BC123E7AF1D4741AE047E160C91ADC76B21", 138700L },
         { "2018-10-15-00-00-00-vote-ED03BB616EB2F60BEC80151114BB25CEF515B226-"
             + "2669AD153408F88E416CE6206D1A75EC3324A2F4.part",
             ZonedDateTime.parse("2018-10-15T00:00:00Z").toLocalDateTime(),
-            "gabelmoo", "ED03BB616EB2F60BEC80151114BB25CEF515B226", 133441L },
+            "gabelmoo", "ED03BB616EB2F60BEC80151114BB25CEF515B226", 133370L },
         { "2018-10-15-00-00-00-vote-EFCBE720AB3A82B99F9E953CD5BF50F7EEFC7B97-"
             + "38C6A19F78948B689345EE41D7119D76246C4D3E.part",
             ZonedDateTime.parse("2018-10-15T00:00:00Z").toLocalDateTime(),
-            "Faravahar", "EFCBE720AB3A82B99F9E953CD5BF50F7EEFC7B97", 158534L }
+            "Faravahar", "EFCBE720AB3A82B99F9E953CD5BF50F7EEFC7B97", 158395L }
     });
   }
 



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits