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

[tor-commits] [metrics-web/master] Discontinue routerdetail{.html|.png}.



commit 9d86250bd5bde0301ed26a6ea805cb5682f08cf6
Author: Karsten Loesing <karsten.loesing@xxxxxxx>
Date:   Mon Feb 27 10:06:15 2012 +0100

    Discontinue routerdetail{.html|.png}.
    
    This page and graph were only linked from networkstatus.html which is now
    discontinued, too.
---
 rserve/graphs.R                                    |   32 ------
 .../ernie/web/GraphParameterChecker.java           |    1 -
 .../torproject/ernie/web/RouterDetailServlet.java  |  117 --------------------
 web/WEB-INF/routerdetail.jsp                       |   86 +--------------
 4 files changed, 2 insertions(+), 234 deletions(-)

diff --git a/rserve/graphs.R b/rserve/graphs.R
index 2900c02..61c12f7 100644
--- a/rserve/graphs.R
+++ b/rserve/graphs.R
@@ -899,35 +899,3 @@ plot_connbidirect <- function(start, end, path, dpi) {
   ggsave(filename = path, width = 8, height = 5, dpi = as.numeric(dpi))
 }
 
-## TODO The bandwidth history shouldn't be based on the consensus weights
-## which aren't bandwidths anymore, but either on the advertised bandwidth
-## contained in server descriptors or better on the bandwidth history
-## reported in extra-info descriptors.
-plot_routerdetail <- function(fingerprint, path) {
-  drv <- dbDriver("PostgreSQL")
-  con <- dbConnect(drv, user = dbuser, password = dbpassword, dbname = db)
-  q <- paste("SELECT AVG(bandwidth)::INTEGER AS bw, ",
-      "DATE(validafter) AS date ",
-      "FROM statusentry WHERE fingerprint = '", fingerprint, "' ",
-      "AND validafter > CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - ",
-      "interval '1 week' GROUP BY DATE(validafter)", sep = "")
-  rs <- dbSendQuery(con, q)
-  routerdetail <- fetch(rs, n = -1)
-  ## TODO We should add NA's for missing dates.
-  dbDisconnect(con)
-  dbUnloadDriver(drv)
-  date_breaks <- date_breaks(
-    as.numeric(max(as.Date(routerdetail$date, "%Y-%m-%d")) -
-    min(as.Date(routerdetail$date, "%Y-%m-%d"))))
-  ggplot(routerdetail, aes(x = as.Date(date, "%Y-%m-%d"), y = bw)) +
-    geom_line(size = 1) +
-    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 = paste("Bandwidth history for ", fingerprint, "\n",
-        sep = ""))
-  ggsave(filename = path, width = 8, height = 5, dpi = 72)
-}
-
diff --git a/src/org/torproject/ernie/web/GraphParameterChecker.java b/src/org/torproject/ernie/web/GraphParameterChecker.java
index 81091e4..09a4f34 100644
--- a/src/org/torproject/ernie/web/GraphParameterChecker.java
+++ b/src/org/torproject/ernie/web/GraphParameterChecker.java
@@ -59,7 +59,6 @@ public class GraphParameterChecker {
     this.availableGraphs.put("torperf-failures",
          "start,end,source,filesize,filename,dpi");
     this.availableGraphs.put("connbidirect", "start,end,filename,dpi");
-    this.availableGraphs.put("routerdetail", "fingerprint,filename");
 
     this.knownParameterValues = new HashMap<String, String>();
     this.knownParameterValues.put("flag",
diff --git a/src/org/torproject/ernie/web/RouterDetailServlet.java b/src/org/torproject/ernie/web/RouterDetailServlet.java
index 677c293..5d71a5a 100644
--- a/src/org/torproject/ernie/web/RouterDetailServlet.java
+++ b/src/org/torproject/ernie/web/RouterDetailServlet.java
@@ -1,134 +1,17 @@
 package org.torproject.ernie.web;
 
 import java.io.*;
-import java.sql.*;
-import java.text.*;
-import java.util.*;
-import java.util.logging.*;
-import java.util.regex.*;
 
-import javax.naming.*;
 import javax.servlet.*;
 import javax.servlet.http.*;
-import javax.sql.*;
 
 import org.apache.commons.lang.time.*;
 
 public class RouterDetailServlet extends HttpServlet {
 
-  private DataSource ds;
-
-  private Logger logger;
-
-  private Pattern fingerprintPattern;
-
-  public void init() {
-
-    /* Initialize logger. */
-    this.logger = Logger.getLogger(RouterDetailServlet.class.toString());
-
-    /* Look up data source. */
-    try {
-      Context cxt = new InitialContext();
-      this.ds = (DataSource) cxt.lookup("java:comp/env/jdbc/tordir");
-      this.logger.info("Successfully looked up data source.");
-    } catch (NamingException e) {
-      this.logger.log(Level.WARNING, "Could not look up data source", e);
-    }
-
-    /* Initialize fingerprint pattern. */
-    this.fingerprintPattern = Pattern.compile("^[0-9a-f]{40}$");
-  }
-
   public void doGet(HttpServletRequest request,
       HttpServletResponse response) throws IOException, ServletException {
 
-    /* Check that we were given a valid fingerprint. */
-    String fingerprintParameter = request.getParameter("fingerprint");
-    if (fingerprintParameter != null) {
-      fingerprintParameter = fingerprintParameter.toLowerCase();
-    }
-    if (fingerprintParameter == null ||
-        fingerprintParameter.length() != 40 ||
-        !fingerprintPattern.matcher(fingerprintParameter).matches()) {
-      response.sendError(HttpServletResponse.SC_BAD_REQUEST);
-      return;
-    }
-
-    String query = "SELECT statusentry.validafter, statusentry.nickname, "
-        + "statusentry.fingerprint, statusentry.descriptor, "
-        + "statusentry.published, statusentry.address, "
-        + "statusentry.orport, statusentry.dirport, "
-        + "statusentry.isauthority, statusentry.isbadexit, "
-        + "statusentry.isbaddirectory, statusentry.isexit, "
-        + "statusentry.isfast, statusentry.isguard, statusentry.ishsdir, "
-        + "statusentry.isnamed, statusentry.isstable, "
-        + "statusentry.isrunning, statusentry.isunnamed, "
-        + "statusentry.isvalid, statusentry.isv2dir, "
-        + "statusentry.isv3dir, statusentry.version, "
-        + "statusentry.bandwidth, statusentry.ports, "
-        + "descriptor.uptime, descriptor.platform, descriptor.rawdesc "
-        + "FROM statusentry JOIN descriptor "
-        + "ON descriptor.descriptor = statusentry.descriptor "
-        + "WHERE statusentry.validafter = "
-        + "(SELECT MAX(validafter) FROM consensus) "
-        + "AND statusentry.fingerprint = ?";
-
-    try {
-      long requestedConnection = System.currentTimeMillis();
-      Connection conn = this.ds.getConnection();
-      PreparedStatement ps = conn.prepareStatement(query);
-      ps.setString(1, fingerprintParameter);
-      ResultSet rs = ps.executeQuery();
-      if (rs.next()) {
-        request.setAttribute("validafter", rs.getTimestamp(1));
-        request.setAttribute("nickname", rs.getString(2));
-        request.setAttribute("fingerprint", rs.getString(3));
-        request.setAttribute("descriptor", rs.getString(4));
-        request.setAttribute("published", rs.getTimestamp(5));
-        request.setAttribute("address", rs.getString(6));
-        request.setAttribute("orport", rs.getInt(7));
-        request.setAttribute("dirport", rs.getInt(8));
-        request.setAttribute("isauthority", rs.getBoolean(9));
-        request.setAttribute("isbadexit", rs.getBoolean(10));
-        request.setAttribute("isbaddirectory", rs.getBoolean(11));
-        request.setAttribute("isexit", rs.getBoolean(12));
-        request.setAttribute("isfast", rs.getBoolean(13));
-        request.setAttribute("isguard", rs.getBoolean(14));
-        request.setAttribute("ishsdir", rs.getBoolean(15));
-        request.setAttribute("isnamed", rs.getBoolean(16));
-        request.setAttribute("isstable", rs.getBoolean(17));
-        request.setAttribute("isrunning", rs.getBoolean(18));
-        request.setAttribute("isunnamed", rs.getBoolean(19));
-        request.setAttribute("isvalid", rs.getBoolean(20));
-        request.setAttribute("isv2dir", rs.getBoolean(21));
-        request.setAttribute("isv3dir", rs.getBoolean(22));
-        request.setAttribute("version", rs.getString(23));
-        request.setAttribute("bandwidth", rs.getBigDecimal(24));
-        request.setAttribute("ports", rs.getString(25));
-        request.setAttribute("uptime", DurationFormatUtils.formatDuration(
-            rs.getBigDecimal(26).longValue() * 1000L, "d'd' HH:mm:ss"));
-        request.setAttribute("platform", rs.getString(27));
-      } else {
-        /* There were zero results in the set */
-        /* TODO Handle this case in a more user-friendly way. */
-        response.sendError(HttpServletResponse.SC_BAD_REQUEST);
-        this.logger.log(Level.WARNING, "Query with fingerprint = '"
-            + fingerprintParameter + "' returned zero results.  "
-            + "Returned BAD_REQUEST.");
-        return;
-      }
-      conn.close();
-      this.logger.info("Returned a database connection to the pool after "
-          + (System.currentTimeMillis() - requestedConnection)
-          + " millis.");
-
-    } catch (SQLException e)  {
-      response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
-      this.logger.log(Level.WARNING, "Database error", e);
-      return;
-    }
-
     /* Forward the request to the JSP. */
     request.getRequestDispatcher("WEB-INF/routerdetail.jsp").forward(
         request, response);
diff --git a/web/WEB-INF/routerdetail.jsp b/web/WEB-INF/routerdetail.jsp
index 42fff88..416285d 100644
--- a/web/WEB-INF/routerdetail.jsp
+++ b/web/WEB-INF/routerdetail.jsp
@@ -12,90 +12,8 @@
     <%@ include file="banner.jsp"%>
     <div class="main-column">
       <h2>Tor Metrics Portal: Router Detail</h2>
-      <table>
-        <tr>
-         <td>validafter</td><td>${validafter}</td>
-        </tr>
-        <tr>
-         <td>nickname</td><td>${nickname}</td>
-        </tr>
-        <tr>
-         <td>bandwidth</td><td>${bandwidth}</td>
-        </tr>
-        <tr>
-         <td>fingerprint</td><td>${fingerprint}</td>
-        </tr>
-        <tr>
-         <td>published</td><td>${published}</td>
-        </tr>
-        <tr>
-         <td>address</td><td>${address}</td>
-        </tr>
-        <tr>
-         <td>uptime</td><td>${uptime}</td>
-        </tr>
-        <tr>
-         <td>orport</td><td>${orport}</td>
-        </tr>
-        <tr>
-         <td>dirport</td><td>${dirport}</td>
-        </tr>
-        <tr>
-         <td>isauthority</td><td>${isauthority}</td>
-        </tr>
-        <tr>
-         <td>isbadexit</td><td>${isbadexit}</td>
-        </tr>
-        <tr>
-         <td>isbaddirectory</td><td>${isbaddirectory}</td>
-        </tr>
-        <tr>
-         <td>isexit</td><td>${isexit}</td>
-        </tr>
-        <tr>
-         <td>isfast</td><td>${isfast}</td>
-        </tr>
-        <tr>
-         <td>isguard</td><td>${isguard}</td>
-        </tr>
-        <tr>
-         <td>ishsdir</td><td>${ishsdir}</td>
-        </tr>
-        <tr>
-         <td>isnamed</td><td>${isnamed}</td>
-        </tr>
-        <tr>
-         <td>isstable</td><td>${isstable}</td>
-        </tr>
-        <tr>
-         <td>isrunning</td><td>${isrunning}</td>
-        </tr>
-        <tr>
-         <td>isunnamed</td><td>${isunnamed}</td>
-        </tr>
-        <tr>
-         <td>isvalid</td><td>${isvalid}</td>
-        </tr>
-        <tr>
-         <td>isv2dir</td><td>${isv2dir}</td>
-        </tr>
-        <tr>
-         <td>isv3dir</td><td>${isv3dir}</td>
-        </tr>
-        <tr>
-         <td>version</td><td>${version}</td>
-        </tr>
-        <tr>
-         <td>ports</td><td>${ports}</td>
-        </tr>
-        <tr>
-         <td>platform</td><td>${platform}</td>
-        </tr>
-      </table>
-      <img src="routerdetail.png?fingerprint=${fingerprint}"
-           width="576"
-           height="360"
-           alt="Bandwidth history for ${fingerprint}"/>
+      <br>
+      <p>Sorry, this page has been discontinued.</p>
     </div>
   </div>
   <div class="bottom" id="bottom">

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