Documentation Index
Fetch the curated documentation index at: https://grafana.com/llms.txt
Fetch the complete documentation index at: https://grafana.com/llms-full.txt
Use this file to discover all available pages before exploring further.
STOP! If you are an AI agent or LLM, read this before continuing. This is the HTML version of a Grafana documentation page. Always request the Markdown version instead - HTML wastes context. Get this page as Markdown: https://grafana.com/docs/k6/latest/javascript-api/k6-browser/request/timing.md (append .md) or send Accept: text/markdown to https://grafana.com/docs/k6/latest/javascript-api/k6-browser/request/timing/. For the curated documentation index, use https://grafana.com/llms.txt. For the complete documentation index, use https://grafana.com/llms-full.txt.
Menu
Open source
timing()
Returns resource timing information for the given request. Most of the timing values become available upon the response, responseEnd becomes available when request finishes.
Returns
| Type | Description |
|---|---|
| ResourceTiming | Returns ResourceTiming. |
ResourceTiming
| Property | Type | Description |
|---|---|---|
| statTime | number | Request start time in milliseconds elapsed since January 1, 1970 00:00:00 UTC. |
| domainLookupStart | number | Time immediately before the browser starts the domain name lookup for the resource. The value is given in milliseconds relative to startTime, -1 if not available. |
| domainLookupEnd | number | Time immediately after the browser ends the domain name lookup for the resource. The value is given in milliseconds relative to startTime, -1 if not available. |
| connectStart | number | Time immediately before the user agent starts establishing the connection to the server to retrieve the resource. The value is given in milliseconds relative to startTime, -1 if not available. |
| secureConnectionStart | number | Time immediately before the browser starts the handshake process to secure the current connection. The value is given in milliseconds relative to startTime, -1 if not available. |
| connectEnd | number | Time immediately after the user agent establishes the connection to the server to retrieve the resource. The value is given in milliseconds relative to startTime, -1 if not available. |
| requestStart | number | Time immediately before the browser starts requesting the resource from the server, cache, or local resource. The value is given in milliseconds relative to startTime, -1 if not available. |
| responseStart | number | Time immediately after the browser receives the first byte of the response from the server, cache, or local resource. The value is given in milliseconds relative to startTime, -1 if not available. |
| responseEnd | number | Time immediately after the browser receives the last byte of the resource or immediately before the transport connection is closed, whichever comes first. The value is given in milliseconds relative to startTime, -1 if not available. |
Example
JavaScript
import { browser } from 'k6/browser';
export const options = {
scenarios: {
ui: {
executor: 'shared-iterations',
options: {
browser: {
type: 'chromium',
},
},
},
},
};
export default async function () {
const page = await browser.newPage();
try {
const res = await page.goto('https://test.k6.io/');
const req = res.request();
const timing = await req.timing();
console.log(`timing: ${JSON.stringify(timing)}`); // timing: {"startTime":534898988.85297775,...}
} finally {
await page.close();
}
}Was this page helpful?
Related resources from Grafana Labs
Additional helpful documentation, links, and articles:
Video

Performance testing and observability in Grafana Cloud
Optimize user experiences with Grafana Cloud. Learn real-time insights, performance testing with k6, and continuous validation with Synthetic Monitoring.
Events

User-centered observability: load testing, real user monitoring, and synthetics
Learn how to use load testing, synthetic monitoring, and real user monitoring (RUM) to understand end users' experience of your apps. Watch on demand.
Choose a product
Viewing: v2.0.x (latest)
Find another version
Scroll for more