You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Turns out this is much more useful, because it can be used to track application performance in Preact and have that sent to a Graphana/Splunk instanace.
Quoting a thread on our slack channel:
the idea is to use this on each click handler
import{unstable_traceastrace}from'scheduler/tracing'trace('click',performance.now(),()=>setCount(c=>c+1))functionreportProfile(id,// the "id" prop of the Profiler tree that has just committedphase,// either "mount" (if the tree just mounted) or "update" (if it re-rendered)actualDuration,// time spent rendering the committed updatebaseDuration,// estimated time to render the entire subtree without memoizationstartTime,// when React began rendering this updatecommitTime,// when React committed this updateinteractions,// the Set of interactions belonging to this update){queue.push({
id,
phase,
actualDuration,
baseDuration,
startTime,
commitTime,
interactions,})// this is a fire and forget, so we don't return anything.}
and then each 5 seconds send the request to save the data in Splunk const queueToSend = [...queue]
It's essentially a more powerful
performance.measure()
alternative that captures additional details that's exclusive to extensions like CPU load.Links:
The text was updated successfully, but these errors were encountered: