Skip to content

feat: add browser semantic conventions - #14

Merged
overbalance merged 4 commits into
open-telemetry:mainfrom
martinkuba:add-browser-semconv
Oct 15, 2026
Merged

overbalance merged 4 commits into
open-telemetry:mainfrom
martinkuba:add-browser-semconv

Conversation

@martinkuba

@martinkuba martinkuba commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Ports the browser conventions from open-telemetry/opentelemetry-browser#404, migrated from
weaver v1 to definition/2.

Scope is browser-specific only: 33 attributes and 4 events covering
PerformanceNavigationTiming, PerformanceResourceTiming, the console method, and the
navigation type / same-document / hash-change attributes.

Left out of this PR

  • the browser.user_action.click attributes, which duplicate upstream's
    event.app.widget.click (already in v1.44.0) and belong in a shared client-side namespace
  • span.browser.http.client, which only restates an upstream attribute's requirement level
  • imports: of browser.web_vital and exception, which exist in the source repo for
    its code generation.

Verified locally against that branch: make check-policies and make test pass, and make generate-all produces 33 attributes, 4 events and 1 group.

@martinkuba
martinkuba force-pushed the add-browser-semconv branch from 58dc2fc to ffe2326 Compare October 6, 2026 15:05

@adityareddy-dev adityareddy-dev left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Went through the three model files and the generated docs, then ran make check-policies and make generate-docs on the branch and again with main merged in. Both clean, and the docs come out byte for byte the same as what's committed. I also checked the names against what the browser SDK emits today and against core v1.44.0. Every attribute and event name matches the SDK exactly and nothing collides with core.

Good to see the Timing-Allow-Origin warning up front in the resource_timing note, a zero that means "not available" is easy to misread in this data.

The comments are small model and wording fixes, nothing that should hold this up for long. The one I'd want fixed before merge is duration on navigation_timing, as it stands that brief is wrong for the event.

Comment thread model/browser/events.yaml Resolved
Comment thread model/browser/attributes.yaml Resolved
Comment thread model/browser/attributes.yaml Resolved
Comment thread model/browser/events.yaml Resolved
Comment thread model/browser/attributes.yaml Resolved
Comment thread model/browser/events.yaml Resolved
Comment thread model/browser/events.yaml
[PerformanceResourceTiming](https://developer.mozilla.org/docs/Web/API/PerformanceResourceTiming)
API.
note: >
The timings are in milliseconds, relative to the time origin of the document.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Could we clarify whether the event timestamp means resource start or completion? The SDK currently emits these during idle time without an explicit timestamp, so it can end up reflecting collection time instead.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I am leaning toward start time, which is useful for performance timelines and waterfalls. I have made that change, but let me know if you feel differently.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Start time is the right call here. It puts the event on the same clock as the resource timing events, and a waterfall needs the start anyway, the duration can be derived from the milestones but not the other way around.

Comment thread model/browser/attributes.yaml Outdated
type: int
stability: development
brief: >
The size, in bytes, of the fetched resource, including the response header fields and the

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Could we call this the browser-reported transfer size? The spec uses a fixed 300 bytes for headers, with different values for cached responses. This wording makes it sound like an exact byte count.

Comment thread model/browser/attributes.yaml Outdated
brief: >
Time of the start of the fetch that initiated the first redirect.
note: >
Zero if there was no redirect, or if a redirect is not same-origin.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cross-origin redirects can expose timings when the timing-allow checks pass. Could we say zero when there's no redirect or those checks fail? Same applies to redirect_end.

@adityareddy-dev adityareddy-dev left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

All six threads came back addressed. Splitting navigation into the Navigation API type and the navigation_timing type reads much cleaner than overloading one attribute, and the severity defaults and the time origin notes close the gaps I flagged. Keeping the raw ALPN value with the note pointing at network.protocol.name and network.protocol.version is the right trade. Approving.

@adityareddy-dev

Copy link
Copy Markdown
Member

One implementation follow-up for the start-time requirement. The current browser resource instrumentation queues entries for idle processing and emits the record without timestamp, and the JS SDK defaults that to emission time. A delayed callback can move the event away from the resource's start in the waterfall.

Could we link the companion SDK change here? I'd add a regression test with a nonzero startTime, hold the idle callback while advancing the clock, then assert that the exported timestamp represents performance.timeOrigin + entry.startTime after the SDK's time conversion. The same assertion should hold when visibilitychange or disable() flushes the queue before that callback runs.

@martinkuba

Copy link
Copy Markdown
Contributor Author

The resource-timing event timestamp is tracked in open-telemetry/opentelemetry-browser#496.

@overbalance
overbalance merged commit 92be411 into open-telemetry:main Oct 15, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants