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

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

Methods

Method Return Type Description
send(eventName, value) void Sends 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

Parameter Modifiers Type Description
threshold number
logger ITelemetryLogger
thresholdMultiple optional number

Method Details

send

Sends the value if it's above the treshold.

Signature

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

Parameters

Parameter Type Description
eventName string
value number

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

Parameter Type Description
eventName string
value number