Skip to main content
Version: v1

ThresholdCounter Class

Utility counter which will send event only if the provided value is above a configured threshold

Signature

export declare class ThresholdCounter

Constructors

ConstructorDescription
(constructor)(threshold, logger, thresholdMultiple)Constructs a new instance of the ThresholdCounter class

Methods

MethodReturn TypeDescription
send(eventName, value)voidSends the value if it's above the treshold.
sendIfMultiple(eventName, value)void

Sends the value if it's above the treshold and a multiple of the threshold.

To be used in scenarios where we'd like to record a threshold violation while reducing telemetry noise.

Constructor Details

(constructor)

Constructs a new instance of the ThresholdCounter class

Signature

constructor(threshold: number, logger: ITelemetryLogger, thresholdMultiple?: number);

Parameters

ParameterModifiersTypeDescription
thresholdnumber
loggerITelemetryLogger
thresholdMultipleoptionalnumber

Method Details

send

Sends the value if it's above the treshold.

Signature

send(eventName: string, value: number): void;

Parameters

ParameterTypeDescription
eventNamestring
valuenumber

sendIfMultiple

Sends the value if it's above the treshold and a multiple of the threshold.

To be used in scenarios where we'd like to record a threshold violation while reducing telemetry noise.

Signature

sendIfMultiple(eventName: string, value: number): void;

Parameters

ParameterTypeDescription
eventNamestring
valuenumber