Edit

Share via


BrowserPerformanceClient class

Extends
@azure/msal-common.PerformanceClient

Constructors

BrowserPerformanceClient(Configuration, Set<string>, Map<string, string>)

Methods

addQueueMeasurement(string, string, number, boolean)

Calculates and adds queue time measurement for given performance event.

generateId()
setPreQueueTime(PerformanceEvents, string)

Adds pre-queue time to preQueueTimeByCorrelationId map.

startMeasurement(string, string)

Starts measuring performance for a given operation. Returns a function that should be used to end the measurement. Also captures browser page visibilityState.

Inherited Methods

addFields({[key: string]: {} | undefined}, string)

Saves extra information to be emitted when the measurements are flushed

addPerformanceCallback(PerformanceCallbackFunction)

Registers a callback function to receive performance events.

calculateQueuedTime(number, number)

Calculates the difference between current time and time when function was queued. Note: It is possible to have 0 as the queue time if the current time and the queued time was the same.

discardMeasurements(string)

Removes measurements and aux data for a given correlation id.

emitEvents(PerformanceEvent[], string)

Emits events to all registered callbacks.

endMeasurement(PerformanceEvent, unknown)

Stops measuring the performance for an operation. Should only be called directly by PerformanceClient classes, as consumers should instead use the function returned by startMeasurement. Adds a new field named as "[event name]DurationMs" for sub-measurements, completes and emits an event otherwise.

getPreQueueTime(string, string)

Gets map of pre-queue times by correlation Id

incrementFields({[key: string]: number | undefined}, string)

Increment counters to be emitted when the measurements are flushed

removePerformanceCallback(string)

Removes a callback registered with addPerformanceCallback.

startPerformanceMeasurement(string, string)

Starts and returns an platform-specific implementation of IPerformanceMeasurement. Note: this function can be changed to abstract at the next major version bump.

Constructor Details

BrowserPerformanceClient(Configuration, Set<string>, Map<string, string>)

new BrowserPerformanceClient(configuration: Configuration, intFields?: Set<string>, abbreviations?: Map<string, string>)

Parameters

configuration
Configuration
intFields

Set<string>

abbreviations

Map<string, string>

Method Details

addQueueMeasurement(string, string, number, boolean)

Calculates and adds queue time measurement for given performance event.

function addQueueMeasurement(eventName: string, correlationId?: string, queueTime?: number, manuallyCompleted?: boolean)

Parameters

eventName

string

correlationId

string

queueTime

number

manuallyCompleted

boolean

indicator for manually completed queue measurements

generateId()

function generateId(): string

Returns

string

setPreQueueTime(PerformanceEvents, string)

Adds pre-queue time to preQueueTimeByCorrelationId map.

function setPreQueueTime(eventName: PerformanceEvents, correlationId?: string)

Parameters

eventName
PerformanceEvents
correlationId

string

startMeasurement(string, string)

Starts measuring performance for a given operation. Returns a function that should be used to end the measurement. Also captures browser page visibilityState.

function startMeasurement(measureName: string, correlationId?: string): InProgressPerformanceEvent

Parameters

measureName

string

correlationId

string

Returns

Inherited Method Details

addFields({[key: string]: {} | undefined}, string)

Saves extra information to be emitted when the measurements are flushed

function addFields(fields: {[key: string]: {} | undefined}, correlationId: string)

Parameters

fields

{[key: string]: {} | undefined}

correlationId

string

Inherited From PerformanceClient.addFields

addPerformanceCallback(PerformanceCallbackFunction)

Registers a callback function to receive performance events.

function addPerformanceCallback(callback: PerformanceCallbackFunction): string

Parameters

Returns

string

Inherited From PerformanceClient.addPerformanceCallback

calculateQueuedTime(number, number)

Calculates the difference between current time and time when function was queued. Note: It is possible to have 0 as the queue time if the current time and the queued time was the same.

function calculateQueuedTime(preQueueTime: number, currentTime: number): number

Parameters

preQueueTime

number

currentTime

number

Returns

number

Inherited From PerformanceClient.calculateQueuedTime

discardMeasurements(string)

Removes measurements and aux data for a given correlation id.

function discardMeasurements(correlationId: string)

Parameters

correlationId

string

Inherited From PerformanceClient.discardMeasurements

emitEvents(PerformanceEvent[], string)

Emits events to all registered callbacks.

function emitEvents(events: PerformanceEvent[], correlationId?: string)

Parameters

events

PerformanceEvent[]

correlationId

string

Inherited From PerformanceClient.emitEvents

endMeasurement(PerformanceEvent, unknown)

Stops measuring the performance for an operation. Should only be called directly by PerformanceClient classes, as consumers should instead use the function returned by startMeasurement. Adds a new field named as "[event name]DurationMs" for sub-measurements, completes and emits an event otherwise.

function endMeasurement(event: PerformanceEvent, error?: unknown): null | PerformanceEvent

Parameters

error

unknown

Returns

Inherited From PerformanceClient.endMeasurement

getPreQueueTime(string, string)

Gets map of pre-queue times by correlation Id

function getPreQueueTime(eventName: string, correlationId: string): number | void

Parameters

eventName

string

correlationId

string

Returns

number | void

Inherited From PerformanceClient.getPreQueueTime

incrementFields({[key: string]: number | undefined}, string)

Increment counters to be emitted when the measurements are flushed

function incrementFields(fields: {[key: string]: number | undefined}, correlationId: string)

Parameters

fields

{[key: string]: number | undefined}

{string[]}

correlationId

string

{string} correlation identifier

Inherited From PerformanceClient.incrementFields

removePerformanceCallback(string)

Removes a callback registered with addPerformanceCallback.

function removePerformanceCallback(callbackId: string): boolean

Parameters

callbackId

string

Returns

boolean

Inherited From PerformanceClient.removePerformanceCallback

startPerformanceMeasurement(string, string)

Warning

This API is now deprecated.

This method will be removed in the next major version

Starts and returns an platform-specific implementation of IPerformanceMeasurement. Note: this function can be changed to abstract at the next major version bump.

function startPerformanceMeasurement(measureName: string, correlationId: string): IPerformanceMeasurement

Parameters

measureName

string

correlationId

string

Returns

@azure/msal-common.IPerformanceMeasurement

Inherited From PerformanceClient.startPerformanceMeasurement