Index
Methods
getAttribute
-
Parameters
-
attr: string
Name of the custom attribute.
Returns string | undefined
-
getAttributes
-
Returns a map of all custom attributes of a
trace
instance.Returns {}
-
[key: string]: string
-
getMetric
-
Returns the value of the custom metric by that name. If a custom metric with that name does not exist returns zero.
Parameters
-
metricName: string
Name of the custom metric.
Returns number
-
incrementMetric
-
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.
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, it uses a default value of one.
Returns void
-
putAttribute
-
Set a custom attribute of a
trace
to a certain value.Parameters
-
attr: string
Name of the custom attribute.
-
value: string
Value of the custom attribute.
Returns void
-
putMetric
-
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.Parameters
-
metricName: string
Name of the custom metric.
-
num: number
Value to of the custom metric.
Returns void
-
record
-
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 and custom attributes.
-
Optional attributes?: {}
-
[key: string]: string
-
-
Optional metrics?: {}
-
[key: string]: number
-
-
Returns void
-
removeAttribute
-
Removes the specified custom attribute from a
trace
instance.Parameters
-
attr: string
Name of the custom attribute.
Returns void
-
start
-
Starts the timing for the
trace
instance.Returns void
stop
-
Stops the timing of the
trace
instance and logs the data of the instance.Returns void
Retrieves the value that the custom attribute is set to.