[tor-commits] [metrics-web/master] Handle non-Tor versions correctly.
karsten at torproject.org
karsten at torproject.org
Tue Apr 29 08:02:10 UTC 2014
commit e509ea0220f3b59e545afba04632c731a7def7f9
Author: Karsten Loesing <karsten.loesing at gmx.net>
Date: Tue Apr 29 10:01:01 2014 +0200
Handle non-Tor versions correctly.
This patch fixes two things:
- servers.csv now contains the number of "Other" versions if a platform
string does not begin with "Tor " and
- the versions graph now contains a line for "Other" versions.
---
modules/legacy/db/tordir.sql | 4 +++-
website/rserve/graphs.R | 7 +++----
2 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/modules/legacy/db/tordir.sql b/modules/legacy/db/tordir.sql
index cd2ed6a..45b9862 100644
--- a/modules/legacy/db/tordir.sql
+++ b/modules/legacy/db/tordir.sql
@@ -496,7 +496,9 @@ CREATE OR REPLACE FUNCTION refresh_relay_versions() RETURNS INTEGER AS $$
(date, version, relays)
SELECT date, version, relays / count AS relays
FROM (
- SELECT DATE(validafter), SUBSTRING(platform, 5, 5) AS version,
+ SELECT DATE(validafter),
+ CASE WHEN platform LIKE ''Tor 0._._%'' THEN
+ SUBSTRING(platform, 5, 5) ELSE ''Other'' END AS version,
COUNT(*) AS relays
FROM descriptor RIGHT JOIN statusentry
ON descriptor.descriptor = statusentry.descriptor
diff --git a/website/rserve/graphs.R b/website/rserve/graphs.R
index b9550f4..5a130ee 100644
--- a/website/rserve/graphs.R
+++ b/website/rserve/graphs.R
@@ -369,13 +369,12 @@ plot_versions <- function(start, end, path) {
s <- read.csv(paste("/srv/metrics.torproject.org/web/shared/stats/",
"servers.csv", sep = ""), stringsAsFactors = FALSE)
s <- s[s$date >= start & s$date <= end & s$flag == '' &
- s$country == '' & s$version != '' &
- substr(s$version, 1, 2) == '0.' & s$platform == '' &
+ s$country == '' & s$version != '' & s$platform == '' &
s$ec2bridge == '', ]
s <- data.frame(date = as.Date(s$date, "%Y-%m-%d"), version = s$version,
relays = s$relays)
- known_versions <- c("0.1.0", "0.1.1", "0.1.2", "0.2.0", "0.2.1",
- "0.2.2", "0.2.3", "0.2.4", "0.2.5")
+ known_versions <- c("Other", "0.1.0", "0.1.1", "0.1.2", "0.2.0",
+ "0.2.1", "0.2.2", "0.2.3", "0.2.4", "0.2.5")
colours <- data.frame(breaks = known_versions,
values = brewer.pal(length(known_versions), "Paired"),
stringsAsFactors = FALSE)
More information about the tor-commits
mailing list