From 478d623b487edd4f131c0d7ad800088fdf13bfa1 Mon Sep 17 00:00:00 2001 From: Karlie Li Date: Mon, 24 Feb 2025 16:28:42 -0800 Subject: [PATCH 1/2] add resource timing --- model/browser/events.yaml | 107 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 107 insertions(+) create mode 100644 model/browser/events.yaml diff --git a/model/browser/events.yaml b/model/browser/events.yaml new file mode 100644 index 0000000000..cc42dde910 --- /dev/null +++ b/model/browser/events.yaml @@ -0,0 +1,107 @@ +groups: + - id: event.browser.resource_timing + stability: development + type: event + name: browser.resource_timing + brief: > + This event describes the timing metrics as provided by PerformanceResourceTiming Performance API. + These metrics are related to fetching a resource, such as + XMLHttpRequest, Fetch, sendBeacon APIs, SVG, image or script. + note: > + This event captures data from the [ResourceTiming](https://www.w3.org/TR/resource-timing/). + It is recommended to be captured by using the PerformanceResourceTiming API. + If the page starts unloading before the page loads, + then the partial data can be captured by calling the [performance.getEntriesByType][https://developer.mozilla.org/en-US/docs/Web/API/Performance/getEntriesByType] method. + + This event definition elevates a few key data points to body fields in + order to make it easier to access. In addition, the complete set of data + from the API may be sent in the body of the event as stringified JSON. + body: + id: browser.resource_timing + requirement_level: required + stability: development + type: map + fields: + - id: name + type: string + stability: development + brief: The resolved URL of the requested resource. + requirement_level: recommended + examples: ["https://en.wikipedia.org/wiki/Main_Page"] + - id: fetchStart + type: double + stability: development + brief: > + The time immediately before the browser starts to fetch the resource, + and it is measured in milliseconds. + requirement_level: recommended + examples: [9.600000000558794] + - id: domainLookupStart + type: double + stability: development + brief: > + The time immediately before the browser starts the domain name lookup for the resource, + and it is measured in milliseconds. + requirement_level: recommended + examples: [100.6000000014901] + - id: domainLookupEnd + type: double + stability: development + brief: > + The time immediately after the browser finishes the domain name lookup for the resource, + and it is measured in milliseconds. + requirement_level: recommended + examples: [100.6000000014906] + - id: connectStart + type: double + stability: development + brief: > + The time immediately immediately before the user agent starts establishing the connection to the server to retrieve the resource, + and it is measured in milliseconds. + requirement_level: recommended + examples: [476.6000000014901] + - id: secureConnectionStart + type: double + stability: development + brief: > + The time immediately before immediately before the browser starts the handshake process to secure the current connection, + and it is measured in milliseconds. + requirement_level: recommended + examples: [476.6000000014903] + - id: connectEnd + type: double + stability: development + brief: > + The time immediately after the browser finishes establishing the connection to the server to retrieve the resource. + The timestamp value includes the time interval to establish the transport connection, + as well as other time intervals such as SSL handshake and SOCKS authentication. + completes, and it is measured in milliseconds. + requirement_level: recommended + examples: [476.6000000014906] + - id: requestStart + type: double + stability: development + brief: > + The time immediately before the browser starts requesting the resource from the server, cache, or local resource. + If the transport connection fails and the browser retires the request, + the value returned will be the start of the retry request, + and it is measured in milliseconds. + requirement_level: recommended + examples: [506.70000000298023] + - id: responseStart + type: double + stability: development + brief: > + The time immediately after the browser receives the first byte of the response from the server, cache, or local resource, + and it is measured in milliseconds. + requirement_level: recommended + examples: [508.6000000014901] + - id: responseEnd + type: double + stability: development + brief: > + The time immediately after the browser receives the last byte of the resource + or immediately before the transport connection is closed, whichever comes first, + and it is measured in milliseconds. + requirement_level: recommended + examples: [510.6000000014906] From 24f3c96412be30f4f37ca67282e35739e856b758 Mon Sep 17 00:00:00 2001 From: Karlie Li Date: Wed, 26 Feb 2025 15:42:50 -0800 Subject: [PATCH 2/2] update --- docs/browser/events.md | 49 +++++++++++++++++++++++++++++++++++++++ model/browser/events.yaml | 13 ++++------- 2 files changed, 54 insertions(+), 8 deletions(-) create mode 100644 docs/browser/events.md diff --git a/docs/browser/events.md b/docs/browser/events.md new file mode 100644 index 0000000000..eab4e206e2 --- /dev/null +++ b/docs/browser/events.md @@ -0,0 +1,49 @@ + + +# Semantic conventions for browser events + +**Status**: [Development][DocumentStatus] + +This document defines semantic conventions for browser (web) instrumentations +that emit events. + +## Resource Timing Event + + + + + + + + +**Status:** ![Development](https://img.shields.io/badge/-development-blue) + +The event name MUST be `browser.resource_timing`. + +This event describes the timing metrics as provided by PerformanceResourceTiming Performance API. These metrics are related to fetching a resource, such as XMLHttpRequest, Fetch, sendBeacon APIs, SVG, image or script. + +This event captures data from the [ResourceTiming](https://www.w3.org/TR/resource-timing/). It is recommended to be captured by using the PerformanceResourceTiming API. If the page starts unloading before the page loads, then the partial data can be captured by calling the [performance.getEntriesByType](https://developer.mozilla.org/en-US/docs/Web/API/Performance/getEntriesByType) method. + +**Body fields:** + +| Body Field | Type | Description | Examples | [Requirement Level](https://opentelemetry.io/docs/specs/semconv/general/attribute-requirement-level/) | Stability | +|---|---|---|---|---|---| +| `connectEnd` | double | The time immediately after the browser finishes establishing the connection to the server to retrieve the resource. The timestamp value includes the time interval to establish the transport connection, as well as other time intervals such as SSL handshake and SOCKS authentication. completes, and it is measured in milliseconds. | `476.6000000014906` | `Recommended` | ![Development](https://img.shields.io/badge/-development-blue) | +| `connectStart` | double | The time immediately immediately before the user agent starts establishing the connection to the server to retrieve the resource, and it is measured in milliseconds. | `476.6000000014901` | `Recommended` | ![Development](https://img.shields.io/badge/-development-blue) | +| `domainLookupEnd` | double | The time immediately after the browser finishes the domain name lookup for the resource, and it is measured in milliseconds. | `100.6000000014906` | `Recommended` | ![Development](https://img.shields.io/badge/-development-blue) | +| `domainLookupStart` | double | The time immediately before the browser starts the domain name lookup for the resource, and it is measured in milliseconds. | `100.6000000014901` | `Recommended` | ![Development](https://img.shields.io/badge/-development-blue) | +| `fetchStart` | double | The time immediately before the browser starts to fetch the resource, and it is measured in milliseconds. | `9.600000000558794` | `Recommended` | ![Development](https://img.shields.io/badge/-development-blue) | +| `name` | string | The resolved URL of the requested resource. | `https://en.wikipedia.org/wiki/Main_Page` | `Recommended` | ![Development](https://img.shields.io/badge/-development-blue) | +| `requestStart` | double | The time immediately before the browser starts requesting the resource from the server, cache, or local resource. If the transport connection fails and the browser retires the request, the value returned will be the start of the retry request, and it is measured in milliseconds. | `506.70000000298023` | `Recommended` | ![Development](https://img.shields.io/badge/-development-blue) | +| `responseEnd` | double | The time immediately after the browser receives the last byte of the resource or immediately before the transport connection is closed, whichever comes first, and it is measured in milliseconds. | `510.6000000014906` | `Recommended` | ![Development](https://img.shields.io/badge/-development-blue) | +| `responseStart` | double | The time immediately after the browser receives the first byte of the response from the server, cache, or local resource, and it is measured in milliseconds. | `508.6000000014901` | `Recommended` | ![Development](https://img.shields.io/badge/-development-blue) | +| `secureConnectionStart` | double | The time immediately before immediately before the browser starts the handshake process to secure the current connection, and it is measured in milliseconds. | `476.6000000014903` | `Recommended` | ![Development](https://img.shields.io/badge/-development-blue) | + + + + + + +[DocumentStatus]: https://opentelemetry.io/docs/specs/otel/document-status diff --git a/model/browser/events.yaml b/model/browser/events.yaml index cc42dde910..7f4131e64a 100644 --- a/model/browser/events.yaml +++ b/model/browser/events.yaml @@ -11,21 +11,18 @@ groups: This event captures data from the [ResourceTiming](https://www.w3.org/TR/resource-timing/). It is recommended to be captured by using the PerformanceResourceTiming API. If the page starts unloading before the page loads, - then the partial data can be captured by calling the [performance.getEntriesByType][https://developer.mozilla.org/en-US/docs/Web/API/Performance/getEntriesByType] method. + then the partial data can be captured by calling the [performance.getEntriesByType](https://developer.mozilla.org/en-US/docs/Web/API/Performance/getEntriesByType) method. - This event definition elevates a few key data points to body fields in - order to make it easier to access. In addition, the complete set of data - from the API may be sent in the body of the event as stringified JSON. body: id: browser.resource_timing requirement_level: required stability: development type: map fields: - - id: name + - id: name type: string stability: development - brief: The resolved URL of the requested resource. + brief: The resolved URL of the requested resource. requirement_level: recommended examples: ["https://en.wikipedia.org/wiki/Main_Page"] - id: fetchStart @@ -72,8 +69,8 @@ groups: type: double stability: development brief: > - The time immediately after the browser finishes establishing the connection to the server to retrieve the resource. - The timestamp value includes the time interval to establish the transport connection, + The time immediately after the browser finishes establishing the connection to the server to retrieve the resource. + The timestamp value includes the time interval to establish the transport connection, as well as other time intervals such as SSL handshake and SOCKS authentication. completes, and it is measured in milliseconds. requirement_level: recommended