Skip to content
Open
Show file tree
Hide file tree
Changes from 13 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .chloggen/browser-resource-timing.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Use this changelog template to create an entry for release notes.
#
# If your change doesn't affect end users you should instead start
# your pull request title with [chore] or use the "Skip Changelog" label.

# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: new_component

# The name of the area of concern in the attributes-registry, (e.g. http, cloud, db)
component: browser

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Add `browser.resource_timing` event.

# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
# The values here must be integers.
issues: [3069]

# (Optional) One or more lines of additional information to render under the primary note.
# These lines will be padded with 2 spaces and then inserted directly into the document.
# Use pipe (|) for multiline entries.
subtext:
64 changes: 62 additions & 2 deletions docs/browser/browser-events.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ that emit events.

The event name MUST be `browser.web_vital`.

This event describes the website performance metrics introduced by Google, See [web vitals](https://web.dev/vitals).
This event describes the website performance metrics introduced by Google. See [web vitals](https://web.dev/vitals).

**Body fields:**

Expand All @@ -43,12 +43,72 @@ semantic convention tooling supports complex attributes
|---|---|---|
| `cls` | Cumulative Layout Shift. See [cls](https://web.dev/articles/cls). | ![Development](https://img.shields.io/badge/-development-blue) |
| `fid` | First Input Delay. See [fid](https://web.dev/articles/fid). | ![Development](https://img.shields.io/badge/-development-blue) |
| `inp` | Interation to Next Paint. See [inp](https://web.dev/articles/inp). | ![Development](https://img.shields.io/badge/-development-blue) |
| `inp` | Interaction to Next Paint. See [inp](https://web.dev/articles/inp). | ![Development](https://img.shields.io/badge/-development-blue) |
| `lcp` | Largest Contentful Paint. See [lcp](https://web.dev/articles/lcp). | ![Development](https://img.shields.io/badge/-development-blue) |

<!-- markdownlint-restore -->
<!-- prettier-ignore-end -->
<!-- END AUTOGENERATED TEXT -->
<!-- endsemconv -->

## Resource Timing Event

<!-- semconv event.browser.resource_timing -->
<!-- NOTE: THIS TEXT IS AUTOGENERATED. DO NOT EDIT BY HAND. -->
<!-- see templates/registry/markdown/snippet.md.j2 -->
<!-- prettier-ignore-start -->
<!-- markdownlint-capture -->
<!-- markdownlint-disable -->

**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.

**Attributes:**

| Key | Stability | [Requirement Level](https://opentelemetry.io/docs/specs/semconv/general/attribute-requirement-level/) | Value Type | Description | Example Values |
|---|---|---|---|---|---|
| [`browser.resource_timing.url.canonical`](/docs/registry/attributes/browser.md) | ![Development](https://img.shields.io/badge/-development-blue) | `Required` | string | The canonical URL of the resource, excluding query parameters and credentials [1] | `https://example.com/path/to/resource.js`; `https://cdn.example.com/styles/main.css` |
| [`browser.resource_timing.connect_end`](/docs/registry/attributes/browser.md) | ![Development](https://img.shields.io/badge/-development-blue) | `Recommended` | double | Time immediately after the browser completes establishing the connection to the server [2] | `145.7`; `275.2` |
| [`browser.resource_timing.connect_start`](/docs/registry/attributes/browser.md) | ![Development](https://img.shields.io/badge/-development-blue) | `Recommended` | double | Time immediately before the browser starts to establish the connection to the server [3] | `131.0`; `261.3` |
| [`browser.resource_timing.domain_lookup_end`](/docs/registry/attributes/browser.md) | ![Development](https://img.shields.io/badge/-development-blue) | `Recommended` | double | Time immediately after the browser completes the domain name lookup for the resource [4] | `130.2`; `260.5` |
| [`browser.resource_timing.domain_lookup_start`](/docs/registry/attributes/browser.md) | ![Development](https://img.shields.io/badge/-development-blue) | `Recommended` | double | Time immediately before the browser starts the domain name lookup for the resource [5] | `125.3`; `255.8` |
| [`browser.resource_timing.fetch_start`](/docs/registry/attributes/browser.md) | ![Development](https://img.shields.io/badge/-development-blue) | `Recommended` | double | Time immediately before the browser starts to fetch the resource [6] | `120.5`; `250.75` |
| [`browser.resource_timing.request_start`](/docs/registry/attributes/browser.md) | ![Development](https://img.shields.io/badge/-development-blue) | `Recommended` | double | Time immediately before the browser starts requesting the resource from the server [7] | `146.0`; `276.0` |
| [`browser.resource_timing.response_end`](/docs/registry/attributes/browser.md) | ![Development](https://img.shields.io/badge/-development-blue) | `Recommended` | double | Time immediately after the browser receives the last byte of the resource [8] | `220.3`; `350.5` |
| [`browser.resource_timing.response_start`](/docs/registry/attributes/browser.md) | ![Development](https://img.shields.io/badge/-development-blue) | `Recommended` | double | Time immediately after the browser receives the first byte of the response from the server [9] | `180.5`; `310.8` |
| [`browser.resource_timing.secure_connection_start`](/docs/registry/attributes/browser.md) | ![Development](https://img.shields.io/badge/-development-blue) | `Recommended` | double | Time immediately before the browser starts the handshake process to secure the connection [10] | `132.5`; `262.8` |
| [`browser.resource_timing.url.query`](/docs/registry/attributes/browser.md) | ![Development](https://img.shields.io/badge/-development-blue) | `Opt-In` | string | The query string component of the resource URL [11] | `?version=1.2.3`; `?id=abc123&type=json` |

**[1] `browser.resource_timing.url.canonical`:** This is the canonical URL of the resource being measured, not the page URL. It represents the resource in its standard form for identification purposes. The canonical URL includes the scheme (if present), full domain, and path only. Query strings and credentials MUST be excluded to reduce cardinality and avoid capturing PII. For example, `https://www.example.com/path?a=b&c=d` would be captured as `https://www.example.com/path`. In JavaScript, this typically corresponds to `${url.origin}${url.pathname}` or `${location.protocol}//${location.host}${location.pathname}`.

**[2] `browser.resource_timing.connect_end`:** Measured in milliseconds as a DOMHighResTimeStamp relative to the time origin. See the [Performance Resource Timing API](https://www.w3.org/TR/resource-timing-2/#dom-performanceresourcetiming-connectend).

**[3] `browser.resource_timing.connect_start`:** Measured in milliseconds as a DOMHighResTimeStamp relative to the time origin. See the [Performance Resource Timing API](https://www.w3.org/TR/resource-timing-2/#dom-performanceresourcetiming-connectstart).

**[4] `browser.resource_timing.domain_lookup_end`:** Measured in milliseconds as a DOMHighResTimeStamp relative to the time origin. See the [Performance Resource Timing API](https://www.w3.org/TR/resource-timing-2/#dom-performanceresourcetiming-domainlookupend).

**[5] `browser.resource_timing.domain_lookup_start`:** Measured in milliseconds as a DOMHighResTimeStamp relative to the time origin. See the [Performance Resource Timing API](https://www.w3.org/TR/resource-timing-2/#dom-performanceresourcetiming-domainlookupstart).

**[6] `browser.resource_timing.fetch_start`:** Measured in milliseconds as a DOMHighResTimeStamp relative to the time origin. See the [Performance Resource Timing API](https://www.w3.org/TR/resource-timing-2/#dom-performanceresourcetiming-fetchstart).

**[7] `browser.resource_timing.request_start`:** Measured in milliseconds as a DOMHighResTimeStamp relative to the time origin. See the [Performance Resource Timing API](https://www.w3.org/TR/resource-timing-2/#dom-performanceresourcetiming-requeststart).

**[8] `browser.resource_timing.response_end`:** Measured in milliseconds as a DOMHighResTimeStamp relative to the time origin. See the [Performance Resource Timing API](https://www.w3.org/TR/resource-timing-2/#dom-performanceresourcetiming-responseend).

**[9] `browser.resource_timing.response_start`:** Measured in milliseconds as a DOMHighResTimeStamp relative to the time origin. See the [Performance Resource Timing API](https://www.w3.org/TR/resource-timing-2/#dom-performanceresourcetiming-responsestart).

**[10] `browser.resource_timing.secure_connection_start`:** Measured in milliseconds as a DOMHighResTimeStamp relative to the time origin. If the scheme is not HTTPS, this value is 0. See the [Performance Resource Timing API](https://www.w3.org/TR/resource-timing-2/#dom-performanceresourcetiming-secureconnectionstart).

**[11] `browser.resource_timing.url.query`:** This attribute is opt-in due to potential high cardinality and PII concerns. Sensitive content provided in the query string SHOULD be scrubbed when instrumentations can identify it. Use this attribute when query parameters are relevant to the resource being fetched (e.g., image dimensions, format specifications).

<!-- markdownlint-restore -->
<!-- prettier-ignore-end -->
<!-- END AUTOGENERATED TEXT -->
<!-- endsemconv -->

[DocumentStatus]: https://opentelemetry.io/docs/specs/otel/document-status
45 changes: 45 additions & 0 deletions docs/registry/attributes/browser.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@

# Browser

- [Browser Attributes](#browser-attributes)
- [Browser Resource Timing Attributes](#browser-resource-timing-attributes)

## Browser Attributes

The web browser attributes
Expand All @@ -24,3 +27,45 @@ The web browser attributes

**[4] `browser.platform`:** This value is intended to be taken from the [UA client hints API](https://wicg.github.io/ua-client-hints/#interface) (`navigator.userAgentData.platform`). If unavailable, the legacy `navigator.platform` API SHOULD NOT be used instead and this attribute SHOULD be left unset in order for the values to be consistent.
The list of possible values is defined in the [W3C User-Agent Client Hints specification](https://wicg.github.io/ua-client-hints/#sec-ch-ua-platform). Note that some (but not all) of these values can overlap with values in the [`os.type` and `os.name` attributes](./os.md). However, for consistency, the values in the `browser.platform` attribute should capture the exact value that the user agent provides.

## Browser Resource Timing Attributes

Attributes for browser resource timing events

**Attributes:**

| Key | Stability | Value Type | Description | Example Values |
|---|---|---|---|---|
| <a id="browser-resource-timing-connect-end" href="#browser-resource-timing-connect-end">`browser.resource_timing.connect_end`</a> | ![Development](https://img.shields.io/badge/-development-blue) | double | Time immediately after the browser completes establishing the connection to the server [5] | `145.7`; `275.2` |
| <a id="browser-resource-timing-connect-start" href="#browser-resource-timing-connect-start">`browser.resource_timing.connect_start`</a> | ![Development](https://img.shields.io/badge/-development-blue) | double | Time immediately before the browser starts to establish the connection to the server [6] | `131.0`; `261.3` |
| <a id="browser-resource-timing-domain-lookup-end" href="#browser-resource-timing-domain-lookup-end">`browser.resource_timing.domain_lookup_end`</a> | ![Development](https://img.shields.io/badge/-development-blue) | double | Time immediately after the browser completes the domain name lookup for the resource [7] | `130.2`; `260.5` |
| <a id="browser-resource-timing-domain-lookup-start" href="#browser-resource-timing-domain-lookup-start">`browser.resource_timing.domain_lookup_start`</a> | ![Development](https://img.shields.io/badge/-development-blue) | double | Time immediately before the browser starts the domain name lookup for the resource [8] | `125.3`; `255.8` |
| <a id="browser-resource-timing-fetch-start" href="#browser-resource-timing-fetch-start">`browser.resource_timing.fetch_start`</a> | ![Development](https://img.shields.io/badge/-development-blue) | double | Time immediately before the browser starts to fetch the resource [9] | `120.5`; `250.75` |
| <a id="browser-resource-timing-request-start" href="#browser-resource-timing-request-start">`browser.resource_timing.request_start`</a> | ![Development](https://img.shields.io/badge/-development-blue) | double | Time immediately before the browser starts requesting the resource from the server [10] | `146.0`; `276.0` |
| <a id="browser-resource-timing-response-end" href="#browser-resource-timing-response-end">`browser.resource_timing.response_end`</a> | ![Development](https://img.shields.io/badge/-development-blue) | double | Time immediately after the browser receives the last byte of the resource [11] | `220.3`; `350.5` |
| <a id="browser-resource-timing-response-start" href="#browser-resource-timing-response-start">`browser.resource_timing.response_start`</a> | ![Development](https://img.shields.io/badge/-development-blue) | double | Time immediately after the browser receives the first byte of the response from the server [12] | `180.5`; `310.8` |
| <a id="browser-resource-timing-secure-connection-start" href="#browser-resource-timing-secure-connection-start">`browser.resource_timing.secure_connection_start`</a> | ![Development](https://img.shields.io/badge/-development-blue) | double | Time immediately before the browser starts the handshake process to secure the connection [13] | `132.5`; `262.8` |
| <a id="browser-resource-timing-url-canonical" href="#browser-resource-timing-url-canonical">`browser.resource_timing.url.canonical`</a> | ![Development](https://img.shields.io/badge/-development-blue) | string | The canonical URL of the resource, excluding query parameters and credentials [14] | `https://example.com/path/to/resource.js`; `https://cdn.example.com/styles/main.css` |
| <a id="browser-resource-timing-url-query" href="#browser-resource-timing-url-query">`browser.resource_timing.url.query`</a> | ![Development](https://img.shields.io/badge/-development-blue) | string | The query string component of the resource URL [15] | `?version=1.2.3`; `?id=abc123&type=json` |

**[5] `browser.resource_timing.connect_end`:** Measured in milliseconds as a DOMHighResTimeStamp relative to the time origin. See the [Performance Resource Timing API](https://www.w3.org/TR/resource-timing-2/#dom-performanceresourcetiming-connectend).

**[6] `browser.resource_timing.connect_start`:** Measured in milliseconds as a DOMHighResTimeStamp relative to the time origin. See the [Performance Resource Timing API](https://www.w3.org/TR/resource-timing-2/#dom-performanceresourcetiming-connectstart).

**[7] `browser.resource_timing.domain_lookup_end`:** Measured in milliseconds as a DOMHighResTimeStamp relative to the time origin. See the [Performance Resource Timing API](https://www.w3.org/TR/resource-timing-2/#dom-performanceresourcetiming-domainlookupend).

**[8] `browser.resource_timing.domain_lookup_start`:** Measured in milliseconds as a DOMHighResTimeStamp relative to the time origin. See the [Performance Resource Timing API](https://www.w3.org/TR/resource-timing-2/#dom-performanceresourcetiming-domainlookupstart).

**[9] `browser.resource_timing.fetch_start`:** Measured in milliseconds as a DOMHighResTimeStamp relative to the time origin. See the [Performance Resource Timing API](https://www.w3.org/TR/resource-timing-2/#dom-performanceresourcetiming-fetchstart).

**[10] `browser.resource_timing.request_start`:** Measured in milliseconds as a DOMHighResTimeStamp relative to the time origin. See the [Performance Resource Timing API](https://www.w3.org/TR/resource-timing-2/#dom-performanceresourcetiming-requeststart).

**[11] `browser.resource_timing.response_end`:** Measured in milliseconds as a DOMHighResTimeStamp relative to the time origin. See the [Performance Resource Timing API](https://www.w3.org/TR/resource-timing-2/#dom-performanceresourcetiming-responseend).

**[12] `browser.resource_timing.response_start`:** Measured in milliseconds as a DOMHighResTimeStamp relative to the time origin. See the [Performance Resource Timing API](https://www.w3.org/TR/resource-timing-2/#dom-performanceresourcetiming-responsestart).

**[13] `browser.resource_timing.secure_connection_start`:** Measured in milliseconds as a DOMHighResTimeStamp relative to the time origin. If the scheme is not HTTPS, this value is 0. See the [Performance Resource Timing API](https://www.w3.org/TR/resource-timing-2/#dom-performanceresourcetiming-secureconnectionstart).

**[14] `browser.resource_timing.url.canonical`:** The canonical URL includes scheme, domain, and path components only. Query parameters and URL fragments MUST be excluded. User credentials (username and password) MUST be excluded.

**[15] `browser.resource_timing.url.query`:** The query string includes the leading `?` character. This attribute is opt-in as it may contain sensitive information.
Loading
Loading