diff --git a/docs/browser/events.md b/docs/browser/events.md new file mode 100644 index 0000000000..938537ee3d --- /dev/null +++ b/docs/browser/events.md @@ -0,0 +1,47 @@ + + +# Semantic conventions for Browser events + +**Status**: [Development][DocumentStatus] + +This document defines semantic conventions for browser (web) instrumentations +that emit events. + +## Navigation Timing Event + + + + + + + + +**Status:** ![Development](https://img.shields.io/badge/-development-blue) + +The event name MUST be `browser.navigation_timing`. + +This event describes the timing metrics of a page navigation as provided by the PerformanceNavigationTiming Performance API. + +This event captures data from the [Navigation Timing API](https://www.w3.org/TR/navigation-timing-2/). It is recommended to be captured by using the PerformanceObserver API, or when the window load event fires. 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. +This event definition elevates a few key data points to body fields in order to make it easier to access. In addition, the complete set of data from the API may be sent in the body of the event as stringified JSON. + +**Body fields:** + +| Body Field | Type | Description | Examples | [Requirement Level](https://opentelemetry.io/docs/specs/semconv/general/attribute-requirement-level/) | Stability | +|---|---|---|---|---|---| +| `domComplete` | double | The time immediately before the user agent sets the document's readyState to "complete". The value is relative to the start of the navigation, and it is measured in milliseconds. | `506.5` | `Recommended` | ![Development](https://img.shields.io/badge/-development-blue) | +| `domContentLoadedEventEnd` | double | The time immediately after the current document's DOMContentLoaded event handler completes. The value is relative to the start of the navigation, and it is measured in milliseconds. | `189.0` | `Recommended` | ![Development](https://img.shields.io/badge/-development-blue) | +| `domInteractive` | double | the time immediately before the user agent sets the document's readyState to "interactive". The value is relative to the start of the navigation, and it is measured in milliseconds. | `147.70000000018626` | `Recommended` | ![Development](https://img.shields.io/badge/-development-blue) | +| `fetchStart` | double | The time immediately before the browser starts to fetch the resource. The value is relative to the start of the navigation, and it is measured in milliseconds. | `9.600000000558794` | `Recommended` | ![Development](https://img.shields.io/badge/-development-blue) | +| `loadEventEnd` | double | The time immediately after the current document's load event handler completes. The value is relative to the start of the navigation, and it is measured in milliseconds. | `506.70000000018626` | `Recommended` | ![Development](https://img.shields.io/badge/-development-blue) | +| `name` | string | The resolved URL of the requested resource. | `https://en.wikipedia.org/wiki/Main_Page` | `Recommended` | ![Development](https://img.shields.io/badge/-development-blue) | +| `unloadEventStart` | double | The time immediately before the current document's unload event handler starts. The value is relative to the start of the navigation, and it is measured in milliseconds. | `0.0` | `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 new file mode 100644 index 0000000000..a064024ecd --- /dev/null +++ b/model/browser/events.yaml @@ -0,0 +1,85 @@ +groups: + - id: event.browser.navigation_timing + stability: development + type: event + name: browser.navigation_timing + brief: > + This event describes the timing metrics of a page navigation as provided + by the PerformanceNavigationTiming Performance API. + note: > + This event captures data from the [Navigation Timing API](https://www.w3.org/TR/navigation-timing-2/). + It is recommended to be captured by using the PerformanceObserver API, or + when the window load event fires. 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. + + This event definition elevates a few key data points to body fields in + order to make it easier to access. In addition, the complete set of data + from the API may be sent in the body of the event as stringified JSON. + body: + id: browser.navigation_timing + requirement_level: required + stability: development + type: map + fields: + - id: name + type: string + stability: development + brief: The resolved URL of the requested resource. + requirement_level: recommended + examples: ["https://en.wikipedia.org/wiki/Main_Page"] + - id: fetchStart + type: double + stability: development + brief: > + The time immediately before the browser starts to fetch the + resource. The value is relative to the start of the navigation, and + it is measured in milliseconds. + requirement_level: recommended + examples: [9.600000000558794] + - id: unloadEventStart + type: double + stability: development + brief: > + The time immediately before the current document's unload event + handler starts. The value is relative to the start of the + navigation, and it is measured in milliseconds. + requirement_level: recommended + examples: [0.0] + - id: domInteractive + type: double + stability: development + brief: > + the time immediately before the user agent sets the document's + readyState to "interactive". The value is relative to the start of + the navigation, and it is measured in milliseconds. + requirement_level: recommended + examples: [147.70000000018626] + - id: domContentLoadedEventEnd + type: double + stability: development + brief: > + The time immediately after the current document's DOMContentLoaded + event handler completes. The value is relative to the start of the + navigation, and it is measured in milliseconds. + requirement_level: recommended + examples: [189.0] + - id: domComplete + type: double + stability: development + brief: > + The time immediately before the user agent sets the document's + readyState to "complete". The value is relative to the start of the + navigation, and it is measured in milliseconds. + requirement_level: recommended + examples: [506.5] + - id: loadEventEnd + type: double + stability: development + brief: > + The time immediately after the current document's load event handler + completes. The value is relative to the start of the navigation, and + it is measured in milliseconds. + requirement_level: recommended + examples: [506.70000000018626]