Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Browser Web Vitals Event #1940

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 5 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
50 changes: 50 additions & 0 deletions docs/browser/events.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<!--- 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.

## WebVital Event

<!-- semconv event.browser.web_vital -->
<!-- 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.web_vital`.

This event describes the website performance metrics introduced by Google, See [web vitals](https://web.dev/vitals).

**Body fields:**

| Body Field | Type | Description | Examples | [Requirement Level](https://opentelemetry.io/docs/specs/semconv/general/attribute-requirement-level/) | Stability |
|---|---|---|---|---|---|
| `delta` | double | The delta between the current value and the last-reported value. | `0.2` | `Required` | ![Development](https://img.shields.io/badge/-development-blue) |
| `id` | string | A unique ID representing this particular metric instance. | `v3-1677874579383-6381583661209` | `Required` | ![Development](https://img.shields.io/badge/-development-blue) |
| `name` | enum | Name of the web vital. | `cls` | `Required` | ![Development](https://img.shields.io/badge/-development-blue) |
| `value` | double | Value of the web vital. | `1.0` | `Required` | ![Development](https://img.shields.io/badge/-development-blue) |
Comment on lines +31 to +34
Copy link
Member

Choose a reason for hiding this comment

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

did you consider cls.delta, cls.id, cls.value etc?


`name` has the following list of well-known values. If one of them applies, then the respective value MUST be used; otherwise, a custom value MAY be used.

| Value | Description | Stability |
|---|---|---|
| `cls` | Cumulative Layout Shift. | ![Development](https://img.shields.io/badge/-development-blue) |
| `fid` | First Input Delay. | ![Development](https://img.shields.io/badge/-development-blue) |
| `inp` | Interation to Next Paint. | ![Development](https://img.shields.io/badge/-development-blue) |
| `lcp` | Largest Contentful Paint. | ![Development](https://img.shields.io/badge/-development-blue) |
Comment on lines +40 to +43
Copy link
Member

Choose a reason for hiding this comment

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

are these values (e.g. cls) coming from the browser / browser spec, or are we creating them?


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

[DocumentStatus]: https://opentelemetry.io/docs/specs/otel/document-status
54 changes: 54 additions & 0 deletions model/browser/events.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
groups:
- id: event.browser.web_vital
stability: development
type: event
name: browser.web_vital
brief: >
This event describes the website performance metrics introduced by Google, See [web vitals](https://web.dev/vitals).
body:
Copy link
Contributor

@breedx-splk breedx-splk Mar 4, 2025

Choose a reason for hiding this comment

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

I would like to see a comment here to clarify that this is temporary or that this will actually be an attribute. That way readers do not expect to find content in the actual body.

id: browser.web_vital
requirement_level: required
stability: development
type: map
fields:
- id: name
type: enum
members:
- id: cls
value: 'cls'
brief: Cumulative Layout Shift.
stability: development
- id: lcp
value: 'lcp'
brief: Largest Contentful Paint.
stability: development
- id: fid
value: 'fid'
brief: First Input Delay.
stability: development
- id: inp
value: 'inp'
brief: Interation to Next Paint.
stability: development
stability: development
brief: Name of the web vital.
requirement_level: required
examples: ["cls"]
- id: value
type: double
stability: development
brief: Value of the web vital.
requirement_level: required
examples: [1.0]
- id: delta
type: double
stability: development
brief: The delta between the current value and the last-reported value.
requirement_level: required
examples: [0.2]
- id: id
type: string
stability: development
brief: A unique ID representing this particular metric instance.
requirement_level: required
examples: ["v3-1677874579383-6381583661209"]
Loading