WUI: disable google timing chart on mapupdate page

The google image chart API has been deprecated since 2012, sending the
URL to google leaks server IDs and the client's IP address (especially
important when the client is otherwise behind Tor), and the X-axis has
no units anyways.

refs ticket:1942 , which is both about removing the URL-based chart, and
eventually replacing it with a browser-rendered d3.js-based one
This commit is contained in:
Brian Warner 2016-09-02 16:30:21 -07:00
parent ed22b60026
commit ed91398a3f
2 changed files with 5 additions and 78 deletions

View File

@ -21,16 +21,13 @@
<h2>Update Results</h2>
<ul>
<li n:render="problems" />
<li>Timings: <span n:render="timing_chart" /></li>
<li>Total: <span n:render="time" n:data="time_total" /></li>
<ul>
<li>Total: <span n:render="time" n:data="time_total" /></li>
<ul>
<li>Initial Queries: <span n:render="time" n:data="time_initial_queries" /></li>
<li n:render="privkey_from" />
<li>Cumulative Verify: <span n:render="time" n:data="time_cumulative_verify" /></li>
</ul>
<li n:render="server_timings" />
<li>Initial Queries: <span n:render="time" n:data="time_initial_queries" /></li>
<li n:render="privkey_from" />
<li>Cumulative Verify: <span n:render="time" n:data="time_cumulative_verify" /></li>
</ul>
<li n:render="server_timings" />
</ul>
<div>Return to the <a href="/">Welcome Page</a></div>

View File

@ -949,76 +949,6 @@ class MapupdateStatusPage(rend.Page, RateAndTimeMixin):
l[T.li["[%s]: %s" % (server.get_name(), times_s)]]
return T.li["Per-Server Response Times: ", l]
def render_timing_chart(self, ctx, data):
imageurl = self._timing_chart()
return ctx.tag[imageurl]
def _timing_chart(self):
started = self.update_status.get_started()
total = self.update_status.timings.get("total")
per_server = self.update_status.timings.get("per_server")
# We'd like to use an https: URL here, but the site has a domain/cert mismatch.
base = "http://chart.apis.google.com/chart?"
pieces = ["cht=bhs"]
pieces.append("chco=ffffff,4d89f9,c6d9fd") # colors
data0 = []
data1 = []
data2 = []
nb_nodes = 0
graph_botom_margin= 21
graph_top_margin = 5
server_names = []
top_abs = started
# we sort the queries by the time at which we sent the first request
sorttable = [ (times[0][1], server)
for server, times in per_server.items() ]
sorttable.sort()
servers = [t[1] for t in sorttable]
for server in servers:
nb_nodes += 1
times = per_server[server]
name = server.get_name()
server_names.append(name)
# for servermap updates, there are either one or two queries per
# peer. The second (if present) is to get the privkey.
op,q_started,q_elapsed = times[0]
data0.append("%.3f" % (q_started-started))
data1.append("%.3f" % q_elapsed)
top_abs = max(top_abs, q_started+q_elapsed)
if len(times) > 1:
op,p_started,p_elapsed = times[0]
data2.append("%.3f" % p_elapsed)
top_abs = max(top_abs, p_started+p_elapsed)
else:
data2.append("0.0")
finished = self.update_status.get_finished()
if finished:
top_abs = max(top_abs, finished)
top_rel = top_abs - started
chs ="chs=400x%d" % ( (nb_nodes*28) + graph_top_margin + graph_botom_margin )
chd = "chd=t:" + "|".join([",".join(data0),
",".join(data1),
",".join(data2)])
pieces.append(chd)
pieces.append(chs)
chds = "chds=0,%0.3f" % top_rel
pieces.append(chds)
pieces.append("chxt=x,y")
pieces.append("chxr=0,0.0,%0.3f" % top_rel)
pieces.append("chxl=1:|" + "|".join(reversed(server_names)))
# use up to 10 grid lines, at decimal multiples.
# mathutil.next_power_of_k doesn't handle numbers smaller than one,
# unfortunately.
#pieces.append("chg="
if total is not None:
finished_f = 1.0 * total / top_rel
pieces.append("chm=r,FF0000,0,%0.3f,%0.3f" % (finished_f,
finished_f+0.01))
url = base + "&".join(pieces)
return T.img(src=url,border="1",align="right", float="right")
class Status(rend.Page):
docFactory = getxmlfile("status.xhtml")