Hand protos directly to histograms and fix summary.
The catapult code has learned how to deserialize protos, so we don't need JSON as a middle step. Also, set summary options to false for now to avoid polluting the dashboard with _avg, _count for each metric. We don't use those anyway. The durable solution is to set these from the histogram writer, but catapult doesn't read the summary options correctly from the proto yet. Bug: chromium:1029452 Change-Id: I59d300fd34d36df836064ff41f6d0bf75bd6695e Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/170104 Commit-Queue: Patrik Höglund <phoglund@webrtc.org> Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org> Cr-Commit-Position: refs/heads/master@{#30737}
This commit is contained in:

committed by
Commit Bot

parent
c782263e5f
commit
7427fc6560
@ -46,8 +46,6 @@ from tracing.value import histogram_set
|
||||
from tracing.value.diagnostics import generic_set
|
||||
from tracing.value.diagnostics import reserved_infos
|
||||
|
||||
from google.protobuf import json_format
|
||||
|
||||
|
||||
def _GenerateOauthToken():
|
||||
args = ['luci-auth', 'token']
|
||||
@ -94,25 +92,10 @@ def _LoadHistogramSetFromProto(options):
|
||||
'tracing', 'proto')
|
||||
sys.path.insert(0, histogram_proto_path)
|
||||
|
||||
# TODO(https://crbug.com/1029452): Get rid of this import hack once we can
|
||||
# just hand the contents of input_results_file straight to the histogram set.
|
||||
try:
|
||||
import histogram_pb2
|
||||
except ImportError:
|
||||
raise ImportError('Could not find histogram_pb2. You need to build the '
|
||||
'webrtc_dashboard_upload target before invoking this '
|
||||
'script. Expected to find '
|
||||
'histogram_pb2 in %s.' % histogram_proto_path)
|
||||
|
||||
with options.input_results_file as f:
|
||||
histograms = histogram_pb2.HistogramSet()
|
||||
histograms.ParseFromString(f.read())
|
||||
|
||||
# TODO(https://crbug.com/1029452): Don't convert to JSON as a middle step once
|
||||
# there is a proto de-serializer ready in catapult.
|
||||
json_data = json.loads(json_format.MessageToJson(histograms))
|
||||
hs = histogram_set.HistogramSet()
|
||||
hs.ImportDicts(json_data)
|
||||
with options.input_results_file as f:
|
||||
hs.ImportProto(f.read())
|
||||
|
||||
return hs
|
||||
|
||||
|
||||
@ -157,7 +140,7 @@ def _CreateParser():
|
||||
help='URL to the build page for this build.')
|
||||
parser.add_argument('--dashboard-url', required=True,
|
||||
help='Which dashboard to use.')
|
||||
parser.add_argument('--input-results-file', type=argparse.FileType(),
|
||||
parser.add_argument('--input-results-file', type=argparse.FileType('rb'),
|
||||
required=True,
|
||||
help='A JSON file with output from WebRTC tests.')
|
||||
parser.add_argument('--output-json-file', type=argparse.FileType('w'),
|
||||
@ -167,12 +150,28 @@ def _CreateParser():
|
||||
return parser
|
||||
|
||||
|
||||
# TODO(https://crbug.com/1029452): Remove this once
|
||||
# https://chromium-review.googlesource.com/c/catapult/+/2094312 lands.
|
||||
def _HackSummaryOptions(histograms):
|
||||
for histogram in histograms:
|
||||
histogram.CustomizeSummaryOptions({
|
||||
'avg': False,
|
||||
'std': False,
|
||||
'count': False,
|
||||
'sum': False,
|
||||
'min': False,
|
||||
'max': False,
|
||||
'nans': False,
|
||||
})
|
||||
|
||||
|
||||
def main(args):
|
||||
parser = _CreateParser()
|
||||
options = parser.parse_args(args)
|
||||
|
||||
histograms = _LoadHistogramSetFromProto(options)
|
||||
_AddBuildInfo(histograms, options)
|
||||
_HackSummaryOptions(histograms)
|
||||
|
||||
if options.output_json_file:
|
||||
_DumpOutput(histograms, options.output_json_file)
|
||||
|
Reference in New Issue
Block a user