Skip to content

Remove queue time instrumentation #7747

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: msal-v5
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "minor",
"comment": "Remove queue time instrumentation #7747",
"packageName": "@azure/msal-browser",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "minor",
"comment": "Remove queue time instrumentation #7747",
"packageName": "@azure/msal-common",
"email": "[email protected]",
"dependentChangeType": "patch"
}
15 changes: 1 addition & 14 deletions lib/msal-browser/apiReview/msal-browser.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -291,24 +291,11 @@ export class BrowserConfigurationAuthError extends AuthError {
// @public (undocumented)
export class BrowserPerformanceClient extends PerformanceClient implements IPerformanceClient {
constructor(configuration: Configuration, intFields?: Set<string>, abbreviations?: Map<string, string>);
// Warning: (tsdoc-param-tag-missing-hyphen) The @param block should be followed by a parameter name and then a hyphen
// Warning: (tsdoc-param-tag-with-invalid-type) The @param block should not include a JSDoc-style '{type}'
// Warning: (tsdoc-param-tag-missing-hyphen) The @param block should be followed by a parameter name and then a hyphen
// Warning: (tsdoc-param-tag-with-invalid-type) The @param block should not include a JSDoc-style '{type}'
// Warning: (tsdoc-param-tag-missing-hyphen) The @param block should be followed by a parameter name and then a hyphen
// Warning: (tsdoc-param-tag-with-invalid-type) The @param block should not include a JSDoc-style '{type}'
// Warning: (tsdoc-param-tag-with-invalid-type) The @param block should not include a JSDoc-style '{type}'
addQueueMeasurement(eventName: string, correlationId?: string, queueTime?: number, manuallyCompleted?: boolean): void;
// (undocumented)
generateId(): string;
// Warning: (tsdoc-param-tag-missing-hyphen) The @param block should be followed by a parameter name and then a hyphen
// Warning: (tsdoc-param-tag-with-invalid-type) The @param block should not include a JSDoc-style '{type}'
// Warning: (tsdoc-param-tag-missing-hyphen) The @param block should be followed by a parameter name and then a hyphen
// Warning: (tsdoc-param-tag-with-invalid-type) The @param block should not include a JSDoc-style '{type}'
setPreQueueTime(eventName: PerformanceEvents, correlationId?: string): void;
// Warning: (tsdoc-param-tag-missing-hyphen) The @param block should be followed by a parameter name and then a hyphen
// Warning: (tsdoc-param-tag-with-invalid-type) The @param block should not include a JSDoc-style '{type}'
// Warning: (tsdoc-param-tag-missing-hyphen) The @param block should be followed by a parameter name and then a hyphen
// Warning: (tsdoc-param-tag-with-invalid-optional-name) The @param should not include a JSDoc-style optional name; it must not be enclosed in '[ ]' brackets.
// Warning: (tsdoc-param-tag-with-invalid-type) The @param block should not include a JSDoc-style '{type}'
// Warning: (tsdoc-escape-greater-than) The ">" character should be escaped using a backslash to avoid confusion with an HTML tag
Expand Down Expand Up @@ -1491,7 +1478,7 @@ export type WrapperSKU = (typeof WrapperSKU)[keyof typeof WrapperSKU];
// src/cache/LocalStorage.ts:296:8 - (tsdoc-param-tag-missing-hyphen) The @param block should be followed by a parameter name and then a hyphen
// src/cache/LocalStorage.ts:354:8 - (tsdoc-param-tag-missing-hyphen) The @param block should be followed by a parameter name and then a hyphen
// src/cache/LocalStorage.ts:385:8 - (tsdoc-param-tag-missing-hyphen) The @param block should be followed by a parameter name and then a hyphen
// src/config/Configuration.ts:256:5 - (ae-forgotten-export) The symbol "InternalAuthOptions" needs to be exported by the entry point index.d.ts
// src/config/Configuration.ts:231:5 - (ae-forgotten-export) The symbol "InternalAuthOptions" needs to be exported by the entry point index.d.ts
// src/event/EventHandler.ts:113:8 - (tsdoc-param-tag-missing-hyphen) The @param block should be followed by a parameter name and then a hyphen
// src/event/EventHandler.ts:139:8 - (tsdoc-param-tag-missing-hyphen) The @param block should be followed by a parameter name and then a hyphen
// src/index.ts:8:12 - (tsdoc-characters-after-block-tag) The token "@azure" looks like a TSDoc tag but contains an invalid character "/"; if it is not a tag, use a backslash to escape the "@"
Expand Down
10 changes: 1 addition & 9 deletions lib/msal-browser/src/cache/BrowserCacheManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1020,15 +1020,7 @@ export class BrowserCacheManager extends CacheManager {
* @param correlationId {string} correlation id
* @returns
*/
async clearTokensAndKeysWithClaims(
performanceClient: IPerformanceClient,
correlationId: string
): Promise<void> {
performanceClient.addQueueMeasurement(
PerformanceEvents.ClearTokensAndKeysWithClaims,
correlationId
);

async clearTokensAndKeysWithClaims(): Promise<void> {
const tokenKeys = this.getTokenKeys();

const removedAccessTokens: Array<Promise<void>> = [];
Expand Down
20 changes: 1 addition & 19 deletions lib/msal-browser/src/controllers/StandardController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ export class StandardController implements IController {
this.logger,
this.performanceClient,
initCorrelationId
)(this.performanceClient, initCorrelationId);
)();
}

if (
Expand Down Expand Up @@ -1242,10 +1242,6 @@ export class StandardController implements IController {
commonRequest: CommonSilentFlowRequest,
cacheLookupPolicy: CacheLookupPolicy
): Promise<AuthenticationResult> {
this.performanceClient.addQueueMeasurement(
PerformanceEvents.AcquireTokenFromCache,
commonRequest.correlationId
);
switch (cacheLookupPolicy) {
case CacheLookupPolicy.Default:
case CacheLookupPolicy.AccessToken:
Expand Down Expand Up @@ -1277,10 +1273,6 @@ export class StandardController implements IController {
commonRequest: CommonSilentFlowRequest,
cacheLookupPolicy: CacheLookupPolicy
): Promise<AuthenticationResult> {
this.performanceClient.addQueueMeasurement(
PerformanceEvents.AcquireTokenByRefreshToken,
commonRequest.correlationId
);
switch (cacheLookupPolicy) {
case CacheLookupPolicy.Default:
case CacheLookupPolicy.AccessTokenAndRefreshToken:
Expand Down Expand Up @@ -1312,11 +1304,6 @@ export class StandardController implements IController {
protected async acquireTokenBySilentIframe(
request: CommonSilentFlowRequest
): Promise<AuthenticationResult> {
this.performanceClient.addQueueMeasurement(
PerformanceEvents.AcquireTokenBySilentIframe,
request.correlationId
);

const silentIframeClient = this.createSilentIframeClient(
request.correlationId
);
Expand Down Expand Up @@ -2039,11 +2026,6 @@ export class StandardController implements IController {
): Promise<AuthenticationResult> {
const trackPageVisibility = () =>
this.trackPageVisibility(request.correlationId);
this.performanceClient.addQueueMeasurement(
PerformanceEvents.AcquireTokenSilentAsync,
request.correlationId
);

this.eventHandler.emitEvent(
EventType.ACQUIRE_TOKEN_START,
InteractionType.Silent,
Expand Down
14 changes: 1 addition & 13 deletions lib/msal-browser/src/crypto/BrowserCrypto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ import {
createBrowserAuthError,
BrowserAuthErrorCodes,
} from "../error/BrowserAuthError.js";
import {
IPerformanceClient,
PerformanceEvents,
} from "@azure/msal-common/browser";
import { KEY_FORMAT_JWK } from "../utils/BrowserConstants.js";
import { base64Encode, urlEncodeArr } from "../encode/Base64Encode.js";
import { base64Decode, base64DecToArr } from "../encode/Base64Decode.js";
Expand Down Expand Up @@ -83,15 +79,7 @@ export function validateCryptoAvailable(
* @param performanceClient {?IPerformanceClient}
* @param correlationId {?string} correlation id
*/
export async function sha256Digest(
dataString: string,
performanceClient?: IPerformanceClient,
correlationId?: string
): Promise<ArrayBuffer> {
performanceClient?.addQueueMeasurement(
PerformanceEvents.Sha256Digest,
correlationId
);
export async function sha256Digest(dataString: string): Promise<ArrayBuffer> {
const encoder = new TextEncoder();
const data = encoder.encode(dataString);
return window.crypto.subtle.digest(
Expand Down
10 changes: 1 addition & 9 deletions lib/msal-browser/src/crypto/PkceGenerator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,6 @@ export async function generatePkceCodes(
logger: Logger,
correlationId: string
): Promise<PkceCodes> {
performanceClient.addQueueMeasurement(
PerformanceEvents.GeneratePkceCodes,
correlationId
);
const codeVerifier = invoke(
generateCodeVerifier,
PerformanceEvents.GenerateCodeVerifier,
Expand Down Expand Up @@ -94,10 +90,6 @@ async function generateCodeChallengeFromVerifier(
logger: Logger,
correlationId: string
): Promise<string> {
performanceClient.addQueueMeasurement(
PerformanceEvents.GenerateCodeChallengeFromVerifier,
correlationId
);
try {
// hashed verifier
const pkceHashedCodeVerifier = await invokeAsync(
Expand All @@ -106,7 +98,7 @@ async function generateCodeChallengeFromVerifier(
logger,
performanceClient,
correlationId
)(pkceCodeVerifier, performanceClient, correlationId);
)(pkceCodeVerifier);
// encode hash as base64
return urlEncodeArr(new Uint8Array(pkceHashedCodeVerifier));
} catch (e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,10 +195,6 @@ export abstract class BaseInteractionClient {
? params.requestExtraQueryParameters["instance_aware"]
: undefined;

this.performanceClient.addQueueMeasurement(
PerformanceEvents.StandardInteractionClientGetDiscoveredAuthority,
this.correlationId
);
const authorityOptions: AuthorityOptions = {
protocolMode: this.config.system.protocolMode,
OIDCOptions: this.config.auth.OIDCOptions,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,10 +162,6 @@ export class NativeInteractionClient extends BaseInteractionClient {
request: PopupRequest | SilentRequest | SsoSilentRequest,
cacheLookupPolicy?: CacheLookupPolicy
): Promise<AuthenticationResult> {
this.performanceClient.addQueueMeasurement(
PerformanceEvents.NativeInteractionClientAcquireToken,
request.correlationId
);
this.logger.trace("NativeInteractionClient - acquireToken called.");

// start the perf measurement
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@ export class SilentCacheClient extends StandardInteractionClient {
async acquireToken(
silentRequest: CommonSilentFlowRequest
): Promise<AuthenticationResult> {
this.performanceClient.addQueueMeasurement(
PerformanceEvents.SilentCacheClientAcquireToken,
silentRequest.correlationId
);
// Telemetry manager only used to increment cacheHits here
const serverTelemetryManager = this.initializeServerTelemetryManager(
ApiId.acquireTokenSilent_silentFlow
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,6 @@ export class SilentIframeClient extends StandardInteractionClient {
async acquireToken(
request: SsoSilentRequest
): Promise<AuthenticationResult> {
this.performanceClient.addQueueMeasurement(
PerformanceEvents.SilentIframeClientAcquireToken,
request.correlationId
);
// Check that we have some SSO data
if (
!request.loginHint &&
Expand Down Expand Up @@ -321,10 +317,6 @@ export class SilentIframeClient extends StandardInteractionClient {
request: CommonAuthorizationUrlRequest
): Promise<AuthenticationResult> {
const correlationId = request.correlationId;
this.performanceClient.addQueueMeasurement(
PerformanceEvents.SilentIframeClientTokenHelper,
correlationId
);
const pkceCodes = await invokeAsync(
generatePkceCodes,
PerformanceEvents.GeneratePkceCodes,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,6 @@ export class SilentRefreshClient extends StandardInteractionClient {
async acquireToken(
request: CommonSilentFlowRequest
): Promise<AuthenticationResult> {
this.performanceClient.addQueueMeasurement(
PerformanceEvents.SilentRefreshClientAcquireToken,
request.correlationId
);

const baseRequest = await invokeAsync(
initializeBaseRequest,
PerformanceEvents.InitializeBaseRequest,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,10 +183,6 @@ export abstract class StandardInteractionClient extends BaseInteractionClient {
requestExtraQueryParameters?: StringDict;
account?: AccountInfo;
}): Promise<AuthorizationCodeClient> {
this.performanceClient.addQueueMeasurement(
PerformanceEvents.StandardInteractionClientCreateAuthCodeClient,
this.correlationId
);
// Create auth module.
const clientConfig = await invokeAsync(
this.getClientConfiguration.bind(this),
Expand Down Expand Up @@ -227,10 +223,6 @@ export abstract class StandardInteractionClient extends BaseInteractionClient {
account,
} = params;

this.performanceClient.addQueueMeasurement(
PerformanceEvents.StandardInteractionClientGetClientConfiguration,
this.correlationId
);
const discoveredAuthority = await invokeAsync(
this.getDiscoveredAuthority.bind(this),
PerformanceEvents.StandardInteractionClientGetDiscoveredAuthority,
Expand Down Expand Up @@ -290,11 +282,6 @@ export abstract class StandardInteractionClient extends BaseInteractionClient {
request: RedirectRequest | PopupRequest | SsoSilentRequest,
interactionType: InteractionType
): Promise<CommonAuthorizationUrlRequest> {
this.performanceClient.addQueueMeasurement(
PerformanceEvents.StandardInteractionClientInitializeAuthorizationRequest,
this.correlationId
);

const redirectUri = this.getRedirectUri(request.redirectUri);
const browserState: BrowserStateObject = {
interactionType: interactionType,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,6 @@ export class InteractionHandler {
response: AuthorizeResponse,
request: CommonAuthorizationUrlRequest
): Promise<AuthenticationResult> {
this.performanceClient.addQueueMeasurement(
PerformanceEvents.HandleCodeResponse,
request.correlationId
);

let authCodeResponse;
try {
authCodeResponse = AuthorizeProtocol.getAuthorizationCodePayload(
Expand Down Expand Up @@ -105,10 +100,6 @@ export class InteractionHandler {
request: CommonAuthorizationUrlRequest,
validateNonce: boolean = true
): Promise<AuthenticationResult> {
this.performanceClient.addQueueMeasurement(
PerformanceEvents.HandleCodeResponseFromServer,
request.correlationId
);
this.logger.trace(
"InteractionHandler.handleCodeResponseFromServer called"
);
Expand Down
10 changes: 0 additions & 10 deletions lib/msal-browser/src/interaction_handler/SilentHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,6 @@ export async function initiateCodeRequest(
logger: Logger,
correlationId: string
): Promise<HTMLIFrameElement> {
performanceClient.addQueueMeasurement(
PerformanceEvents.SilentHandlerInitiateAuthRequest,
correlationId
);

if (!requestUrl) {
// Throw error if request URL is empty.
logger.info("Navigate url is empty");
Expand Down Expand Up @@ -90,11 +85,6 @@ export async function monitorIframeForHash(
correlationId: string,
responseType: ResponseMode
): Promise<string> {
performanceClient.addQueueMeasurement(
PerformanceEvents.SilentHandlerMonitorIframeForHash,
correlationId
);

return new Promise<string>((resolve, reject) => {
if (timeout < DEFAULT_IFRAME_TIMEOUT_MS) {
logger.warning(
Expand Down
3 changes: 1 addition & 2 deletions lib/msal-browser/src/protocol/Authorize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -451,8 +451,7 @@ export async function handleResponseEAR(
new CryptoOps(logger, performanceClient),
logger,
null,
null,
performanceClient
null
);

// Validate response. This function throws a server error if an error is returned by the server.
Expand Down
9 changes: 0 additions & 9 deletions lib/msal-browser/src/request/RequestHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,6 @@ export async function initializeBaseRequest(
performanceClient: IPerformanceClient,
logger: Logger
): Promise<BaseAuthRequest> {
performanceClient.addQueueMeasurement(
PerformanceEvents.InitializeBaseRequest,
request.correlationId
);
const authority = request.authority || config.auth.authority;

const scopes = [...((request && request.scopes) || [])];
Expand Down Expand Up @@ -91,11 +87,6 @@ export async function initializeSilentRequest(
performanceClient: IPerformanceClient,
logger: Logger
): Promise<CommonSilentFlowRequest> {
performanceClient.addQueueMeasurement(
PerformanceEvents.InitializeSilentRequest,
request.correlationId
);

const baseRequest = await invokeAsync(
initializeBaseRequest,
PerformanceEvents.InitializeBaseRequest,
Expand Down
Loading