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

[tor-commits] [metrics-web/master] Cut off too recent dates from hidserv.csv.



commit f810b3f8259750a68977f38fe2e71e6c48794816
Author: Karsten Loesing <karsten.loesing@xxxxxxx>
Date:   Mon Feb 12 15:17:16 2018 +0100

    Cut off too recent dates from hidserv.csv.
    
    In commit 8831ece we stopped cutting off data from CSV files when
    graphing the data.
    
    With this commit we're cuting off the last two days from hidserv.csv.
    
    Fixes #25196.
---
 src/main/java/org/torproject/metrics/stats/hidserv/Aggregator.java | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/main/java/org/torproject/metrics/stats/hidserv/Aggregator.java b/src/main/java/org/torproject/metrics/stats/hidserv/Aggregator.java
index a57fde5..5cafb1b 100644
--- a/src/main/java/org/torproject/metrics/stats/hidserv/Aggregator.java
+++ b/src/main/java/org/torproject/metrics/stats/hidserv/Aggregator.java
@@ -64,6 +64,10 @@ public class Aggregator {
       return;
     }
 
+    /* Exclude any statistics being as recent as yesterday or newer. */
+    String yesterday = DateTimeHelper.format(System.currentTimeMillis()
+        - DateTimeHelper.ONE_DAY, DateTimeHelper.ISO_DATE_FORMAT);
+
     /* Re-arrange extrapolated network totals by statistics interval end
      * date, and include the computed network total as weight for the
      * extrapolated value.  More precisely, map keys are ISO-formatted
@@ -76,6 +80,9 @@ public class Aggregator {
       String date = DateTimeHelper.format(
           extrapolated.getStatsDateMillis(),
           DateTimeHelper.ISO_DATE_FORMAT);
+      if (date.compareTo(yesterday) >= 0) {
+        continue;
+      }
       if (extrapolated.getFractionRendRelayedCells() > 0.0) {
         if (!extrapolatedCells.containsKey(date)) {
           extrapolatedCells.put(date, new ArrayList<>());



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