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
=== modified file 'page-performance-report-daily.sh'
--- page-performance-report-daily.sh 2012-09-11 10:12:03 +0000
+++ page-performance-report-daily.sh 2012-09-13 00:46:22 +0000
@@ -10,6 +10,7 @@
10LOGS_ROOTS=${LOGS_ROOTS:-"/srv/launchpad.net-logs/production /srv/launchpad.net-logs/edge"}10LOGS_ROOTS=${LOGS_ROOTS:-"/srv/launchpad.net-logs/production /srv/launchpad.net-logs/edge"}
11LOG_PATTERN=${LOG_PATTERN:-'launchpad-trace\*'}11LOG_PATTERN=${LOG_PATTERN:-'launchpad-trace\*'}
12OUTPUT_ROOT=${OUTPUT_ROOT:-${HOME}/public_html/ppr/lpnet}12OUTPUT_ROOT=${OUTPUT_ROOT:-${HOME}/public_html/ppr/lpnet}
13JQUERY_URL=${JQUERY_URL:-'../js'}
13DAY_FMT="+%Y-%m-%d"14DAY_FMT="+%Y-%m-%d"
1415
15find_logs() {16find_logs() {
@@ -72,8 +73,9 @@
7273
73 echo Generating report from $from until $until into $dir `date`74 echo Generating report from $from until $until into $dir `date`
7475
75 ./bin/py page-performance-report.py --top-urls=200 --directory=${dir} \76 ./bin/py page-performance-report.py -c ${CONFIG_FILE} --top-urls=200 \
76 $options ${PPR_SWITCHES} $files77 --jquery-url=${JQUERY_URL} --directory=${dir} $options \
78 ${PPR_SWITCHES} $files
7779
78 # Only do the linking if requested.80 # Only do the linking if requested.
79 if [ "$link" = "link" ]; then81 if [ "$link" = "link" ]; then
@@ -94,7 +96,6 @@
94 return 096 return 0
95}97}
9698
97local link
98if [ "$3" = "-l" ]; then99if [ "$3" = "-l" ]; then
99 link="link"100 link="link"
100fi101fi
101102
=== modified file 'pageperformancereport.py'
--- pageperformancereport.py 2012-08-16 19:57:50 +0000
+++ pageperformancereport.py 2012-09-13 00:46:22 +0000
@@ -770,6 +770,9 @@
770 default=False, action='store_true',770 default=False, action='store_true',
771 help="Files are interpreted as pickled stats and are aggregated " +771 help="Files are interpreted as pickled stats and are aggregated " +
772 "for the report.")772 "for the report.")
773 parser.add_option(
774 "--jquery-url", dest="jquery_url",
775 default="../js", help="Path to JQuery root directory.")
773776
774 options, args = parser.parse_args()777 options, args = parser.parse_args()
775778
@@ -875,7 +878,7 @@
875 html_report(878 html_report(
876 open(report_filename, 'w'), partition_times, None, None,879 open(report_filename, 'w'), partition_times, None, None,
877 histogram_resolution=options.resolution,880 histogram_resolution=options.resolution,
878 category_name='Partition')881 category_name='Partition', jquery_url=options.jquery_url)
879882
880 # Category only report.883 # Category only report.
881 if options.categories:884 if options.categories:
@@ -883,7 +886,8 @@
883 log.info("Generating %s", report_filename)886 log.info("Generating %s", report_filename)
884 html_report(887 html_report(
885 open(report_filename, 'w'), category_times, None, None,888 open(report_filename, 'w'), category_times, None, None,
886 histogram_resolution=options.resolution)889 histogram_resolution=options.resolution,
890 jquery_url=options.jquery_url)
887891
888 # Pageid only report.892 # Pageid only report.
889 if options.pageids:893 if options.pageids:
@@ -891,7 +895,8 @@
891 log.info("Generating %s", report_filename)895 log.info("Generating %s", report_filename)
892 html_report(896 html_report(
893 open(report_filename, 'w'), None, pageid_times, None,897 open(report_filename, 'w'), None, pageid_times, None,
894 histogram_resolution=options.resolution)898 histogram_resolution=options.resolution,
899 jquery_url=options.jquery_url)
895900
896 # Top URL only report.901 # Top URL only report.
897 if options.top_urls:902 if options.top_urls:
@@ -899,7 +904,8 @@
899 log.info("Generating %s", report_filename)904 log.info("Generating %s", report_filename)
900 html_report(905 html_report(
901 open(report_filename, 'w'), None, None, url_times,906 open(report_filename, 'w'), None, None, url_times,
902 histogram_resolution=options.resolution)907 histogram_resolution=options.resolution,
908 jquery_url=options.jquery_url)
903909
904 # Combined report.910 # Combined report.
905 if options.categories and options.pageids:911 if options.categories and options.pageids:
@@ -907,7 +913,8 @@
907 html_report(913 html_report(
908 open(report_filename, 'w'),914 open(report_filename, 'w'),
909 category_times, pageid_times, url_times, 915 category_times, pageid_times, url_times,
910 histogram_resolution=options.resolution)916 histogram_resolution=options.resolution,
917 jquery_url=options.jquery_url)
911918
912 # Report of likely timeout candidates919 # Report of likely timeout candidates
913 report_filename = _report_filename('timeout-candidates.html')920 report_filename = _report_filename('timeout-candidates.html')
@@ -915,7 +922,8 @@
915 html_report(922 html_report(
916 open(report_filename, 'w'), None, pageid_times, None,923 open(report_filename, 'w'), None, pageid_times, None,
917 options.timeout - 2, 924 options.timeout - 2,
918 histogram_resolution=options.resolution)925 histogram_resolution=options.resolution,
926 jquery_url=options.jquery_url)
919927
920 # Save the times cache for later merging.928 # Save the times cache for later merging.
921 report_filename = _report_filename('stats.pck.bz2')929 report_filename = _report_filename('stats.pck.bz2')
@@ -1155,7 +1163,7 @@
1155def html_report(1163def html_report(
1156 outf, category_times, pageid_times, url_times,1164 outf, category_times, pageid_times, url_times,
1157 ninetyninth_percentile_threshold=None, histogram_resolution=0.5,1165 ninetyninth_percentile_threshold=None, histogram_resolution=0.5,
1158 category_name='Category'):1166 category_name='Category', jquery_url='../js'):
1159 """Write an html report to outf.1167 """Write an html report to outf.
11601168
1161 :param outf: A file object to write the report to.1169 :param outf: A file object to write the report to.
@@ -1168,6 +1176,7 @@
1168 :param histogram_resolution: used as the histogram bar width1176 :param histogram_resolution: used as the histogram bar width
1169 :param category_name: The name to use for category report. Defaults to1177 :param category_name: The name to use for category report. Defaults to
1170 'Category'.1178 'Category'.
1179 :param jquery_url: The URL to JQUERY. e.g. http://foo.com/js.
1171 """1180 """
11721181
1173 print >> outf, dedent('''\1182 print >> outf, dedent('''\
@@ -1177,16 +1186,16 @@
1177 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">1186 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
1178 <title>Page Performance Report %(date)s</title>1187 <title>Page Performance Report %(date)s</title>
1179 <script language="javascript" type="text/javascript"1188 <script language="javascript" type="text/javascript"
1180 src="../js/flot/jquery.min.js"1189 src="%(JQUERY_URL)s/flot/jquery.min.js"
1181 ></script>1190 ></script>
1182 <script language="javascript" type="text/javascript"1191 <script language="javascript" type="text/javascript"
1183 src="../js/jquery.appear-1.1.1.min.js"1192 src="%(JQUERY_URL)s/jquery.appear-1.1.1.min.js"
1184 ></script>1193 ></script>
1185 <script language="javascript" type="text/javascript"1194 <script language="javascript" type="text/javascript"
1186 src="../js/flot/jquery.flot.min.js"1195 src="%(JQUERY_URL)s/flot/jquery.flot.min.js"
1187 ></script>1196 ></script>
1188 <script language="javascript" type="text/javascript"1197 <script language="javascript" type="text/javascript"
1189 src="../js/sorttable.js"></script>1198 src="%(JQUERY_URL)s/sorttable.js"></script>
1190 <link href='http://fonts.googleapis.com/css?family=Ubuntu' rel='stylesheet' type='text/css'>1199 <link href='http://fonts.googleapis.com/css?family=Ubuntu' rel='stylesheet' type='text/css'>
1191 <style type="text/css">1200 <style type="text/css">
1192 body { font-family: 'Ubuntu', sans-serif; }1201 body { font-family: 'Ubuntu', sans-serif; }
@@ -1222,7 +1231,8 @@
1222 <body>1231 <body>
1223 <h1>Page Performance Report</h1>1232 <h1>Page Performance Report</h1>
1224 <h3>%(date)s</h3>1233 <h3>%(date)s</h3>
1225 ''' % {'date': time.ctime()})1234 ''' % {'date': time.ctime(),
1235 'JQUERY_URL': jquery_url})
12261236
1227 table_header = dedent('''\1237 table_header = dedent('''\
1228 <table class="sortable page-performance-report">1238 <table class="sortable page-performance-report">

Subscribers

People subscribed via source and target branches