Skip to content

Commit

Permalink
Merge pull request #1663 from kumar303/upload-size-fix
Browse files Browse the repository at this point in the history
Temporarily stop tracking scaled upload stats
  • Loading branch information
kumar303 committed Feb 10, 2016
2 parents c005eb6 + 2ca672f commit d7bb003
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/olympia/devhub/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,13 @@ def handle_upload_validation_result(results, upload_pk, annotate=True):
delta = now_ts - upload_start
statsd.timing('devhub.validation_results_processed', delta)

if not storage.exists(upload.path):
# TODO: actually fix this so we can get stats. It seems that
# the file maybe gets moved but it needs more investigation.
log.warning('Scaled upload stats were not tracked. File is '
'missing: {}'.format(upload.path))
return

size = Decimal(storage.size(upload.path))
megabyte = Decimal(1024 * 1024)

Expand Down
11 changes: 11 additions & 0 deletions src/olympia/devhub/tests/test_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,17 @@ def test_do_not_calculate_scaled_time_for_empty_files(self):

assert 'devhub.validation_results_processed_per_mb' not in statsd_calls

def test_ignore_missing_upload_paths_for_now(self):
with mock.patch('olympia.devhub.tasks.storage.exists') as mock_exists:
mock_exists.return_value = False
with self.statsd_timing_mock() as statsd_calls:
self.handle_upload_validation_result()

assert 'devhub.validation_results_processed' in statsd_calls
assert 'devhub.validation_results_processed_per_mb' not in statsd_calls
assert ('devhub.validation_results_processed_under_1mb' not in
statsd_calls)


class TestTrackValidatorStats(TestCase):

Expand Down

0 comments on commit d7bb003

Please sign in to comment.