[tor-commits] [metrics-web/master] Fix missing values in relay flags graph.

karsten at torproject.org karsten at torproject.org
Wed Jun 27 09:47:22 UTC 2012


commit d759a27b986bc64e98720d74082c38a2e635df11
Author: Karsten Loesing <karsten.loesing at gmx.net>
Date:   Wed Jun 27 11:45:28 2012 +0200

    Fix missing values in relay flags graph.
---
 rserve/graphs.R |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/rserve/graphs.R b/rserve/graphs.R
index 41dd22b..0331750 100644
--- a/rserve/graphs.R
+++ b/rserve/graphs.R
@@ -608,6 +608,15 @@ plot_relayflags <- function(start, end, flags, granularity, path, dpi) {
       variable = paste("avg_", c("running", "exit", "guard", "fast",
         "stable"), sep = ""),
       value = rep(NA, 5)), networksize)
+    dates <- seq(from = as.Date(start, "%Y-%m-%d"),
+        to = as.Date(end, "%Y-%m-%d"), by="1 day")
+    missing <- setdiff(dates, networksize$date)
+    if (length(missing) > 0)
+      networksize <- rbind(data.frame(
+        date = as.Date(rep(missing, 5), origin = "1970-01-01"),
+        variable = paste("avg_", c("running", "exit", "guard", "fast",
+          "stable"), sep = ""),
+        value = rep(NA, length(missing) * 5)), networksize)
     date_breaks <- date_breaks(
       as.numeric(max(as.Date(networksize$date, "%Y-%m-%d")) -
       min(as.Date(networksize$date, "%Y-%m-%d"))))



More information about the tor-commits mailing list