Trace
class Trace : Parcelable
Trace allows you to set beginning and end of a certain action in your app.
Summary
Constants |
|
|---|---|
const Parcelable.Creator<Trace!>! |
A public static CREATOR field that implements |
const Int |
Maximum allowed length of the Key of the |
const Int |
Maximum allowed length of the Value of the |
const Int |
Maximum allowed number of attributes allowed in a trace. |
const Int |
MAX_TRACE_NAME_LENGTH = 100Maximum allowed length of the name of the |
Public functions |
|
|---|---|
Int |
Describes the kinds of special objects contained in this Parcelable's marshalled representation. |
String? |
@KeepReturns the value of an attribute. |
(Mutable)Map<String!, String!> |
Returns the map of all the attributes added to this trace. |
Long |
@KeepGets the value of the metric with the given name in the current trace. |
Unit |
@KeepAtomically increments the metric with the given name in this trace by the incrementBy value. |
Unit |
@KeepSets a String value for the specified attribute. |
Unit |
Sets the value of the metric with the given name in this trace to the value provided. |
Unit |
@KeepRemoves an already added attribute from the Traces. |
Unit |
Starts this trace. |
Unit |
Stops this trace. |
Unit |
@KeepFlatten this object into a Parcel. |
Extension functions |
|
|---|---|
inline T |
Measures the time it takes to run the |
Constants
CREATOR
@Keep
const val CREATOR: Parcelable.Creator<Trace!>!
A public static CREATOR field that implements Parcelable.Creator and generates instances of your Parcelable class from a Parcel.
MAX_ATTRIBUTE_KEY_LENGTH
const val MAX_ATTRIBUTE_KEY_LENGTH = 40: Int
Maximum allowed length of the Key of the Trace attribute
MAX_ATTRIBUTE_VALUE_LENGTH
const val MAX_ATTRIBUTE_VALUE_LENGTH = 100: Int
Maximum allowed length of the Value of the Trace attribute
MAX_TRACE_CUSTOM_ATTRIBUTES
const val MAX_TRACE_CUSTOM_ATTRIBUTES = 5: Int
Maximum allowed number of attributes allowed in a trace.
MAX_TRACE_NAME_LENGTH
const val MAX_TRACE_NAME_LENGTH = 100: Int
Maximum allowed length of the name of the Trace
Public functions
describeContents
@Keep
fun describeContents(): Int
Describes the kinds of special objects contained in this Parcelable's marshalled representation.
| Returns | |
|---|---|
Int |
always returns 0. |
| See also | |
|---|---|
Parcelable |
getAttribute
@Keep
fun getAttribute(attribute: String): String?
Returns the value of an attribute.
| Parameters | |
|---|---|
attribute: String |
name of the attribute to fetch the value for |
| Returns | |
|---|---|
String? |
the value of the attribute if it exists or null otherwise. |
getAttributes
@Keep
fun getAttributes(): (Mutable)Map<String!, String!>
Returns the map of all the attributes added to this trace.
getLongMetric
@Keep
fun getLongMetric(metricName: String): Long
Gets the value of the metric with the given name in the current trace. If a metric with the given name doesn't exist, it is NOT created and a 0 is returned. This method is atomic.
| Parameters | |
|---|---|
metricName: String |
Name of the metric to get. Requires no leading or trailing whitespace, no leading underscore '_' character, max length is 100 characters. |
| Returns | |
|---|---|
Long |
Value of the metric or 0 if it hasn't yet been set. |
incrementMetric
@Keep
fun incrementMetric(metricName: String, incrementBy: Long): Unit
Atomically increments the metric with the given name in this trace by the incrementBy value. If the metric does not exist, a new one will be created. If the trace has not been started or has already been stopped, returns immediately without taking action.
putAttribute
@Keep
fun putAttribute(attribute: String, value: String): Unit
Sets a String value for the specified attribute. Updates the value of the attribute if the attribute already exists. If the trace has been stopped, this method returns without adding the attribute. The maximum number of attributes that can be added to a Trace are MAX_TRACE_CUSTOM_ATTRIBUTES.
putMetric
@Keep
fun putMetric(metricName: String, value: Long): Unit
Sets the value of the metric with the given name in this trace to the value provided. If a metric with the given name doesn't exist, a new one will be created. If the trace has not been started or has already been stopped, returns immediately without taking action. This method is atomic.
removeAttribute
@Keep
fun removeAttribute(attribute: String): Unit
Removes an already added attribute from the Traces. If the trace has been stopped, this method returns without removing the attribute.
| Parameters | |
|---|---|
attribute: String |
Name of the attribute to be removed from the running Traces. |
writeToParcel
@Keep
fun writeToParcel(out: Parcel, flags: Int): Unit
Flatten this object into a Parcel. Please refer to https://developer.android.com/reference/android/os/Parcelable.html