3
3
#TZ=UTC # trace logs are still BST - blech
6
LOGS_ROOTS="/srv/launchpad.net-logs/production /srv/launchpad.net-logs/edge"
7
OUTPUT_ROOT=${HOME}/public_html/ppr/lpnet
15
days_to_end="$(expr `date +%j` - `date -d $until +%j` - 1)"
16
if [ $days_to_end -gt 0 ]; then
17
end_mtime_switch="-daystart -mtime +$days_to_end"
21
-maxdepth 2 -type f -newermt "$from - 1 day" $end_mtime_switch \
22
-name launchpad-trace\* \
26
# Find all the daily stats.pck.bz2 $from $until
31
# Build a string of all the days within range.
35
while [ $day != $until ]; do
37
day=`date $DAY_FMT -d "$day + 1 day"`
40
# Use that to build a regex that will be used to select
43
regex="daily_(`echo $dates |sed -e 's/ /|/g'`)"
45
find ${OUTPUT_ROOT} -name 'stats.pck.bz2' | egrep $regex
56
if [ "$type" = "daily" ]; then
57
files=`find_logs $from $until`
58
options="--from=$from --until=$until"
60
files=`find_stats $from $until`
14
logs=`find ${log_root} \
15
-maxdepth 2 -type f -mtime -${max_log_age} -name launchpad-trace\* \
19
root=${HOME}/public_html/ppr/${category}
65
dir=${OUTPUT_ROOT}/`date -d $from +%Y-%m`/${type}_${from}_${until}
22
dir=${root}/${type}_${from}_${until}
68
26
echo Generating report from $from until $until into $dir `date`
70
./page-performance-report.py -v --top-urls=200 --directory=${dir} \
73
# Only do the linking if requested.
74
if [ "$link" = "link" ]; then
75
ln -sf ${dir}/partition.html \
76
${OUTPUT_ROOT}/latest-${type}-partition.html
77
ln -sf ${dir}/categories.html \
78
${OUTPUT_ROOT}/latest-${type}-categories.html
79
ln -sf ${dir}/pageids.html \
80
${OUTPUT_ROOT}/latest-${type}-pageids.html
81
ln -sf ${dir}/combined.html \
82
${OUTPUT_ROOT}/latest-${type}-combined.html
83
ln -sf ${dir}/metrics.dat ${OUTPUT_ROOT}/latest-${type}-metrics.dat
84
ln -sf ${dir}/top200.html ${OUTPUT_ROOT}/latest-${type}-top200.html
85
ln -sf ${dir}/timeout-candidates.html \
86
${OUTPUT_ROOT}/latest-${type}-timeout-candidates.html
28
./page-performance-report.py -v --from=$from --until=$until \
29
--top-urls=200 --directory=${dir} $logs
31
ln -sf ${dir}/categories.html ${root}/latest-${type}-categories.html
32
ln -sf ${dir}/pageids.html ${root}/latest-${type}-pageids.html
33
ln -sf ${dir}/combined.html ${root}/latest-${type}-combined.html
34
ln -sf ${dir}/top200.html ${root}/latest-${type}-top200.html
35
ln -sf ${dir}/timeout-candidates.html \
36
${root}/latest-${type}-timeout-candidates.html
42
category_report $* lpnet /srv/launchpad.net-logs/production
93
if [ "$3" = "-l" ]; then
97
if [ "$1" = '-d' ]; then
98
report daily `date -d $2 $DAY_FMT` `date -d "$2 + 1 day" $DAY_FMT` $link
99
elif [ "$1" = '-w' ]; then
100
report weekly `date -d $2 $DAY_FMT` `date -d "$2 + 1 week" $DAY_FMT` $link
101
elif [ "$1" = '-m' ]; then
102
report monthly `date -d $2 $DAY_FMT` `date -d "$2 + 1 month" $DAY_FMT` $link
104
# Default invocation used from cron to generate latest one.
106
report daily `date -d yesterday $DAY_FMT` $now link
108
if [ `date +%a` = 'Sun' ]; then
109
report weekly `date -d 'last week' $DAY_FMT` $now link
112
if [ `date +%d` = '01' ]; then
113
report monthly `date -d 'last month' $DAY_FMT` $now link
50
report 3 daily `date -d yesterday $fmt` $now
52
if [ `date +%a` = 'Sat' ]; then
53
report 9 weekly `date -d 'last week' $fmt` $now
56
# We don't seem to have a months worth of tracelogs, but we will
57
# generate what we can.
58
if [ `date +%d` = '01' ]; then
59
report 32 monthly `date -d 'last month' $fmt` $now