Skip to main content
Version: v1

PerformanceEvent Class

Helper class to log performance events

Signature

export declare class PerformanceEvent

Constructors

Constructor Description
(constructor)(logger, event, markers) Constructs a new instance of the PerformanceEvent class

Static Methods

Method Return Type Description
start(logger, event, markers) PerformanceEvent
timedExec(logger, event, callback, markers) T
timedExecAsync(logger, event, callback, markers) Promise<T>

Properties

Property Type Description
duration number

Methods

Method Return Type Description
cancel(props, error) void
end(props) void
reportEvent(eventNameSuffix, props, error) void Report the event, if it hasn't already been reported.
reportProgress(props, eventNameSuffix) void

Constructor Details

(constructor)

Constructs a new instance of the PerformanceEvent class

Signature

protected constructor(logger: ITelemetryLogger, event: ITelemetryGenericEvent, markers?: IPerformanceEventMarkers);

Parameters

Parameter Modifiers Type Description
logger ITelemetryLogger
event ITelemetryGenericEvent
markers optional IPerformanceEventMarkers

Property Details

duration

Signature

get duration(): number;

Type: number

Method Details

cancel

Signature

cancel(props?: ITelemetryProperties, error?: any): void;

Parameters

Parameter Modifiers Type Description
props optional ITelemetryProperties
error optional any

end

Signature

end(props?: ITelemetryProperties): void;

Parameters

Parameter Modifiers Type Description
props optional ITelemetryProperties

reportEvent

Report the event, if it hasn't already been reported.

Signature

reportEvent(eventNameSuffix: string, props?: ITelemetryProperties, error?: any): void;

Parameters

Parameter Modifiers Type Description
eventNameSuffix string
props optional ITelemetryProperties
error optional any

reportProgress

Signature

reportProgress(props?: ITelemetryProperties, eventNameSuffix?: string): void;

Parameters

Parameter Modifiers Type Description
props optional ITelemetryProperties
eventNameSuffix optional string

start

Signature

static start(logger: ITelemetryLogger, event: ITelemetryGenericEvent, markers?: IPerformanceEventMarkers): PerformanceEvent;

Parameters

Parameter Modifiers Type Description
logger ITelemetryLogger
event ITelemetryGenericEvent
markers optional IPerformanceEventMarkers

Returns

Return type: PerformanceEvent

timedExec

Signature

static timedExec<T>(logger: ITelemetryLogger, event: ITelemetryGenericEvent, callback: (event: PerformanceEvent) => T, markers?: IPerformanceEventMarkers): T;
Type Parameters
Parameter Description
T

Parameters

Parameter Modifiers Type Description
logger ITelemetryLogger
event ITelemetryGenericEvent
callback (event: PerformanceEvent) => T
markers optional IPerformanceEventMarkers

Returns

Return type: T

timedExecAsync

Signature

static timedExecAsync<T>(logger: ITelemetryLogger, event: ITelemetryGenericEvent, callback: (event: PerformanceEvent) => Promise<T>, markers?: IPerformanceEventMarkers): Promise<T>;
Type Parameters
Parameter Description
T

Parameters

Parameter Modifiers Type Description
logger ITelemetryLogger
event ITelemetryGenericEvent
callback (event: PerformanceEvent) => Promise<T>
markers optional IPerformanceEventMarkers

Returns

Return type: Promise<T>