Commit 995c0235 authored by nednguyen's avatar nednguyen Committed by Commit Bot

Set json content type for perf's logdog pages that display json content

TBR=jbudorick@chromium.org

Bug: 845139
Change-Id: I293032217af574b8980defb5142e2b21c1a1517f
Reviewed-on: https://chromium-review.googlesource.com/1073390Reviewed-by: default avatarNed Nguyen <nednguyen@google.com>
Reviewed-by: default avatarEmily Hanley <eyaich@chromium.org>
Reviewed-by: default avatarNodir Turakulov <nodir@chromium.org>
Commit-Queue: Ned Nguyen <nednguyen@google.com>
Cr-Commit-Position: refs/heads/master@{#561883}
parent 38f783ea
......@@ -19,18 +19,20 @@ from libs.logdog import bootstrap # pylint: disable=import-error
@decorators.NoRaiseException(default_return_value='',
exception_message=('Ignore this exception. '
'crbug.com/675666'))
def text(name, data):
def text(name, data, content_type=None):
"""Uploads text to logdog.
Args:
name: Name of the logdog stream.
data: String with data you want to upload.
content_type: The optional content type of the stream. If None, a
default content type will be chosen.
Returns:
Link to view uploaded text in logdog viewer.
"""
logging.info('Writing text to logdog stream, %s', name)
with get_logdog_client().text(name) as stream:
with get_logdog_client().text(name, content_type=content_type) as stream:
stream.write(data)
return stream.get_viewer_url()
......
......@@ -35,6 +35,9 @@ MACHINE_GROUP_JSON_FILE = os.path.join(
path_util.GetChromiumSrcDir(), 'tools', 'perf', 'core',
'perf_dashboard_machine_group_mapping.json')
JSON_CONTENT_TYPE = 'application/json'
def _GetMachineGroup(build_properties):
machine_group = None
if build_properties.get('perf_dashboard_machine_group', False):
......@@ -169,7 +172,8 @@ def _handle_perf_logs(benchmark_directory_list, extra_links):
logdog_file_name = _generate_unique_logdog_filename('Benchmarks_Logs')
logdog_stream = logdog_helper.text(
logdog_file_name, json.dumps(benchmark_logs_links, sort_keys=True,
indent=4, separators=(',', ': ')))
indent=4, separators=(',', ': ')),
content_type=JSON_CONTENT_TYPE)
extra_links['Benchmarks logs'] = logdog_stream
......@@ -268,7 +272,8 @@ def _handle_perf_results(
logdog_file_name = _generate_unique_logdog_filename('Results_Dashboard_')
logdog_stream = logdog_helper.text(logdog_file_name,
json.dumps(logdog_dict, sort_keys=True,
indent=4, separators=(',', ': ')))
indent=4, separators=(',', ': ')),
content_type=JSON_CONTENT_TYPE)
if upload_fail:
logdog_label += ' Upload Failure'
extra_links[logdog_label] = logdog_stream
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment