Skip to content
Closed
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: [1943]

# (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:
46 changes: 46 additions & 0 deletions docs/browser/events.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,50 @@ semantic convention tooling supports complex attributes
<!-- 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.

| Attribute | Type | Description | Examples | [Requirement Level](https://opentelemetry.io/docs/specs/semconv/general/attribute-requirement-level/) | Stability |
|---|---|---|---|---|---|
| [`url.full`](/docs/attributes-registry/url.md) | string | Absolute URL describing a network resource according to [RFC3986](https://www.rfc-editor.org/rfc/rfc3986) [1] | `https://www.foo.bar/search?q=OpenTelemetry#SemConv`; `//localhost` | `Required` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) |

**[1] `url.full`:** 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.

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

| Body Field | Type | Description | Examples | [Requirement Level](https://opentelemetry.io/docs/specs/semconv/general/attribute-requirement-level/) | Stability |
|---|---|---|---|---|---|
| `connectEnd` | 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` | `Recommended` | ![Development](https://img.shields.io/badge/-development-blue) |
| `connectStart` | 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` | `Recommended` | ![Development](https://img.shields.io/badge/-development-blue) |
| `domainLookupEnd` | 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` | `Recommended` | ![Development](https://img.shields.io/badge/-development-blue) |
| `domainLookupStart` | 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` | `Recommended` | ![Development](https://img.shields.io/badge/-development-blue) |
| `fetchStart` | 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` | `Recommended` | ![Development](https://img.shields.io/badge/-development-blue) |
| `requestStart` | 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` | `Recommended` | ![Development](https://img.shields.io/badge/-development-blue) |
| `responseEnd` | 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` | `Recommended` | ![Development](https://img.shields.io/badge/-development-blue) |
| `responseStart` | 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` | `Recommended` | ![Development](https://img.shields.io/badge/-development-blue) |
| `secureConnectionStart` | 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` | `Recommended` | ![Development](https://img.shields.io/badge/-development-blue) |

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

[DocumentStatus]: https://opentelemetry.io/docs/specs/otel/document-status
107 changes: 107 additions & 0 deletions model/browser/events.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,110 @@ 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: url.full
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this URL is for the resource described by this event, not the page URL, correct? I think we should note this in the description of this attribute, so that it is clear.

Also, if this is the resource URL, why is it listed as an attribute rather than a body field like the measurements?

requirement_level: required
note: >
Generally the url doesn't include any query strings or any leading credentials,
Comment on lines +69 to +72
Copy link
Member

Choose a reason for hiding this comment

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

@open-telemetry/specs-semconv-maintainers do you see any issue with using url.full for something that doesn't include the query string?

Choose a reason for hiding this comment

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

Some platforms use querystring params to resize images. If you strip it down to just domain and path, you won't have a complete picture of which size assets loaded. I understand the high cardinality issue but wanted to call this case out.

Choose a reason for hiding this comment

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

Should we include query string separately?

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.
body:
id: browser.resource_timing
requirement_level: required
stability: development
type: map
fields:
- 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