commit cba1711544fbfea9e88ba4161f94b26231b28d5f Author: Karsten Loesing karsten.loesing@gmx.net Date: Wed Oct 2 12:24:38 2019 +0200
Add "Tor Browser updates by release channel" graph.
Implements #31755. --- src/main/R/rserver/rserve-init.R | 46 ++++++++++++++++++++++ src/main/resources/web.xml | 4 ++ src/main/resources/web/json/categories.json | 1 + src/main/resources/web/json/metrics.json | 11 ++++++ .../resources/web/jsps/reproducible-metrics.jsp | 1 + src/main/resources/web/jsps/stats.jsp | 22 +++++++++++ 6 files changed, 85 insertions(+)
diff --git a/src/main/R/rserver/rserve-init.R b/src/main/R/rserver/rserve-init.R index af74ef7..5eac4d7 100644 --- a/src/main/R/rserver/rserve-init.R +++ b/src/main/R/rserver/rserve-init.R @@ -1399,6 +1399,52 @@ plot_webstats_tb_locale <- function(start_p, end_p, path_p) { ggsave(filename = path_p, width = 8, height = 5, dpi = 150) }
+prepare_webstats_tb_channel <- function(start_p = NULL, end_p = NULL) { + read_csv(file = paste(stats_dir, "webstats.csv", sep = ""), + col_types = cols( + log_date = col_date(format = ""), + request_type = col_factor(levels = NULL), + platform = col_skip(), + channel = col_factor(levels = NULL), + locale = col_skip(), + incremental = col_skip(), + count = col_double())) %>% + filter(if (!is.null(start_p)) log_date >= as.Date(start_p) else TRUE) %>% + filter(if (!is.null(end_p)) log_date <= as.Date(end_p) else TRUE) %>% + filter(request_type %in% c("tbup", "tbur")) %>% + filter(channel %in% c("a", "r")) %>% + group_by(log_date, channel, request_type) %>% + summarize(count = sum(count)) %>% + dcast(log_date + channel ~ request_type, value.var = "count") %>% + rename(date = log_date, update_pings = tbup, update_requests = tbur) +} + +plot_webstats_tb_channel <- function(start_p, end_p, path_p) { + prepare_webstats_tb_channel(start_p, end_p) %>% + gather(request_type, count, -c(date, channel)) %>% + unite("request_type_channel", request_type, channel) %>% + mutate(request_type_channel = factor(request_type_channel, + levels = c("update_pings_r", "update_pings_a", + "update_requests_r", "update_requests_a"), + labels = c("Update pings (stable)", "Update pings (alpha)", + "Update requests (stable)", "Update requests (alpha)"))) %>% + ungroup() %>% + complete(date = full_seq(date, period = 1), + nesting(request_type_channel)) %>% + ggplot(aes(x = date, y = count)) + + geom_point() + + geom_line() + + scale_x_date(name = "", breaks = custom_breaks, + labels = custom_labels, minor_breaks = custom_minor_breaks) + + scale_y_continuous(name = "", labels = formatter, limits = c(0, NA)) + + facet_grid(request_type_channel ~ ., scales = "free_y") + + theme(strip.text.y = element_text(angle = 0, hjust = 0, size = rel(1.5)), + strip.background = element_rect(fill = NA)) + + ggtitle("Tor Browser updates by release channel") + + labs(caption = copyright_notice) + ggsave(filename = path_p, width = 8, height = 5, dpi = 150) +} + prepare_webstats_tm <- function(start_p = NULL, end_p = NULL) { read_csv(file = paste(stats_dir, "webstats.csv", sep = ""), col_types = cols( diff --git a/src/main/resources/web.xml b/src/main/resources/web.xml index 2c68fd7..10d12ee 100644 --- a/src/main/resources/web.xml +++ b/src/main/resources/web.xml @@ -51,6 +51,7 @@ <url-pattern>/webstats-tb.html</url-pattern> <url-pattern>/webstats-tb-platform.html</url-pattern> <url-pattern>/webstats-tb-locale.html</url-pattern> + <url-pattern>/webstats-tb-channel.html</url-pattern> <url-pattern>/webstats-tm.html</url-pattern> <url-pattern>/relays-ipv6.html</url-pattern> <url-pattern>/bridges-ipv6.html</url-pattern> @@ -182,6 +183,9 @@ <url-pattern>/webstats-tb-locale.png</url-pattern> <url-pattern>/webstats-tb-locale.pdf</url-pattern> <url-pattern>/webstats-tb-locale.csv</url-pattern> + <url-pattern>/webstats-tb-channel.png</url-pattern> + <url-pattern>/webstats-tb-channel.pdf</url-pattern> + <url-pattern>/webstats-tb-channel.csv</url-pattern> <url-pattern>/webstats-tm.png</url-pattern> <url-pattern>/webstats-tm.pdf</url-pattern> <url-pattern>/webstats-tm.csv</url-pattern> diff --git a/src/main/resources/web/json/categories.json b/src/main/resources/web/json/categories.json index 89742bc..3771631 100644 --- a/src/main/resources/web/json/categories.json +++ b/src/main/resources/web/json/categories.json @@ -88,6 +88,7 @@ "webstats-tb", "webstats-tb-platform", "webstats-tb-locale", + "webstats-tb-channel", "webstats-tm" ] } diff --git a/src/main/resources/web/json/metrics.json b/src/main/resources/web/json/metrics.json index e6bab04..54ce78b 100644 --- a/src/main/resources/web/json/metrics.json +++ b/src/main/resources/web/json/metrics.json @@ -416,6 +416,17 @@ ] }, { + "id": "webstats-tb-channel", + "title": "Tor Browser updates by release channel", + "type": "Graph", + "description": "<p>This graph shows absolute numbers of requests to Tor's web servers made by Tor Browser to check whether a newer version is available or to download a newer version, broken down by release channel.</p>", + "function": "webstats_tb_channel", + "parameters": [ + "start", + "end" + ] + }, + { "id": "webstats-tm", "title": "Tor Messenger downloads and updates", "type": "Graph", diff --git a/src/main/resources/web/jsps/reproducible-metrics.jsp b/src/main/resources/web/jsps/reproducible-metrics.jsp index d6e7d0e..9b21aa7 100644 --- a/src/main/resources/web/jsps/reproducible-metrics.jsp +++ b/src/main/resources/web/jsps/reproducible-metrics.jsp @@ -803,6 +803,7 @@ Applications <a href="#applications" name="applications" class="anchor">#</a></h <li>Tor Browser downloads and updates <a href="/webstats-tb.html" class="btn btn-primary btn-xs"><i class="fa fa-chevron-right" aria-hidden="true"></i> graph</a></li> <li>Tor Browser downloads and updates by platform <a href="/webstats-tb-platform.html" class="btn btn-primary btn-xs"><i class="fa fa-chevron-right" aria-hidden="true"></i> graph</a></li> <li>Tor Browser downloads and updates by locale <a href="/webstats-tb-locale.html" class="btn btn-primary btn-xs"><i class="fa fa-chevron-right" aria-hidden="true"></i> graph</a></li> +<li>Tor Browser updates by release channel <a href="/webstats-tb-channel.html" class="btn btn-primary btn-xs"><i class="fa fa-chevron-right" aria-hidden="true"></i> graph</a></li> <li>Tor Messenger downloads and updates <a href="/webstats-tm.html" class="btn btn-primary btn-xs"><i class="fa fa-chevron-right" aria-hidden="true"></i> graph</a></li> </ul>
diff --git a/src/main/resources/web/jsps/stats.jsp b/src/main/resources/web/jsps/stats.jsp index eac75e3..3ce295d 100644 --- a/src/main/resources/web/jsps/stats.jsp +++ b/src/main/resources/web/jsps/stats.jsp @@ -53,6 +53,7 @@ https://metrics.torproject.org/identifier.csv <li><b>May 29, 2019:</b> Extended <a href="#onionperf-latencies">Circuit round-trip latencies</a> graph to contain high/low values.</li> <li><b>June 2, 2019:</b> Added <a href="#onionperf-throughput">Throughput</a> graph.</li> <li><b>August 5, 2019:</b> Re-added the <a href="#bandwidth">Total relay bandwidth</a> graph due to popular demand.</li> +<li><b>October 2, 2019:</b> Added <a href="#webstats-tb-channel">Tor Browser updates by release channel</a> graph.</li> </ul>
</div> @@ -735,6 +736,27 @@ Applications <a href="#applications" name="applications" class="anchor">#</a></h <li><b>update_pings:</b> Number of Tor Browser update pings.</li> </ul>
+<h3>Tor Browser updates by release channel +<a href="/webstats-tb-channel.html" class="btn btn-primary btn-xs"><i class="fa fa-chevron-right" aria-hidden="true"></i> graph</a> +<a href="/webstats-tb-channel.csv" class="btn btn-primary btn-xs"><i class="fa fa-chevron-right" aria-hidden="true"></i> data</a> +<a href="#webstats-tb-channel" name="webstats-tb-channel" class="anchor">#</a></h3> + +<h4>Parameters</h4> + +<ul> +<li><b>start:</b> First UTC date (YYYY-MM-DD) to include in the file.</li> +<li><b>end:</b> Last UTC date (YYYY-MM-DD) to include in the file.</li> +</ul> + +<h4>Columns</h4> + +<ul> +<li><b>date:</b> UTC date (YYYY-MM-DD) when requests to <code>torproject.org</code> web servers have been logged.</li> +<li><b>channel:</b> Release channel, like "r" for stable releases and "a" for alpha releases.</li> +<li><b>update_pings:</b> Number of Tor Browser update pings.</li> +<li><b>update_requests:</b> Number of Tor Browser update requests.</li> +</ul> + <h3>Tor Messenger downloads and updates <a href="/webstats-tm.html" class="btn btn-primary btn-xs"><i class="fa fa-chevron-right" aria-hidden="true"></i> graph</a> <a href="/webstats-tm.csv" class="btn btn-primary btn-xs"><i class="fa fa-chevron-right" aria-hidden="true"></i> data</a>
tor-commits@lists.torproject.org