Jump to top

Trace

interface

Trace allows you to time the beginning to end of a certain action in your app with additional metric values and attributes.

Methods

getAttribute

</>

Returns the value of an attribute. Returns null if it does not exist.

getAttribute(attribute: string): string | null;

getMetric

</>

Gets the value of the metric with the given name in the current trace. If the metric doesn't exist, it will not be created and a 0 is returned.

getMetric(metricName: string): number;

getMetrics

</>

Returns an object of all the currently added metrics and their number values.

getMetrics(): { [key: string]: number };

incrementMetric

</>

Increments the named metric by the incrementBy value.

incrementMetric(metricName: string, incrementBy: number): any;

putAttribute

</>

Sets a String value for the specified attribute. Updates the value of the attribute if it already exists. The maximum number of attributes that can be added is 5.

putAttribute(attribute: string, value: string): any;

putMetric

</>

Sets the value of the named metric with the provided number.

putMetric(metricName: string, value: number): any;

removeMetric

</>

Removes a metric by name if it exists.

removeMetric(metricName: string): any;

start

</>

Marks the start time of the trace. Does nothing if already started.

start(): Promise<null>;

stop

</>

Marks the end time of the trace and queues the metric on the device for transmission. Does nothing if already stopped.

stop(): Promise<null>;