Skip to main content
Version: v1

PerformanceEvent Class

Helper class to log performance events

Signature

export declare class PerformanceEvent

Constructors

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

Static Methods

MethodReturn TypeDescription
start(logger, event, markers)PerformanceEvent
timedExec(logger, event, callback, markers)T
timedExecAsync(logger, event, callback, markers)Promise<T>

Properties

PropertyTypeDescription
durationnumber

Methods

MethodReturn TypeDescription
cancel(props, error)void
end(props)void
reportEvent(eventNameSuffix, props, error)voidReport 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

ParameterModifiersTypeDescription
loggerITelemetryLogger
eventITelemetryGenericEvent
markersoptionalIPerformanceEventMarkers

Property Details

duration

Signature

get duration(): number;

Type: number

Method Details

cancel

Signature

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

Parameters

ParameterModifiersTypeDescription
propsoptionalITelemetryProperties
erroroptionalany

end

Signature

end(props?: ITelemetryProperties): void;

Parameters

ParameterModifiersTypeDescription
propsoptionalITelemetryProperties

reportEvent

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

Signature

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

Parameters

ParameterModifiersTypeDescription
eventNameSuffixstring
propsoptionalITelemetryProperties
erroroptionalany

reportProgress

Signature

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

Parameters

ParameterModifiersTypeDescription
propsoptionalITelemetryProperties
eventNameSuffixoptionalstring

start

Signature

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

Parameters

ParameterModifiersTypeDescription
loggerITelemetryLogger
eventITelemetryGenericEvent
markersoptionalIPerformanceEventMarkers

Returns

Return type: PerformanceEvent

timedExec

Signature

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

Parameters

ParameterModifiersTypeDescription
loggerITelemetryLogger
eventITelemetryGenericEvent
callback(event: PerformanceEvent) => T
markersoptionalIPerformanceEventMarkers

Returns

Return type: T

timedExecAsync

Signature

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

Parameters

ParameterModifiersTypeDescription
loggerITelemetryLogger
eventITelemetryGenericEvent
callback(event: PerformanceEvent) => Promise<T>
markersoptionalIPerformanceEventMarkers

Returns

Return type: Promise<T>