Skip to content
Open
Show file tree
Hide file tree
Changes from 7 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:
4 changes: 2 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,7 +43,7 @@ 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 -->
Expand Down
55 changes: 55 additions & 0 deletions docs/browser/events.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<!--- Hugo front matter used to generate the website version of this page:
linkTitle: Events
--->

# Semantic conventions for browser events

**Status**: [Development][DocumentStatus]

This document defines semantic conventions for browser (web) instrumentations
that emit events.

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

**Body fields:**

:warning: Body fields will be moved to complex attributes once the
semantic convention tooling supports complex attributes
(see [#1870](https://github.com/open-telemetry/semantic-conventions/issues/1870)).

| Field Name | Stability | [Requirement Level](https://opentelemetry.io/docs/specs/semconv/general/attribute-requirement-level/) | Value Type | Description | Example Values |
|---|---|---|---|---|---|
| `connectEnd` | ![Development](https://img.shields.io/badge/-development-blue) | `Recommended` | double | The [time](https://developer.mozilla.org/en-US/docs/Web/API/DOMHighResTimeStamp) immediately after the browser finishes establishing the connection to the server to retrieve the resource, in milliseconds. See [connectEnd](https://developer.mozilla.org/en-US/docs/Web/API/PerformanceResourceTiming/connectEnd). | `476.6000000014906` |
| `connectStart` | ![Development](https://img.shields.io/badge/-development-blue) | `Recommended` | double | The [time](https://developer.mozilla.org/en-US/docs/Web/API/DOMHighResTimeStamp) immediately before the user agent starts establishing the connection to the server to retrieve the resource, in milliseconds. See [connectStart](https://developer.mozilla.org/en-US/docs/Web/API/PerformanceResourceTiming/connectStart). | `476.6000000014901` |
| `domainLookupEnd` | ![Development](https://img.shields.io/badge/-development-blue) | `Recommended` | double | The [time](https://developer.mozilla.org/en-US/docs/Web/API/DOMHighResTimeStamp) immediately after the browser finishes the domain name lookup for the resource, in milliseconds. See [domainLookupEnd](https://developer.mozilla.org/en-US/docs/Web/API/PerformanceResourceTiming/domainLookupEnd). | `100.6000000014906` |
| `domainLookupStart` | ![Development](https://img.shields.io/badge/-development-blue) | `Recommended` | double | The [time](https://developer.mozilla.org/en-US/docs/Web/API/DOMHighResTimeStamp) immediately before the browser starts the domain name lookup for the resource, in milliseconds. See [domainLookupStart](https://developer.mozilla.org/en-US/docs/Web/API/PerformanceResourceTiming/domainLookupStart). | `100.6000000014901` |
| `fetchStart` | ![Development](https://img.shields.io/badge/-development-blue) | `Recommended` | double | The [time](https://developer.mozilla.org/en-US/docs/Web/API/DOMHighResTimeStamp) immediately before the browser starts to fetch the resource, in milliseconds. See [fetchStart](https://developer.mozilla.org/en-US/docs/Web/API/PerformanceResourceTiming/fetchStart). | `9.600000000558794` |
| `requestStart` | ![Development](https://img.shields.io/badge/-development-blue) | `Recommended` | double | The [time](https://developer.mozilla.org/en-US/docs/Web/API/DOMHighResTimeStamp) immediately before the browser starts requesting the resource from the server, cache, or local resource, in milliseconds. See [requestStart](https://developer.mozilla.org/en-US/docs/Web/API/PerformanceResourceTiming/requestStart). | `506.70000000298023` |
| `responseEnd` | ![Development](https://img.shields.io/badge/-development-blue) | `Recommended` | double | The [time](https://developer.mozilla.org/en-US/docs/Web/API/DOMHighResTimeStamp) immediately after the browser receives the last byte of the resource or immediately before the transport connection is closed, whichever comes first, in milliseconds. See [responseEnd](https://developer.mozilla.org/en-US/docs/Web/API/PerformanceResourceTiming/responseEnd). | `510.6000000014906` |
| `responseStart` | ![Development](https://img.shields.io/badge/-development-blue) | `Recommended` | double | The [time](https://developer.mozilla.org/en-US/docs/Web/API/DOMHighResTimeStamp) immediately after the browser receives the first byte of the response from the server, cache, or local resource, in milliseconds. See [responseStart](https://developer.mozilla.org/en-US/docs/Web/API/PerformanceResourceTiming/responseStart). | `508.6000000014901` |
| `secureConnectionStart` | ![Development](https://img.shields.io/badge/-development-blue) | `Recommended` | double | The [time](https://developer.mozilla.org/en-US/docs/Web/API/DOMHighResTimeStamp) immediately before the browser starts the handshake process to secure the current connection, in milliseconds. See [secureConnectionStart](https://developer.mozilla.org/en-US/docs/Web/API/PerformanceResourceTiming/secureConnectionStart). | `476.6000000014903` |
| `url` | ![Development](https://img.shields.io/badge/-development-blue) | `Required` | string | The full URL of the resource being fetched. [1] | `https://www.example.com/path`; `//localhost` |
Copy link
Contributor

@thompson-tomo thompson-tomo Nov 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why don't we make this file.path and have it as an attribute? If we don't create a dedicated span

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not all resources are files. ResourceTiming also applies to fetch, xhr, and beacon.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For fetch/xhr/Beacon why aren't we using the standard http client span? We can use the pr linked in my other comment to handle capturing the timing details.


**[1]:** This is the URL of the resource being measured, not the page 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://user:[email protected]/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.

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

[DocumentStatus]: https://opentelemetry.io/docs/specs/otel/document-status
115 changes: 113 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,114 @@ 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.
body:
id: browser.resource_timing
requirement_level: required
stability: development
type: map
fields:
- id: url
type: string
stability: development
brief: The full URL of the resource being fetched.
requirement_level: required
examples: ["https://www.example.com/path", "//localhost"]
note: >
This is the URL of the resource being measured, not the page 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://user:[email protected]/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.
- id: fetchStart
type: double
stability: development
brief: >
The [time](https://developer.mozilla.org/en-US/docs/Web/API/DOMHighResTimeStamp) immediately before
the browser starts to fetch the resource, in milliseconds.
See [fetchStart](https://developer.mozilla.org/en-US/docs/Web/API/PerformanceResourceTiming/fetchStart).
requirement_level: recommended
examples: [9.600000000558794]
- id: domainLookupStart
type: double
stability: development
brief: >
The [time](https://developer.mozilla.org/en-US/docs/Web/API/DOMHighResTimeStamp) immediately before
the browser starts the domain name lookup for the resource, in milliseconds.
See [domainLookupStart](https://developer.mozilla.org/en-US/docs/Web/API/PerformanceResourceTiming/domainLookupStart).
requirement_level: recommended
examples: [100.6000000014901]
- id: domainLookupEnd
type: double
stability: development
brief: >
The [time](https://developer.mozilla.org/en-US/docs/Web/API/DOMHighResTimeStamp) immediately after
the browser finishes the domain name lookup for the resource, in milliseconds.
See [domainLookupEnd](https://developer.mozilla.org/en-US/docs/Web/API/PerformanceResourceTiming/domainLookupEnd).
requirement_level: recommended
examples: [100.6000000014906]
- id: connectStart
type: double
stability: development
brief: >
The [time](https://developer.mozilla.org/en-US/docs/Web/API/DOMHighResTimeStamp) immediately before
the user agent starts establishing the connection to the server to retrieve the resource, in milliseconds.
See [connectStart](https://developer.mozilla.org/en-US/docs/Web/API/PerformanceResourceTiming/connectStart).
requirement_level: recommended
examples: [476.6000000014901]
- id: secureConnectionStart
type: double
stability: development
brief: >
The [time](https://developer.mozilla.org/en-US/docs/Web/API/DOMHighResTimeStamp) immediately before
the browser starts the handshake process to secure the current connection, in milliseconds.
See [secureConnectionStart](https://developer.mozilla.org/en-US/docs/Web/API/PerformanceResourceTiming/secureConnectionStart).
requirement_level: recommended
examples: [476.6000000014903]
- id: connectEnd
type: double
stability: development
brief: >
The [time](https://developer.mozilla.org/en-US/docs/Web/API/DOMHighResTimeStamp) immediately after
the browser finishes establishing the connection to the server to retrieve the resource, in milliseconds.
See [connectEnd](https://developer.mozilla.org/en-US/docs/Web/API/PerformanceResourceTiming/connectEnd).
requirement_level: recommended
examples: [476.6000000014906]
- id: requestStart
type: double
stability: development
brief: >
The [time](https://developer.mozilla.org/en-US/docs/Web/API/DOMHighResTimeStamp) immediately before
the browser starts requesting the resource from the server, cache, or local resource, in milliseconds.
See [requestStart](https://developer.mozilla.org/en-US/docs/Web/API/PerformanceResourceTiming/requestStart).
requirement_level: recommended
examples: [506.70000000298023]
- id: responseStart
type: double
stability: development
brief: >
The [time](https://developer.mozilla.org/en-US/docs/Web/API/DOMHighResTimeStamp) immediately after
the browser receives the first byte of the response from the server, cache, or local resource, in milliseconds.
See [responseStart](https://developer.mozilla.org/en-US/docs/Web/API/PerformanceResourceTiming/responseStart).
requirement_level: recommended
examples: [508.6000000014901]
- id: responseEnd
type: double
stability: development
brief: >
The [time](https://developer.mozilla.org/en-US/docs/Web/API/DOMHighResTimeStamp) immediately after
the browser receives the last byte of the resource or immediately before the transport connection is closed, whichever comes first,
in milliseconds. See [responseEnd](https://developer.mozilla.org/en-US/docs/Web/API/PerformanceResourceTiming/responseEnd).
requirement_level: recommended
examples: [510.6000000014906]
Loading