commit 4ea56ba80d54d8a34a994181ecb715c544654162 Author: Karsten Loesing karsten.loesing@gmx.net Date: Tue Mar 17 10:28:56 2015 +0100
Add two hidserv-stats graphs.
Implements (part of?) #15273. --- website/etc/web.xml | 8 +++ website/rserve/graphs.R | 51 +++++++++++++++ .../org/torproject/metrics/web/IndexServlet.java | 6 ++ .../metrics/web/graphs/GraphsSubpagesServlet.java | 4 ++ .../metrics/web/graphs/RObjectGenerator.java | 4 ++ website/web/WEB-INF/hidserv-data.jsp | 3 +- website/web/WEB-INF/hidserv-dir-onions-seen.jsp | 3 +- website/web/WEB-INF/hidserv-frac-reporting.jsp | 66 +++++++++++++++++++ website/web/WEB-INF/hidserv-rend-relayed-cells.jsp | 68 ++++++++++++++++++++ 9 files changed, 211 insertions(+), 2 deletions(-)
diff --git a/website/etc/web.xml b/website/etc/web.xml index 09c0a8b..1cb3381 100644 --- a/website/etc/web.xml +++ b/website/etc/web.xml @@ -66,6 +66,8 @@ <url-pattern>/connbidirect-data.html</url-pattern> <url-pattern>/hidserv-data.html</url-pattern> <url-pattern>/hidserv-dir-onions-seen.html</url-pattern> + <url-pattern>/hidserv-rend-relayed-cells.html</url-pattern> + <url-pattern>/hidserv-frac-reporting.html</url-pattern> </servlet-mapping>
<servlet> @@ -250,6 +252,12 @@ <url-pattern>/hidserv-dir-onions-seen.png</url-pattern> <url-pattern>/hidserv-dir-onions-seen.pdf</url-pattern> <url-pattern>/hidserv-dir-onions-seen.svg</url-pattern> + <url-pattern>/hidserv-rend-relayed-cells.png</url-pattern> + <url-pattern>/hidserv-rend-relayed-cells.pdf</url-pattern> + <url-pattern>/hidserv-rend-relayed-cells.svg</url-pattern> + <url-pattern>/hidserv-frac-reporting.png</url-pattern> + <url-pattern>/hidserv-frac-reporting.pdf</url-pattern> + <url-pattern>/hidserv-frac-reporting.svg</url-pattern> </servlet-mapping>
<servlet> diff --git a/website/rserve/graphs.R b/website/rserve/graphs.R index 7f68854..63946fe 100644 --- a/website/rserve/graphs.R +++ b/website/rserve/graphs.R @@ -1010,3 +1010,54 @@ plot_hidserv_dir_onions_seen <- function(start, end, path) { ggsave(filename = path, width = 8, height = 5, dpi = 72) }
+plot_hidserv_rend_relayed_cells <- function(start, end, path) { + end <- min(end, as.character(Sys.Date() - 2)) + h <- read.csv(paste("/srv/metrics.torproject.org/web/shared/stats/", + "hidserv.csv", sep = ""), stringsAsFactors = FALSE) + h <- h[h$date >= start & h$date <= end & + h$type == "rend-relayed-cells", ] + h <- rbind(data.frame(date = NA, wiqm = 0), + data.frame(date = as.Date(h$date, "%Y-%m-%d"), + wiqm = ifelse(h$frac >= 0.01, h$wiqm, NA))) + date_breaks <- date_breaks(as.numeric(max(h$date, na.rm = TRUE) + - min(h$date, na.rm = TRUE))) + ggplot(h, aes(x = date, y = wiqm * 8 * 512 / (86400 * 1e6))) + + geom_line(size = 0.75) + + scale_x_date(name = paste("\nThe Tor Project - ", + "https://metrics.torproject.org/", sep = ""), + format = date_breaks$format, major = date_breaks$major, + minor = date_breaks$minor) + + scale_y_continuous(name = "") + + opts(title = "Hidden-service traffic in Mbit/s\n") + ggsave(filename = path, width = 8, height = 5, dpi = 72) +} + +plot_hidserv_frac_reporting <- function(start, end, path) { + end <- min(end, as.character(Sys.Date() - 2)) + h <- read.csv(paste("/srv/metrics.torproject.org/web/shared/stats/", + "hidserv.csv", sep = ""), stringsAsFactors = FALSE) + h <- h[h$date >= start & h$date <= end, ] + h <- rbind(data.frame(date = NA, frac = 0, + type = c("rend-relayed-cells", + "dir-onions-seen")), + data.frame(date = as.Date(h$date, "%Y-%m-%d"), + frac = h$frac, type = h$type)) + date_breaks <- date_breaks(as.numeric(max(h$date, na.rm = TRUE) + - min(h$date, na.rm = TRUE))) + ggplot(h, aes(x = date, y = frac, colour = type)) + + geom_line(size = 0.75) + + geom_hline(yintercept = 0.01, linetype = 2) + + scale_x_date(name = paste("\nThe Tor Project - ", + "https://metrics.torproject.org/", sep = ""), + format = date_breaks$format, major = date_breaks$major, + minor = date_breaks$minor) + + scale_y_continuous(name = "", formatter = "percent") + + scale_colour_hue(name = "", + breaks = c("rend-relayed-cells", "dir-onions-seen"), + labels = c("Hidden-service traffic", + "Unique .onion addresses")) + + opts(title = paste("Fraction of relays reporting hidden-service", + "statistics"), legend.position = "top") + ggsave(filename = path, width = 8, height = 5, dpi = 72) +} + diff --git a/website/src/org/torproject/metrics/web/IndexServlet.java b/website/src/org/torproject/metrics/web/IndexServlet.java index 7b2c91c..4a3e47c 100644 --- a/website/src/org/torproject/metrics/web/IndexServlet.java +++ b/website/src/org/torproject/metrics/web/IndexServlet.java @@ -154,6 +154,12 @@ public class IndexServlet extends HttpServlet { availableMetrics.add(new Metric("hidserv-dir-onions-seen.html", "Unique .onion addresses", new String[] { "Hidden services" }, "Graph", "Basic")); + availableMetrics.add(new Metric("hidserv-rend-relayed-cells.html", + "Hidden-service traffic", new String[] { "Hidden services" }, + "Graph", "Basic")); + availableMetrics.add(new Metric("hidserv-frac-reporting.html", + "Fraction of relays reporting hidden-service statistics", + new String[] { "Hidden services" }, "Graph", "Advanced")); availableMetrics.add(new Metric("hidserv-data.html", "Hidden-service statistics", new String[] { "Hidden services" }, "Data", "Advanced")); diff --git a/website/src/org/torproject/metrics/web/graphs/GraphsSubpagesServlet.java b/website/src/org/torproject/metrics/web/graphs/GraphsSubpagesServlet.java index 0333f4d..c2033d5 100644 --- a/website/src/org/torproject/metrics/web/graphs/GraphsSubpagesServlet.java +++ b/website/src/org/torproject/metrics/web/graphs/GraphsSubpagesServlet.java @@ -94,6 +94,10 @@ public class GraphsSubpagesServlet extends HttpServlet { "WEB-INF/hidserv-data.jsp"); this.availableGraphsSubpages.put("hidserv-dir-onions-seen.html", "WEB-INF/hidserv-dir-onions-seen.jsp"); + this.availableGraphsSubpages.put("hidserv-rend-relayed-cells.html", + "WEB-INF/hidserv-rend-relayed-cells.jsp"); + this.availableGraphsSubpages.put("hidserv-frac-reporting.html", + "WEB-INF/hidserv-frac-reporting.jsp");
this.availableGraphsSubpageTables = new HashMap<String, String>(); this.availableGraphsSubpageTables.put("userstats-relay-table.html", diff --git a/website/src/org/torproject/metrics/web/graphs/RObjectGenerator.java b/website/src/org/torproject/metrics/web/graphs/RObjectGenerator.java index b598192..f0fb0f5 100644 --- a/website/src/org/torproject/metrics/web/graphs/RObjectGenerator.java +++ b/website/src/org/torproject/metrics/web/graphs/RObjectGenerator.java @@ -88,6 +88,10 @@ public class RObjectGenerator implements ServletContextListener { this.availableGraphs.put("advbwdist-relay", "start,end,n,filename"); this.availableGraphs.put("hidserv-dir-onions-seen", "start,end,filename"); + this.availableGraphs.put("hidserv-rend-relayed-cells", + "start,end,filename"); + this.availableGraphs.put("hidserv-frac-reporting", + "start,end,filename");
this.availableGraphFileTypes = new HashSet<String>(Arrays.asList( "png,pdf,svg".split(","))); diff --git a/website/web/WEB-INF/hidserv-data.jsp b/website/web/WEB-INF/hidserv-data.jsp index ef31f86..f8ccdf2 100644 --- a/website/web/WEB-INF/hidserv-data.jsp +++ b/website/web/WEB-INF/hidserv-data.jsp @@ -52,7 +52,8 @@ network fraction.</li> <h4>Related metrics</h4> <ul> <li><a href="hidserv-dir-onions-seen.html">Graph: Unique .onion addresses</a></li> -<li><a href="relayflags.html">Graph: Relays with Exit, Fast, Guard, Stable, and HSDir flags</a></li> +<li><a href="hidserv-rend-relayed-cells.html">Graph: Hidden-service traffic</a></li> +<li><a href="hidserv-frac-reporting.html">Graph: Fraction of relays reporting hidden-service statistics</a></li> </ul>
</div> diff --git a/website/web/WEB-INF/hidserv-dir-onions-seen.jsp b/website/web/WEB-INF/hidserv-dir-onions-seen.jsp index ebab737..6983538 100644 --- a/website/web/WEB-INF/hidserv-dir-onions-seen.jsp +++ b/website/web/WEB-INF/hidserv-dir-onions-seen.jsp @@ -52,7 +52,8 @@ technical report</a>.</p>
<h4>Related metrics</h4> <ul> -<li><a href="relayflags.html">Graph: Relays with Exit, Fast, Guard, Stable, and HSDir flags</a></li> +<li><a href="hidserv-rend-relayed-cells.html">Graph: Hidden-service traffic</a></li> +<li><a href="hidserv-frac-reporting.html">Graph: Fraction of relays reporting hidden-service statistics</a></li> <li><a href="hidserv-data.html">Data: Hidden-service statistics</a></li> </ul>
diff --git a/website/web/WEB-INF/hidserv-frac-reporting.jsp b/website/web/WEB-INF/hidserv-frac-reporting.jsp new file mode 100644 index 0000000..d1cc30d --- /dev/null +++ b/website/web/WEB-INF/hidserv-frac-reporting.jsp @@ -0,0 +1,66 @@ +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> +<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> +<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> +<html> +<head> + <title>Tor Metrics — Fraction of relays reporting hidden-service statistics</title> + <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1"> + <link href="/css/stylesheet-ltr.css" type="text/css" rel="stylesheet"> + <link href="/images/favicon.ico" type="image/x-icon" rel="shortcut icon"> +</head> +<body> + <div class="center"> + <%@ include file="banner.jsp"%> + <div class="main-column"> + +<h2><a href="/">Tor Metrics</a> — Fraction of relays reporting hidden-service statistics</h2> +<br> +<p>The following graph shows the fraction of +<a href="about.html#relay">relays</a> that report statistics on +<a href="about.html#hidden-service">hidden service</a> usage. +If at least 1% of relays report a statistic, it gets extrapolated towards +a network total, where higher fractions are produce more accurate results. +For more details on the extrapolation algorithm, see <a +href="https://blog.torproject.org/blog/some-statistics-about-onions%22%3Ethis +blog post</a> and <a +href="https://research.torproject.org/techreports/extrapolating-hidserv-stats-2015... +technical report</a>.</p> + +<img src="hidserv-frac-reporting.png${hidserv_frac_reporting_url}" + width="576" height="360" alt="Fraction of relays reporting hidden-service statistics graph"> +<form action="hidserv-frac-reporting.html"> + <div class="formrow"> + <input type="hidden" name="graph" value="hidserv-frac-reporting"> + <p> + <label>Start date (yyyy-mm-dd):</label> + <input type="text" name="start" size="10" + value="<c:choose><c:when test="${fn:length(hidserv_frac_reporting_start) == 0}">${default_start_date}</c:when><c:otherwise>${hidserv_frac_reporting_start[0]}</c:otherwise></c:choose>"> + <label>End date (yyyy-mm-dd):</label> + <input type="text" name="end" size="10" + value="<c:choose><c:when test="${fn:length(hidserv_frac_reporting_end) == 0}">${default_end_date}</c:when><c:otherwise>${hidserv_frac_reporting_end[0]}</c:otherwise></c:choose>"> + </p><p> + <input class="submit" type="submit" value="Update graph"> + </p> + </div> +</form> +<p>Download graph as +<a href="hidserv-frac-reporting.pdf${hidserv_frac_reporting_url}">PDF</a> or +<a href="hidserv-frac-reporting.svg${hidserv_frac_reporting_url}">SVG</a>.</p> +<br> + +<h4>Related metrics</h4> +<ul> +<li><a href="hidserv-dir-onions-seen.html">Graph: Unique .onion addresses</a></li> +<li><a href="hidserv-rend-relayed-cells.html">Graph: Hidden-service traffic</a></li> +<li><a href="hidserv-data.html">Data: Hidden-service statistics</a></li> +</ul> + + </div> + </div> + <div class="bottom" id="bottom"> + <%@ include file="footer.jsp"%> + </div> +</body> +</html> + diff --git a/website/web/WEB-INF/hidserv-rend-relayed-cells.jsp b/website/web/WEB-INF/hidserv-rend-relayed-cells.jsp new file mode 100644 index 0000000..7c7f89a --- /dev/null +++ b/website/web/WEB-INF/hidserv-rend-relayed-cells.jsp @@ -0,0 +1,68 @@ +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> +<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> +<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> +<html> +<head> + <title>Tor Metrics — Hidden-service traffic</title> + <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1"> + <link href="/css/stylesheet-ltr.css" type="text/css" rel="stylesheet"> + <link href="/images/favicon.ico" type="image/x-icon" rel="shortcut icon"> +</head> +<body> + <div class="center"> + <%@ include file="banner.jsp"%> + <div class="main-column"> + +<h2><a href="/">Tor Metrics</a> — Hidden-service traffic</h2> +<br> +<p>The following graph shows the amount of hidden-service traffic in the +network per day. +This number is extrapolated from aggregated statistics on hidden-service +traffic reported by single <a href="about.html#relay">relays</a> +acting as rendezvous points for +<a href="about.html#hidden-service">hidden services</a>, if at least 1% of +relays reported these statistics. +For more details on the extrapolation algorithm, see <a +href="https://blog.torproject.org/blog/some-statistics-about-onions%22%3Ethis +blog post</a> and <a +href="https://research.torproject.org/techreports/extrapolating-hidserv-stats-2015... +technical report</a>.</p> + +<img src="hidserv-rend-relayed-cells.png${hidserv_rend_relayed_cells_url}" + width="576" height="360" alt="Hidden-service traffic graph"> +<form action="hidserv-rend-relayed-cells.html"> + <div class="formrow"> + <input type="hidden" name="graph" value="hidserv-rend-relayed-cells"> + <p> + <label>Start date (yyyy-mm-dd):</label> + <input type="text" name="start" size="10" + value="<c:choose><c:when test="${fn:length(hidserv_rend_relayed_cells_start) == 0}">${default_start_date}</c:when><c:otherwise>${hidserv_rend_relayed_cells_start[0]}</c:otherwise></c:choose>"> + <label>End date (yyyy-mm-dd):</label> + <input type="text" name="end" size="10" + value="<c:choose><c:when test="${fn:length(hidserv_rend_relayed_cells_end) == 0}">${default_end_date}</c:when><c:otherwise>${hidserv_rend_relayed_cells_end[0]}</c:otherwise></c:choose>"> + </p><p> + <input class="submit" type="submit" value="Update graph"> + </p> + </div> +</form> +<p>Download graph as +<a href="hidserv-rend-relayed-cells.pdf${hidserv_rend_relayed_cells_url}">PDF</a> or +<a href="hidserv-rend-relayed-cells.svg${hidserv_rend_relayed_cells_url}">SVG</a>.</p> +<br> + +<h4>Related metrics</h4> +<ul> +<li><a href="hidserv-dir-onions-seen.html">Graph: Unique .onion addresses</a></li> +<li><a href="hidserv-frac-reporting.html">Graph: Fraction of relays reporting hidden-service statistics</a></li> +<li><a href="hidserv-data.html">Data: Hidden-service statistics</a></li> +</ul> + + </div> + </div> + <div class="bottom" id="bottom"> + <%@ include file="footer.jsp"%> + </div> +</body> +</html> +