formatting in time_to_first_byte.py

-pending claim_type being usable in claim_search, don't try downloading channel claims in time_to_first_byte.py
This commit is contained in:
Jack Robison 2019-08-12 00:49:33 -04:00
parent 79d643db6c
commit e2d618f472
No known key found for this signature in database
GPG key ID: DF25C68FE0239BB2

View file

@ -75,7 +75,7 @@ async def main(cmd_args=None):
return 1 return 1
else: else:
url_to_claim.update({ url_to_claim.update({
claim['permanent_url']: claim for claim in response['items'] claim['permanent_url']: claim for claim in response['items'] if claim['value_type'] == 'stream'
}) })
print(f'Claim search page {page} took: {time.perf_counter() - start}') print(f'Claim search page {page} took: {time.perf_counter() - start}')
except (ClientConnectorError, ConnectionError): except (ClientConnectorError, ConnectionError):
@ -127,7 +127,7 @@ async def main(cmd_args=None):
if first_byte_times: if first_byte_times:
result += f"Worst first byte time: {round(max(first_byte_times), 2)}\n" \ result += f"Worst first byte time: {round(max(first_byte_times), 2)}\n" \
f"Best first byte time: {round(min(first_byte_times), 2)}\n" \ f"Best first byte time: {round(min(first_byte_times), 2)}\n" \
f"95% confidence time-to-first-byte: {confidence(first_byte_times, 1.984)}s\n" \ f"*95% confidence time-to-first-byte: {confidence(first_byte_times, 1.984)}s*\n" \
f"99% confidence time-to-first-byte: {confidence(first_byte_times, 2.626)}s\n" \ f"99% confidence time-to-first-byte: {confidence(first_byte_times, 2.626)}s\n" \
f"Variance: {variance(first_byte_times)}\n" f"Variance: {variance(first_byte_times)}\n"
if download_successes: if download_successes:
@ -140,7 +140,7 @@ async def main(cmd_args=None):
for reason in ('start', 'finish'): for reason in ('start', 'finish'):
failures = [url for url, why in failed_to.items() if reason == why] failures = [url for url, why in failed_to.items() if reason == why]
if failures: if failures:
result += f"\nFailed to {reason}:\n" + "\n".join(failures) result += f"\nFailed to {reason}:\n" + "\n".join(failures)
print(result) print(result)
webhook = os.environ.get('TTFB_SLACK_TOKEN', None) webhook = os.environ.get('TTFB_SLACK_TOKEN', None)