Skip to content

Commit

Permalink
Make eventName of type string for BrowserPerformanceClient and `P…
Browse files Browse the repository at this point in the history
…erformanceClient` (#6386)

- Make `eventName` of type string for `BrowserPerformanceClient` and
`PerformanceClient`.
- Expose `InProgressPerformanceEvent` to get rid of `msal-common` dep in
1p.
  • Loading branch information
konstantin-msft authored Aug 24, 2023
1 parent 908e97f commit 5d05054
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "Make `eventName` of type string for `BrowserPerformanceClient` and `PerformanceClient` #6386",
"packageName": "@azure/msal-browser",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "Make `eventName` of type string for `BrowserPerformanceClient` and `PerformanceClient` #6386",
"packageName": "@azure/msal-common",
"email": "[email protected]",
"dependentChangeType": "patch"
}
2 changes: 2 additions & 0 deletions lib/msal-browser/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,8 @@ export {
PerformanceCallbackFunction,
PerformanceEvent,
PerformanceEvents,
// Telemetry
InProgressPerformanceEvent,
} from "@azure/msal-common";

export { version } from "./packageMetadata";
4 changes: 2 additions & 2 deletions lib/msal-browser/src/telemetry/BrowserPerformanceClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export class BrowserPerformanceClient
* @returns {((event?: Partial<PerformanceEvent>) => PerformanceEvent| null)}
*/
startMeasurement(
measureName: PerformanceEvents,
measureName: string,
correlationId?: string
): InProgressPerformanceEvent {
// Capture page visibilityState and then invoke start/end measurement
Expand Down Expand Up @@ -195,7 +195,7 @@ export class BrowserPerformanceClient
* @returns
*/
addQueueMeasurement(
eventName: PerformanceEvents,
eventName: string,
correlationId?: string,
queueTime?: number,
manuallyCompleted?: boolean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Licensed under the MIT License.
*/

import { PerformanceEvent, PerformanceEvents } from "./PerformanceEvent";
import { PerformanceEvent } from "./PerformanceEvent";
import { IPerformanceMeasurement } from "./IPerformanceMeasurement";

export type PerformanceCallbackFunction = (events: PerformanceEvent[]) => void;
Expand Down Expand Up @@ -42,12 +42,12 @@ export interface IPerformanceClient {
generateId(): string;
calculateQueuedTime(preQueueTime: number, currentTime: number): number;
addQueueMeasurement(
eventName: PerformanceEvents,
eventName: string,
correlationId?: string,
queueTime?: number,
manuallyCompleted?: boolean
): void;
setPreQueueTime(eventName: PerformanceEvents, correlationId?: string): void;
setPreQueueTime(eventName: string, correlationId?: string): void;
}

/**
Expand All @@ -57,7 +57,7 @@ export type QueueMeasurement = {
/**
* Name of performance event
*/
eventName: PerformanceEvents;
eventName: string;

/**
* Time spent in JS queue
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,10 +139,7 @@ export abstract class PerformanceClient implements IPerformanceClient {
* @param {string} correlationId
* @returns {number}
*/
getPreQueueTime(
eventName: PerformanceEvents,
correlationId: string
): number | void {
getPreQueueTime(eventName: string, correlationId: string): number | void {
const preQueueEvent: PreQueueEvent | undefined =
this.preQueueTimeByCorrelationId.get(correlationId);

Expand Down Expand Up @@ -204,7 +201,7 @@ export abstract class PerformanceClient implements IPerformanceClient {
* @returns
*/
addQueueMeasurement(
eventName: PerformanceEvents,
eventName: string,
correlationId?: string,
queueTime?: number,
manuallyCompleted?: boolean
Expand Down

0 comments on commit 5d05054

Please sign in to comment.