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
navigationentries update. - Creates the
WINDOW_LOADspan capturing timings fromFETCH_STARTtillLOAD_EVENT_END. - Adds performance
navigationevents to theWINDOW_LOADspan. - Adds performance
paintevents to theWINDOW_LOADspan. - 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
windowLoadspan in the console.
App preview:
Check out the client app preview documentation to learn more.