diff --git a/.chloggen/browser-resource-timing.yaml b/.chloggen/browser-resource-timing.yaml new file mode 100644 index 0000000000..2d1caa6e42 --- /dev/null +++ b/.chloggen/browser-resource-timing.yaml @@ -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: diff --git a/docs/browser/events.md b/docs/browser/events.md index c1aec9abb0..a03216bedb 100644 --- a/docs/browser/events.md +++ b/docs/browser/events.md @@ -51,4 +51,50 @@ semantic convention tooling supports complex attributes +## 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. + +| 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:pwd@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. + +**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) | + + + + + + [DocumentStatus]: https://opentelemetry.io/docs/specs/otel/document-status diff --git a/model/browser/events.yaml b/model/browser/events.yaml index 00fedf7ee2..83d933be0f 100644 --- a/model/browser/events.yaml +++ b/model/browser/events.yaml @@ -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 + requirement_level: required + note: > + 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:pwd@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. + 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]