Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add time information to Call and Network tabs in Trace Viewer #33935

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

agg23
Copy link
Contributor

@agg23 agg23 commented Dec 10, 2024

Adds startTime display to the Call tab.

image

Adds various time metric display to the Network tab expanded view.

image

Minor code cleanup to make it more Reacty.

This comment has been minimized.

This comment has been minimized.

@agg23
Copy link
Contributor Author

agg23 commented Dec 11, 2024

Tagging #33823

@@ -94,6 +99,10 @@ const RequestTab: React.FunctionComponent<{
{resource.request.queryString.map(param => `${param.name}: ${param.value}`).join('\n')}
</div>
</> : null}
<div className='network-request-details-header'>Time</div>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the point in showing these values in the details, given that they are already present in the network table where one can see other network requests and compare their start time/duration?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a strange omission for it to not be available. Why would expanding the details of something show fewer details?

While you're right that they can only compare when the details are not open, I think it's still valuable to be able to view all the metrics on this screen.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While I agree with you that it's nice to see this information in the details view, I still cannot come up with a good explanation why it should be shown above request headers. Maybe push it below headers at least? We should probably put timing information into its own tab and populate it with other details that we have, but I don't remember anyone asking for this.

@@ -94,6 +99,10 @@ const RequestTab: React.FunctionComponent<{
{resource.request.queryString.map(param => `${param.name}: ${param.value}`).join('\n')}
</div>
</> : null}
<div className='network-request-details-header'>Time</div>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While I agree with you that it's nice to see this information in the details view, I still cannot come up with a good explanation why it should be shown above request headers. Maybe push it below headers at least? We should probably put timing information into its own tab and populate it with other details that we have, but I don't remember anyone asking for this.

@@ -176,7 +176,7 @@ export const Workbench: React.FunctionComponent<{
const callTab: TabbedPaneTabModel = {
id: 'call',
title: 'Call',
render: () => <CallTab action={activeAction} sdkLanguage={sdkLanguage} />
render: () => <CallTab action={activeAction} executionStartTime={model?.startTime ?? 0} executionStartWallTime={model?.wallTime ?? Date.now()} sdkLanguage={sdkLanguage} />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should never happen that model?.wallTime is undefined when activeAction is not null, why pass Date.now() rather than 0 or -1? Would be cleaner if CallTab accepted single parameter { action, startTime, startWallTime } | undefined, can we do that?

Copy link
Contributor Author

@agg23 agg23 Dec 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doing so requires changing the component significantly so that we properly represent model and activeAction as being intertwined state. Currently TypeScript doesn't know they're related.

I would prefer to not change this and leave the coalescence placeholders, but I will change this if you so desire. I personally think this would be overly specific type handling, though it's obviously more correct.

{
<>
<div className='call-section'>Time</div>
{wallTime && <DateTimeCallLine name='wall time:' value={wallTime}/>}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think wallTime is ever null at this line.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is why we need that lint rule :P

@agg23 agg23 requested a review from yury-s December 18, 2024 20:49
Copy link
Contributor

Test results for "tests 1"

6 flaky ⚠️ [firefox-page] › page/page-evaluate.spec.ts:403:3 › should throw for too deep reference chain @firefox-ubuntu-22.04-node18
⚠️ [webkit-library] › library/browsertype-connect.spec.ts:187:5 › launchServer › should be able to visit ipv6 through localhost @webkit-ubuntu-22.04-node18
⚠️ [webkit-library] › library/signals.spec.ts:25:5 › should close the browser when the node process closes @webkit-ubuntu-22.04-node18
⚠️ [webkit-library] › library/trace-viewer.spec.ts:1583:1 › should show a popover @webkit-ubuntu-22.04-node18
⚠️ [webkit-page] › page/page-set-input-files.spec.ts:147:3 › should upload large file @webkit-ubuntu-22.04-node18
⚠️ [playwright-test] › ui-mode-test-watch.spec.ts:145:5 › should watch all @windows-latest-node18-1

37337 passed, 650 skipped
✔️✔️✔️

Merge workflow run.

@pavelfeldman
Copy link
Member

What is Start time?

@@ -176,7 +176,7 @@ export const Workbench: React.FunctionComponent<{
const callTab: TabbedPaneTabModel = {
id: 'call',
title: 'Call',
render: () => <CallTab action={activeAction} sdkLanguage={sdkLanguage} />
render: () => <CallTab action={activeAction} executionStartTime={model?.startTime ?? 0} executionStartWallTime={model?.wallTime ?? 0} sdkLanguage={sdkLanguage} />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think "execution" helps here, start time usually applies to execution, maybe name it timeOrigin?

const startTimeMillis = action.startTime - executionStartTime;
const startTime = msToString(startTimeMillis);

const wallTimeMillis = startTimeMillis + executionStartWallTime;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would be just a guess at this point as we can't add ticks to millis, do we really want to explicitly mislead? I would omit.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Offline discussion with Yury where I am saying that we should not do wall time math: maybe we could formalize model.startTime and then we can remove the wallTime from individual actions and operate in terms or ticks (monotonic time) for actions only.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants