The Firebase JS SDK is now in BETA!
This EAP site is no longer maintained. See the official Firebase Documentation site for the latest documentation and information about the Firebase JS SDK.

Home > @firebase/performance > PerformanceTrace

PerformanceTrace interface

The interface representing a Trace.

Signature:

export interface PerformanceTrace 

Methods

Method Description
getAttribute(attr) Retrieves the value which a custom attribute is set to.
getAttributes() Returns a map of all custom attributes of a trace instance.
getMetric(metricName) Returns the value of the custom metric by that name. If a custom metric with that name does not exist will return zero.
incrementMetric(metricName, num) Adds to the value of a custom metric. If a custom metric with the provided name does not exist, it creates one with that name and the value equal to the given number. The value will be floored down to an integer.
putAttribute(attr, value) Set a custom attribute of a trace to a certain value.
putMetric(metricName, num) Sets the value of the specified custom metric to the given number regardless of whether a metric with that name already exists on the trace instance or not. The value will be floored down to an integer.
record(startTime, duration, options) Records a trace from given parameters. This provides a direct way to use trace without a need to start/stop. This is useful for use cases in which the trace cannot directly be used (e.g. if the duration was captured before the Performance SDK was loaded).
removeAttribute(attr) Removes the specified custom attribute from a trace instance.
start() Starts the timing for the trace instance.
stop() Stops the timing of the trace instance and logs the data of the instance.