From ac0eab10f1960e142f6ae6c66605e3fd8def588b Mon Sep 17 00:00:00 2001 From: Brandon Duffany Date: Wed, 11 Oct 2023 11:05:56 -0400 Subject: [PATCH] Use streaming JSON parse for timing profile to work around string size limit --- app/invocation/invocation.css | 20 +++++++ app/invocation/invocation_timing_card.tsx | 53 ++++++++++++++++-- app/trace/BUILD | 3 + app/trace/trace_events.ts | 67 +++++++++++++++++------ 4 files changed, 121 insertions(+), 22 deletions(-) diff --git a/app/invocation/invocation.css b/app/invocation/invocation.css index 61c54cf4059b..fd50ad0f636d 100644 --- a/app/invocation/invocation.css +++ b/app/invocation/invocation.css @@ -1169,3 +1169,23 @@ svg.invocation-query-graph .nodes rect { margin-left: auto; white-space: nowrap; } + +.timing.card .progress-bar { + height: 8px; + border-radius: 4px; + max-width: 300px; + overflow: clip; + background: #e3f2fd; +} + +.timing.card .progress-label { + margin-bottom: 4px; + font-size: 13px; + color: #616161; +} + +.timing.card .progress-bar-inner { + height: 100%; + background: #2196f3; + transform-origin: left; +} diff --git a/app/invocation/invocation_timing_card.tsx b/app/invocation/invocation_timing_card.tsx index a6afdca8a771..386501e1312c 100644 --- a/app/invocation/invocation_timing_card.tsx +++ b/app/invocation/invocation_timing_card.tsx @@ -1,7 +1,7 @@ import React from "react"; import SetupCodeComponent from "../docs/setup_code"; import FlameChart from "../flame_chart/flame_chart"; -import { Profile, parseProfile } from "../trace/trace_events"; +import { Profile, readProfile } from "../trace/trace_events"; import rpcService, { FileEncoding } from "../service/rpc_service"; import InvocationModel from "./invocation_model"; import Button from "../components/button/button"; @@ -63,6 +63,8 @@ export default class InvocationTimingCardComponent extends React.Component(); + componentDidMount() { this.fetchProfile(); } @@ -81,6 +83,30 @@ export default class InvocationTimingCardComponent extends React.Component this.updateProfile(parseProfile(contents))) + .then((body) => { + if (body === null) throw new Error("response body is null"); + return readProfile(body, (n) => this.setProgress(n, digestSize, storedEncoding)); + }) + .then((profile) => this.updateProfile(profile)) .catch((e) => errorService.handleError(e)) .finally(() => this.setState({ loading: false })); } @@ -207,7 +237,18 @@ export default class InvocationTimingCardComponent extends React.Component; + return ( +
+
+