web: add `WindowLoad` OpenTelemetry auto instrumentation
Created by: valerybugakov
Context
Adds auto instrumentation of the window load event based on Web Performance API navigation
entries.
- Listens to the first Web Performance
navigation
entries update. - Creates the
WINDOW_LOAD
span capturing timings fromFETCH_START
tillLOAD_EVENT_END
. - Adds performance
navigation
events to theWINDOW_LOAD
span. - Adds performance
paint
events to theWINDOW_LOAD
span. - Creates nested spans for all resources loaded before the
LOAD_EVENT_END
.
Implementation
The implementation is based on the OpenTelemetry Instrumentation Document Load. The implementation is forked because of various issues blocking the integration with other auto instrumentations.
The implementation is experimental. The plan is to pilot this span structure along with code helpers created for this instrumentation to see if we want to change them based on use-cases we encounter instrumenting other parts of the application like the Blob view.
Traces
ConsoleBatchSpanExporter
Honeycomb
Resources
- The Navigation Timing API documentation
- The Navigation Timing spec processing model
- Resource Timing spec processing model
Test plan
-
ENABLE_OPEN_TELEMETRY=true sg start web-standalone
. - Open web application.
- See the
windowLoad
span in the console.
App preview:
Check out the client app preview documentation to learn more.