-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
base: main
Are you sure you want to change the base?
Changes from all commits
d13736d
ef78bc6
d022d77
2b24d05
d570b89
4bdd625
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,12 +24,14 @@ import { generateCurlCommand, generateFetchCall } from '../third_party/devtools' | |
import { CopyToClipboardTextButton } from './copyToClipboard'; | ||
import { getAPIRequestCodeGen } from './codegen'; | ||
import type { Language } from '@isomorphic/locatorGenerators'; | ||
import { msToString } from '@web/uiUtils'; | ||
|
||
export const NetworkResourceDetails: React.FunctionComponent<{ | ||
resource: ResourceSnapshot; | ||
onClose: () => void; | ||
sdkLanguage: Language; | ||
}> = ({ resource, onClose, sdkLanguage }) => { | ||
startTimeOffset: number; | ||
onClose: () => void; | ||
}> = ({ resource, sdkLanguage, startTimeOffset, onClose }) => { | ||
const [selectedTab, setSelectedTab] = React.useState('request'); | ||
|
||
return <TabbedPane | ||
|
@@ -39,7 +41,7 @@ export const NetworkResourceDetails: React.FunctionComponent<{ | |
{ | ||
id: 'request', | ||
title: 'Request', | ||
render: () => <RequestTab resource={resource} sdkLanguage={sdkLanguage} />, | ||
render: () => <RequestTab resource={resource} sdkLanguage={sdkLanguage} startTimeOffset={startTimeOffset} />, | ||
}, | ||
{ | ||
id: 'response', | ||
|
@@ -59,9 +61,12 @@ export const NetworkResourceDetails: React.FunctionComponent<{ | |
const RequestTab: React.FunctionComponent<{ | ||
resource: ResourceSnapshot; | ||
sdkLanguage: Language; | ||
}> = ({ resource, sdkLanguage }) => { | ||
startTimeOffset: number; | ||
}> = ({ resource, sdkLanguage, startTimeOffset }) => { | ||
const [requestBody, setRequestBody] = React.useState<{ text: string, mimeType?: string } | null>(null); | ||
|
||
const wallTimeString = React.useMemo(() => resource.startedDateTime.length > 0 ? new Date(resource.startedDateTime).toLocaleString(undefined, { timeZoneName: 'short' }) : '-', [resource.startedDateTime]); | ||
|
||
React.useEffect(() => { | ||
const readResources = async () => { | ||
if (resource.request.postData) { | ||
|
@@ -96,6 +101,10 @@ const RequestTab: React.FunctionComponent<{ | |
</> : null} | ||
<div className='network-request-details-header'>Request Headers</div> | ||
<div className='network-request-details-headers'>{resource.request.headers.map(pair => `${pair.name}: ${pair.value}`).join('\n')}</div> | ||
<div className='network-request-details-header'>Time</div> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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? There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
||
<div className='network-request-details-general'>{`Wall Time: ${wallTimeString}`}</div> | ||
<div className='network-request-details-general'>{`Start: ${msToString(startTimeOffset)}`}</div> | ||
<div className='network-request-details-general'>{`Duration: ${msToString(resource.time)}`}</div> | ||
|
||
<div className='network-request-details-copy'> | ||
<CopyToClipboardTextButton description='Copy as cURL' value={() => generateCurlCommand(resource)} /> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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} /> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 logTab: TabbedPaneTabModel = { | ||
id: 'log', | ||
|
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.