Fix the APM RUM page-load
transaction
#114780
Labels
enhancement
New value added to drive a business result
performance
Team:Core
Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc
v8.0.0
Our code currently loads
APM RUM
to create app based transactions.When the
apm-rum
init
function is called, it internally creates apage-load
transaction. However, due to the way our code is structured, the duration of this transaction is just an arbitrary number (time of loadingbootstrap
+ some extra processing) and it does not accurately reflect our real load time.This is a rough diagram of the current
page-load
event:After chatting with @vigneshshanmugam, we have come up with a way to patch this behavior.
If it is found useful, @elastic/apm-agent-rum might improve their API at some point.
The steps for the patch are:
apm
by callinginit
(inapm_system.ts
), get the current transaction and prevent it from closing by callingpageLoadTransaction.block(true)
(docs). This shouldn't normally happen, but if the transaction is undefined or it's type is notpage-load
we should report an error (where to?).transaction.mark
) calledapm-setup
to thepage-load
transaction.start
function, add another marker calledapm-start
.route-change
transaction for the first time, close thepage-load
transaction explicitly by callingpageLoadTransaction.block(false)
.The result would be a more accurate page load event that can be used to measure our actual load time:
The text was updated successfully, but these errors were encountered: