Skip to content
Snippets Groups Projects
Commit 12c1b5a7 authored by ale's avatar ale
Browse files

fix/3

parent 35aca710
No related branches found
No related tags found
No related merge requests found
...@@ -57,11 +57,12 @@ class LatencyProfilerMiddleware(object): ...@@ -57,11 +57,12 @@ class LatencyProfilerMiddleware(object):
'<html><head><title>Latency Breakdown</title>\n' '<html><head><title>Latency Breakdown</title>\n'
'<style type="text/css">\n' '<style type="text/css">\n'
'body { background: white; font-family: sans-serif; }\n' 'body { background: white; font-family: sans-serif; }\n'
'tbody td { text-align: left; padding-right: 10px; }\n' 'tbody td { text-align: left; padding-right: 10px; '
'border-bottom: 1px solid #eee; }\n'
'thead th { font-weight: bold; text-align: left; color: white; ' 'thead th { font-weight: bold; text-align: left; color: white; '
'background-color: #666; }\n' 'background-color: #666; padding-right: 10px; }\n'
'td.url { font-weight: bold; border-right: 1px solid #666; }\n' 'td.url { font-weight: bold; border-right: 1px solid #eee; '
'tbody tr { border-bottom: 1px solid #ccc; }\n' 'margin-right: 10px; }\n'
'</style></head><body>\n' '</style></head><body>\n'
'<h3>Latency report by URL</h3>\n' '<h3>Latency report by URL</h3>\n'
'<table cellspacing="0" cellpadding="0" border="0"><thead><tr>' '<table cellspacing="0" cellpadding="0" border="0"><thead><tr>'
...@@ -81,11 +82,11 @@ class LatencyProfilerMiddleware(object): ...@@ -81,11 +82,11 @@ class LatencyProfilerMiddleware(object):
values = self._data[url] values = self._data[url]
result.append('<tr><td class="url">%s</td><td>%d</td>' % ( result.append('<tr><td class="url">%s</td><td>%d</td>' % (
url, sum(values))) url, sum(values)))
chart = pygooglechart.SparkLineChart(80, 25) chart = pygooglechart.SparkLineChart(80, 20)
chart.add_data(values) chart.add_data(values)
for count, pct in _percent(values): for count, pct in _percent(values):
result.append('<td>%d (%.2g%%)</td>' % (count, pct)) result.append('<td>%d (%d%%)</td>' % (count, int(pct)))
result.append('<td><img src="%s" width="80" height="25"></td>' % result.append('<td><img src="%s" width="80" height="20"></td>' %
chart.get_url()) chart.get_url())
result.append('</tr>') result.append('</tr>')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment