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

[tor-commits] [metrics-web/master] Update directory bytes graph to include authorities.



commit c52b7ce61c86ddd6a0aac62272c439e54bff9a70
Author: Karsten Loesing <karsten.loesing@xxxxxxx>
Date:   Tue Mar 3 13:03:09 2020 +0100

    Update directory bytes graph to include authorities.
    
    Implements #33065.
---
 src/main/R/rserver/rserve-init.R                    | 21 ++++++++++++++++-----
 src/main/resources/web/json/metrics.json            |  2 +-
 .../resources/web/jsps/reproducible-metrics.jsp     |  2 +-
 src/main/resources/web/jsps/stats.jsp               |  2 ++
 4 files changed, 20 insertions(+), 7 deletions(-)

diff --git a/src/main/R/rserver/rserve-init.R b/src/main/R/rserver/rserve-init.R
index 46abc8a..6d4c571 100644
--- a/src/main/R/rserver/rserve-init.R
+++ b/src/main/R/rserver/rserve-init.R
@@ -467,22 +467,31 @@ prepare_dirbytes <- function(start_p = NULL, end_p = NULL) {
         bwread = col_skip(),
         bwwrite = col_skip(),
         dirread = col_double(),
-        dirwrite = col_double())) %>%
+        dirwrite = col_double(),
+        dirauthread = col_double(),
+        dirauthwrite = col_double())) %>%
     filter(if (!is.null(start_p)) date >= as.Date(start_p) else TRUE) %>%
     filter(if (!is.null(end_p)) date <= as.Date(end_p) else TRUE) %>%
     filter(is.na(isexit)) %>%
     filter(is.na(isguard)) %>%
     mutate(dirread = dirread * 8 / 1e9,
-      dirwrite = dirwrite * 8 / 1e9) %>%
-    select(date, dirread, dirwrite)
+      dirwrite = dirwrite * 8 / 1e9,
+      dirauthread = dirauthread * 8 / 1e9,
+      dirauthwrite = dirauthwrite * 8 / 1e9) %>%
+    select(date, dirread, dirwrite, dirauthread, dirauthwrite)
 }
 
 plot_dirbytes <- function(start_p, end_p, path_p) {
   prepare_dirbytes(start_p, end_p) %>%
     gather(variable, value, -date) %>%
+    mutate(readwrite = ifelse(grepl("read", variable), "dirread", "dirwrite"),
+      authority = factor(
+          ifelse(grepl("auth", variable), "authorities", "mirrors"),
+          levels = c("authorities", "mirrors"))) %>%
     complete(date = full_seq(date, period = 1), nesting(variable)) %>%
-    ggplot(aes(x = date, y = value, colour = variable)) +
+    ggplot(aes(x = date, y = value, colour = readwrite)) +
     geom_line() +
+    facet_grid(authority ~ ., scales = "free_y", space = "free_y") +
     scale_x_date(name = "", breaks = custom_breaks,
       labels = custom_labels, minor_breaks = custom_minor_breaks) +
     scale_y_continuous(name = "", labels = function(x) sprintf("%.1f Gbit/s", x),
@@ -492,7 +501,9 @@ plot_dirbytes <- function(start_p, end_p, path_p) {
         labels = c("Written dir bytes", "Read dir bytes")) +
     ggtitle("Number of bytes spent on answering directory requests") +
     labs(caption = copyright_notice) +
-    theme(legend.position = "top")
+    theme(legend.position = "top",
+          strip.text.y = element_text(angle = 0, hjust = 0),
+          strip.background = element_rect(fill = NA))
   ggsave(filename = path_p, width = 8, height = 5, dpi = 150)
 }
 
diff --git a/src/main/resources/web/json/metrics.json b/src/main/resources/web/json/metrics.json
index be40bdc..6dd7e94 100644
--- a/src/main/resources/web/json/metrics.json
+++ b/src/main/resources/web/json/metrics.json
@@ -92,7 +92,7 @@
     "id": "dirbytes",
     "title": "Bandwidth spent on answering directory requests",
     "type": "Graph",
-    "description": "<p>This graph shows the portion of <a href=\"glossary.html#bandwidth-history\">consumed bandwidth</a> that <a href=\"glossary.html#directory-mirror\">directory mirrors</a> have spent on answering directory requests.</p>",
+    "description": "<p>This graph shows the portion of <a href=\"glossary.html#bandwidth-history\">consumed bandwidth</a> that <a href=\"glossary.html#directory-authority\">directory authorities</a> and <a href=\"glossary.html#directory-mirror\">directory mirrors</a> have spent on answering directory requests.</p>",
     "function": "dirbytes",
     "parameters": [
       "start",
diff --git a/src/main/resources/web/jsps/reproducible-metrics.jsp b/src/main/resources/web/jsps/reproducible-metrics.jsp
index 0058ab6..98b9784 100644
--- a/src/main/resources/web/jsps/reproducible-metrics.jsp
+++ b/src/main/resources/web/jsps/reproducible-metrics.jsp
@@ -598,7 +598,7 @@ For both graphs we sum up all read and written bytes on a given day and divide t
 However, we only include bandwidth histories for a given day if a relay was listed as running in a consensus at least once on that day.
 We attribute bandwidth to guards and/or exits if a relay was a guard and/or exit at least in one consensus on a day.</p>
 
-<p>The third graph, <a href="/dirbytes.html">Bandwidth spent on answering directory requests</a>, shows bytes spent by <a href="/glossary.html#directory-mirror">directory mirrors</a> on answering directory requests.
+<p>The third graph, <a href="/dirbytes.html">Bandwidth spent on answering directory requests</a>, shows bytes spent by <a href="/glossary.html#directory-authority">directory authorities</a> and <a href="/glossary.html#directory-mirror">directory mirrors</a> on answering directory requests.
 As opposed to the first two graphs, all bandwidth histories are included, regardless of whether a relay was listed as running in a consensus.
 Also, we compute total read directory and total written directory bytes for this fourth graph, not an average of the two.</p>
 
diff --git a/src/main/resources/web/jsps/stats.jsp b/src/main/resources/web/jsps/stats.jsp
index 25eb239..886ec89 100644
--- a/src/main/resources/web/jsps/stats.jsp
+++ b/src/main/resources/web/jsps/stats.jsp
@@ -505,6 +505,8 @@ Traffic <a href="#traffic" name="traffic" class="anchor">#</a></h2>
 <li><b>date:</b> UTC date (YYYY-MM-DD) that relays reported bandwidth data for.</li>
 <li><b>dirread:</b> Bandwidth in Gbit/s that directory mirrors have read when serving directory data.</li>
 <li><b>dirwrite:</b> Bandwidth in Gbit/s that directory mirrors have written when serving directory data.</li>
+<li><b>dirauthread:</b> Bandwidth in Gbit/s that directory authorities have read when serving directory data.</li>
+<li><b>dirauthwrite:</b> Bandwidth in Gbit/s that directory authorities have written when serving directory data.</li>
 </ul>
 
 <h3>Fraction of connections used uni-/bidirectionally

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