Skip to content
Open
Show file tree
Hide file tree
Changes from all 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:
61 changes: 59 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,69 @@ 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`](/docs/registry/attributes/browser.md) | ![Development](https://img.shields.io/badge/-development-blue) | `Required` | string | Absolute URL describing a network resource according to [RFC3986](https://www.rfc-editor.org/rfc/rfc3986) [1] | `https://www.example.com/path`; `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` |

**[1] `browser.resource_timing.url`:** Generally the url doesn't include any query strings or any leading credentials, and it's formatted as scheme://full domain/path only, for example `https://www.example.com/path?a=b&c=d` would be sent as `https://www.example.com/path` by both removing any potential PII and reducing the cardinality of the name.

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

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

[DocumentStatus]: https://opentelemetry.io/docs/specs/otel/document-status
42 changes: 42 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,42 @@ 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" href="#browser-resource-timing-url">`browser.resource_timing.url`</a> | ![Development](https://img.shields.io/badge/-development-blue) | string | Absolute URL describing a network resource according to [RFC3986](https://www.rfc-editor.org/rfc/rfc3986) [14] | `https://www.example.com/path`; `https://cdn.example.com/styles/main.css` |

**[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`:** Generally the url doesn't include any query strings or any leading credentials, and it's formatted as scheme://full domain/path only, for example `https://www.example.com/path?a=b&c=d` would be sent as `https://www.example.com/path` by both removing any potential PII and reducing the cardinality of the name.
38 changes: 36 additions & 2 deletions model/browser/events.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ groups:
type: event
name: browser.web_vital
brief: >
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:
id: browser.web_vital
requirement_level: required
Expand All @@ -28,7 +28,7 @@ groups:
stability: development
- id: inp
value: 'inp'
brief: Interation to Next Paint. See [inp](https://web.dev/articles/inp).
brief: Interaction to Next Paint. See [inp](https://web.dev/articles/inp).
stability: development
stability: development
brief: Name of the web vital.
Expand All @@ -52,3 +52,37 @@ groups:
brief: A unique ID representing this particular metric instance.
requirement_level: required
examples: ["v3-1677874579383-6381583661209"]
- 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.
attributes:
- ref: browser.resource_timing.url
requirement_level: required
- ref: browser.resource_timing.fetch_start
requirement_level: recommended
- ref: browser.resource_timing.domain_lookup_start
requirement_level: recommended
- ref: browser.resource_timing.domain_lookup_end
requirement_level: recommended
- ref: browser.resource_timing.connect_start
requirement_level: recommended
- ref: browser.resource_timing.secure_connection_start
requirement_level: recommended
- ref: browser.resource_timing.connect_end
requirement_level: recommended
- ref: browser.resource_timing.request_start
requirement_level: recommended
- ref: browser.resource_timing.response_start
requirement_level: recommended
- ref: browser.resource_timing.response_end
requirement_level: recommended
Loading
Loading