Replace all infinity values before uploading to the dashoard

No-Presubmit: True
Bug: webrtc:12224
Change-Id: I4a7a33bedb5449d7e36293e0c6f47e9cd4d0235a
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/195200
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Andrey Logvin <landrey@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32685}
This commit is contained in:
Andrey Logvin 2020-11-24 15:12:25 +00:00 committed by Commit Bot
parent a62fa7378f
commit 659d7015db

View File

@ -172,17 +172,18 @@ def _CheckFullUploadInfo(url, upload_token,
# TODO(https://crbug.com/1029452): HACKHACK
# Remove once we have doubles in the proto and handle -infinity correctly.
def _ApplyHacks(dicts):
def _NoInf(value):
if value == float('inf'):
return histogram.JS_MAX_VALUE
if value == float('-inf'):
return -histogram.JS_MAX_VALUE
return value
for d in dicts:
if 'running' in d:
def _NoInf(value):
if value == float('inf'):
return histogram.JS_MAX_VALUE
if value == float('-inf'):
return -histogram.JS_MAX_VALUE
return value
d['running'] = [_NoInf(value) for value in d['running']]
if 'sampleValues' in d:
d['sampleValues'] = [_NoInf(value) for value in d['sampleValues']]
return dicts