Last date modified: 2025-Jul-02

Interface: IPartialMetric

Partial metric that supports setting, updating, and removing metric attributes as well as registering pre-report event handlers.

Properties

abandoned

readonlyabandoned: boolean

Whether or not the metric has been abandoned


attributes

readonlyattributes: Readonly<IContext>

Readonly metric attributes

You can set, update, and remove attributes with other methods on this interface.


name

readonlyname: string

Metric name


reported

readonlyreported: boolean

Whether or not the metric has been reported

Methods

incrementAttribute()

incrementAttribute(key, amount?): this

Increments an attribute on the metric

If the attribute does not exist, it will be created with a value matching the amount parameter (or 1).

Parameters

key: string

Attribute name

amount?: number

Amount to increment the attribute by (default: 1)

Returns

this

Reference to the metric for method-chaining


offPreReport()

offPreReport(handler): this

Unregisters a handler for the PreReport event

Parameters

handler: PreReportEventHandler

Event handler function

Returns

this

Reference to the metric for method-chaining


onPreReport()

onPreReport(handler): this

Registers a handler for the PreReport event

Parameters

handler: PreReportEventHandler

Event handler function

Returns

this

Reference to the metric for method-chaining


removeAttribute()

removeAttribute(key): this

Removes an attribute from the metric

Parameters

key: string

Attribute name

Returns

this

Reference to the metric for method-chaining


setAttribute()

setAttribute(key, value, override?): this

Sets an attribute on the metric

Parameters

key: string

Attribute name

value: ApmCustomData

Attribute value

override?: boolean

Whether or not to override the attribute if it already exists (default: false)

Returns

this

Reference to the metric for method-chaining

Return to top of the page
Feedback