From b4fe52d5eede1d50f05bfcbc37a7983f1fed78e5 Mon Sep 17 00:00:00 2001 From: Martin Kuba Date: Mon, 17 Feb 2025 21:47:22 -0800 Subject: [PATCH 1/2] added event for capturing browser navigation timing --- model/browser/events.yaml | 85 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 model/browser/events.yaml diff --git a/model/browser/events.yaml b/model/browser/events.yaml new file mode 100644 index 0000000000..eb4c6902cc --- /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: + 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] + - 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] + - 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] From 2eb5f9b8164d3efa6084f2b4dd000548a6f91596 Mon Sep 17 00:00:00 2001 From: Martin Kuba Date: Tue, 18 Feb 2025 08:52:14 -0800 Subject: [PATCH 2/2] add browser.navigation_timing event --- docs/browser/events.md | 47 +++++++++++++++++++++++++++++++++++++++ model/browser/events.yaml | 6 ++--- 2 files changed, 50 insertions(+), 3 deletions(-) create mode 100644 docs/browser/events.md 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 index eb4c6902cc..a064024ecd 100644 --- a/model/browser/events.yaml +++ b/model/browser/events.yaml @@ -26,7 +26,7 @@ groups: - id: name type: string stability: development - brief: + brief: The resolved URL of the requested resource. requirement_level: recommended examples: ["https://en.wikipedia.org/wiki/Main_Page"] - id: fetchStart @@ -46,7 +46,7 @@ groups: handler starts. The value is relative to the start of the navigation, and it is measured in milliseconds. requirement_level: recommended - examples: [0] + examples: [0.0] - id: domInteractive type: double stability: development @@ -64,7 +64,7 @@ groups: event handler completes. The value is relative to the start of the navigation, and it is measured in milliseconds. requirement_level: recommended - examples: [189] + examples: [189.0] - id: domComplete type: double stability: development