- firebase.
- performance.
- Trace
Index
Methods
getAttribute
- get
Attribute(attr: string):string |undefined Retrieves the value that the custom attribute is set to.
Parameters
attr:string
Name of the custom attribute.
Returnsstring |undefined
getAttributes
- get
Attributes():{} Returns a map of all custom attributes of a
traceinstance.Returns{}
[key:string]:string
getMetric
- get
Metric(metricName: string):number Returns the value of the custom metric by that name. If a custom metric with that name doesnot exist returns zero.
Parameters
metricName:string
Name of the custom metric.
Returnsnumber
incrementMetric
- increment
Metric(metricName: string, num?: number):void Adds to the value of a custom metric. If a custom metric with the provided name does notexist, it creates one with that name and the value equal to the given number.
Parameters
metricName:string
The name of the custom metric.
Optional num:number
The number to be added to the value of the custom metric. If not provided, ituses a default value of one.
Returnsvoid
putAttribute
- put
Attribute(attr: string, value: string):void Set a custom attribute of a
traceto a certain value.Parameters
attr:string
Name of the custom attribute.
value:string
Value of the custom attribute.
Returnsvoid
putMetric
- put
Metric(metricName: string, num: number):void Sets the value of the specified custom metric to the given number regardless of whethera metric with that name already exists on the
traceinstance or not.Parameters
metricName:string
Name of the custom metric.
num:number
Value to of the custom metric.
Returnsvoid
record
- record(startTime: number, duration: number, options?: {attributes?:{};metrics?:{} }):void
Parameters
startTime:number
Trace start time since epoch in millisec.
duration:number
The duraction of the trace in millisec.
Optional options:{attributes?:{};metrics?:{} }
An object which can optionally hold maps of custom metrics andcustom attributes.
Optional attributes?:{}
[key:string]:string
Optional metrics?:{}
[key:string]:number
Returnsvoid
removeAttribute
- remove
Attribute(attr: string):void Removes the specified custom attribute from a
traceinstance.Parameters
attr:string
Name of the custom attribute.
Returnsvoid
start
- start():void
Starts the timing for the
traceinstance.Returnsvoid
stop
- stop():void
Stops the timing of the
traceinstance and logs thedata of the instance.Returnsvoid
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2022-07-27 UTC.