Merge lp:~lifeless/lp-dev-utils/ppr into lp:lp-dev-utils

Proposed by Robert Collins
Status: Merged
Merged at revision: 128
Proposed branch: lp:~lifeless/lp-dev-utils/ppr
Merge into: lp:lp-dev-utils
Diff against target: 158 lines (+32/-21)
2 files modified
page-performance-report-daily.sh (+4/-3)
pageperformancereport.py (+28/-18)
To merge this branch: bzr merge lp:~lifeless/lp-dev-utils/ppr
Reviewer Review Type Date Requested Status
Steve Kowalik (community) code Approve
Review via email: mp+124084@code.launchpad.net

Description of the change

More improvements to the PPR to let it run unaltered for e.g. ISD.

To post a comment you must log in.
Revision history for this message
Steve Kowalik (stevenk) :
review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'page-performance-report-daily.sh'
2--- page-performance-report-daily.sh 2012-09-11 10:12:03 +0000
3+++ page-performance-report-daily.sh 2012-09-13 00:46:22 +0000
4@@ -10,6 +10,7 @@
5 LOGS_ROOTS=${LOGS_ROOTS:-"/srv/launchpad.net-logs/production /srv/launchpad.net-logs/edge"}
6 LOG_PATTERN=${LOG_PATTERN:-'launchpad-trace\*'}
7 OUTPUT_ROOT=${OUTPUT_ROOT:-${HOME}/public_html/ppr/lpnet}
8+JQUERY_URL=${JQUERY_URL:-'../js'}
9 DAY_FMT="+%Y-%m-%d"
10
11 find_logs() {
12@@ -72,8 +73,9 @@
13
14 echo Generating report from $from until $until into $dir `date`
15
16- ./bin/py page-performance-report.py --top-urls=200 --directory=${dir} \
17- $options ${PPR_SWITCHES} $files
18+ ./bin/py page-performance-report.py -c ${CONFIG_FILE} --top-urls=200 \
19+ --jquery-url=${JQUERY_URL} --directory=${dir} $options \
20+ ${PPR_SWITCHES} $files
21
22 # Only do the linking if requested.
23 if [ "$link" = "link" ]; then
24@@ -94,7 +96,6 @@
25 return 0
26 }
27
28-local link
29 if [ "$3" = "-l" ]; then
30 link="link"
31 fi
32
33=== modified file 'pageperformancereport.py'
34--- pageperformancereport.py 2012-08-16 19:57:50 +0000
35+++ pageperformancereport.py 2012-09-13 00:46:22 +0000
36@@ -770,6 +770,9 @@
37 default=False, action='store_true',
38 help="Files are interpreted as pickled stats and are aggregated " +
39 "for the report.")
40+ parser.add_option(
41+ "--jquery-url", dest="jquery_url",
42+ default="../js", help="Path to JQuery root directory.")
43
44 options, args = parser.parse_args()
45
46@@ -875,7 +878,7 @@
47 html_report(
48 open(report_filename, 'w'), partition_times, None, None,
49 histogram_resolution=options.resolution,
50- category_name='Partition')
51+ category_name='Partition', jquery_url=options.jquery_url)
52
53 # Category only report.
54 if options.categories:
55@@ -883,7 +886,8 @@
56 log.info("Generating %s", report_filename)
57 html_report(
58 open(report_filename, 'w'), category_times, None, None,
59- histogram_resolution=options.resolution)
60+ histogram_resolution=options.resolution,
61+ jquery_url=options.jquery_url)
62
63 # Pageid only report.
64 if options.pageids:
65@@ -891,7 +895,8 @@
66 log.info("Generating %s", report_filename)
67 html_report(
68 open(report_filename, 'w'), None, pageid_times, None,
69- histogram_resolution=options.resolution)
70+ histogram_resolution=options.resolution,
71+ jquery_url=options.jquery_url)
72
73 # Top URL only report.
74 if options.top_urls:
75@@ -899,7 +904,8 @@
76 log.info("Generating %s", report_filename)
77 html_report(
78 open(report_filename, 'w'), None, None, url_times,
79- histogram_resolution=options.resolution)
80+ histogram_resolution=options.resolution,
81+ jquery_url=options.jquery_url)
82
83 # Combined report.
84 if options.categories and options.pageids:
85@@ -907,7 +913,8 @@
86 html_report(
87 open(report_filename, 'w'),
88 category_times, pageid_times, url_times,
89- histogram_resolution=options.resolution)
90+ histogram_resolution=options.resolution,
91+ jquery_url=options.jquery_url)
92
93 # Report of likely timeout candidates
94 report_filename = _report_filename('timeout-candidates.html')
95@@ -915,7 +922,8 @@
96 html_report(
97 open(report_filename, 'w'), None, pageid_times, None,
98 options.timeout - 2,
99- histogram_resolution=options.resolution)
100+ histogram_resolution=options.resolution,
101+ jquery_url=options.jquery_url)
102
103 # Save the times cache for later merging.
104 report_filename = _report_filename('stats.pck.bz2')
105@@ -1155,7 +1163,7 @@
106 def html_report(
107 outf, category_times, pageid_times, url_times,
108 ninetyninth_percentile_threshold=None, histogram_resolution=0.5,
109- category_name='Category'):
110+ category_name='Category', jquery_url='../js'):
111 """Write an html report to outf.
112
113 :param outf: A file object to write the report to.
114@@ -1168,6 +1176,7 @@
115 :param histogram_resolution: used as the histogram bar width
116 :param category_name: The name to use for category report. Defaults to
117 'Category'.
118+ :param jquery_url: The URL to JQUERY. e.g. http://foo.com/js.
119 """
120
121 print >> outf, dedent('''\
122@@ -1177,16 +1186,16 @@
123 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
124 <title>Page Performance Report %(date)s</title>
125 <script language="javascript" type="text/javascript"
126- src="../js/flot/jquery.min.js"
127- ></script>
128- <script language="javascript" type="text/javascript"
129- src="../js/jquery.appear-1.1.1.min.js"
130- ></script>
131- <script language="javascript" type="text/javascript"
132- src="../js/flot/jquery.flot.min.js"
133- ></script>
134- <script language="javascript" type="text/javascript"
135- src="../js/sorttable.js"></script>
136+ src="%(JQUERY_URL)s/flot/jquery.min.js"
137+ ></script>
138+ <script language="javascript" type="text/javascript"
139+ src="%(JQUERY_URL)s/jquery.appear-1.1.1.min.js"
140+ ></script>
141+ <script language="javascript" type="text/javascript"
142+ src="%(JQUERY_URL)s/flot/jquery.flot.min.js"
143+ ></script>
144+ <script language="javascript" type="text/javascript"
145+ src="%(JQUERY_URL)s/sorttable.js"></script>
146 <link href='http://fonts.googleapis.com/css?family=Ubuntu' rel='stylesheet' type='text/css'>
147 <style type="text/css">
148 body { font-family: 'Ubuntu', sans-serif; }
149@@ -1222,7 +1231,8 @@
150 <body>
151 <h1>Page Performance Report</h1>
152 <h3>%(date)s</h3>
153- ''' % {'date': time.ctime()})
154+ ''' % {'date': time.ctime(),
155+ 'JQUERY_URL': jquery_url})
156
157 table_header = dedent('''\
158 <table class="sortable page-performance-report">

Subscribers

People subscribed via source and target branches