Creates a child Tracker instance.
A new Tracker instance that will notify the same root subscriber of TrackingInfo entries, mixing in ancestor contextual data as needed.
Sets contextual data to be mixed into each TrackingInfo created by this Tracker or any child Trackers.
The data to merge into any TrackingInfo instances created by this (or child) Tracker methods.
Logs an Error.
The Error instance to log.
Logs an event. Events usually represent important points in an application's lifecycle or user-initiated actions such as button clicks.
NOTE: This method also creates a browser performance mark with the given message name.
The name of the event to log.
Optional information to associate with this TrackingInfo.
Starts a timing tree. Unlike the normal start method, this method does not return a stop function. Instead, it returns an array. The first value in the array is the stop function; the second argument is another start function you can invoke to begin a new nested timing.
The label of the nested timer to create.
The [stop, start]
methods you can use to
end the current timing or start a nested timing. The first function
is a normal TimerStopFunction and the second function is
another NestedTimingTracker.start function.
Generates a random RFC 4122 UUID guaranteed to be unique.
NOTE: The only difference between this interface and the normal Tracker is how the start method works. Creating nested timings introduces new edge cases that are important for you to understand:
Edge Cases
Calling stop() Multiple Times
Normally, invoking the
stop()
function returned fromstart()
multiple times will create a separate timing entry for each invocation and increase the entry'scount
property.With a nested timer, that only holds true for the root timing. For nested timings, calling
stop()
multiple times creates sibling entries, incrementingcount
with each invocation:timing tree:
Stopping Parents Before Children
It is okay for nested timings to stop after an ancestor timing stops. However, when the root timing is stopped, only completed timings will appear in the timing tree. In other words, any nested timings that are still running will not appear in the timing tree.
timing tree:
Creating Child Trackers
Even on a NestedTimingTracker, calling child() creates a normal Tracker instance. So, if you call
start()
on a child Tracker, it will not use nested timings. If you want to combine child Trackers with nested timings, you should change your call order:Best Practices
If you need to create a nested timing, that is a good indication that the code should exist in a separate function. When you call this function, you should pass the nested
start
function so that function can continue the pattern by creating any nested timings it needs (now or in the future):