generate_update_statistics throws errors when asked for stats for a date not present in its fileset

NEW
Unassigned

Status

7 years ago
7 years ago

People

(Reporter: alqahira, Unassigned)

Tracking

Details

Because log rotation apparently is an inexact science, we end up with logfiles named one date but containing data that may stop short of or run over the date in the filename, so I occasionally get confused and ask generate_update_statistics to process log data for a date range that includes a date for which the subject logfiles contain no data.

In those cases, generate_update_statistics is unhappy and throws Ruby errors:

/Users/smokey/Camino/dev/192branch/mozilla/camino/tools/stats/generate_update_statistics:446:in `count_pings_by_attribute': undefined method `each' for nil:NilClass (NoMethodError)
	from /Users/smokey/Camino/dev/192branch/mozilla/camino/tools/stats/generate_update_statistics:253:in `print_spreadsheet_count_line'
	from /Users/smokey/Camino/dev/192branch/mozilla/camino/tools/stats/generate_update_statistics:142:in `handle_command_counts'
	from /Users/smokey/Camino/dev/192branch/mozilla/camino/tools/stats/generate_update_statistics:162:in `call'
	from /Users/smokey/Camino/dev/192branch/mozilla/camino/tools/stats/generate_update_statistics:162:in `load_and_process_by_date'
	from /Users/smokey/Camino/dev/192branch/mozilla/camino/tools/stats/generate_update_statistics:161:in `each'
	from /Users/smokey/Camino/dev/192branch/mozilla/camino/tools/stats/generate_update_statistics:161:in `load_and_process_by_date'
	from /Users/smokey/Camino/dev/192branch/mozilla/camino/tools/stats/generate_update_statistics:141:in `handle_command_counts'
	from /Users/smokey/Camino/dev/192branch/mozilla/camino/tools/stats/generate_update_statistics:100:in `main'
	from /Users/smokey/Camino/dev/192branch/mozilla/camino/tools/stats/generate_update_statistics:557
I suddenly (after a couple of weeks of no problems) hit this same error again tonight, trying to process a file where I'd verified I was using the correct date range.  As it turns out, it's now 2012 and I was trying to process a file full of 2011 pings :P

I guess since the new code creates an actual date, it assumes the current year when making the date if not passed a year?  (I was able to run the end of last year's stats successfully by passing in full 25/Dec/2011,31/Dec/2011 dates.)
You need to log in before you can comment on or make changes to this bug.