diff --git a/change/@azure-msal-browser-0a5f76a8-aff2-45d5-8cd4-7caab48a08b2.json b/change/@azure-msal-browser-0a5f76a8-aff2-45d5-8cd4-7caab48a08b2.json new file mode 100644 index 0000000000..ee70ea0c4e --- /dev/null +++ b/change/@azure-msal-browser-0a5f76a8-aff2-45d5-8cd4-7caab48a08b2.json @@ -0,0 +1,7 @@ +{ + "type": "minor", + "comment": "Remove redundant perf client and function wrapper logging #8079", + "packageName": "@azure/msal-browser", + "email": "kshabelko@microsoft.com", + "dependentChangeType": "patch" +} diff --git a/change/@azure-msal-common-a5d8892d-abcf-4699-8308-d5c421bdcbc2.json b/change/@azure-msal-common-a5d8892d-abcf-4699-8308-d5c421bdcbc2.json new file mode 100644 index 0000000000..901afbfae6 --- /dev/null +++ b/change/@azure-msal-common-a5d8892d-abcf-4699-8308-d5c421bdcbc2.json @@ -0,0 +1,7 @@ +{ + "type": "minor", + "comment": "Remove redundant perf client and function wrapper logging #8079", + "packageName": "@azure/msal-common", + "email": "kshabelko@microsoft.com", + "dependentChangeType": "patch" +} diff --git a/lib/msal-browser/src/controllers/StandardController.ts b/lib/msal-browser/src/controllers/StandardController.ts index 1d2a36e6fd..74e9a79610 100644 --- a/lib/msal-browser/src/controllers/StandardController.ts +++ b/lib/msal-browser/src/controllers/StandardController.ts @@ -2303,16 +2303,20 @@ export class StandardController implements IController { private getPreGeneratedPkceCodes( correlationId: string ): PkceCodes | undefined { - this.logger.verbose( - "Attempting to pick up pre-generated PKCE codes", - correlationId - ); const res = this.pkceCode ? { ...this.pkceCode } : undefined; this.pkceCode = undefined; - this.logger.verbose( - `'${res ? "Found" : "Did not find"}' pre-generated PKCE codes`, - correlationId - ); + if (res) { + this.logger.verbose( + `Pre-generated PKCE codes were found`, + correlationId + ); + } else { + this.logger.verbose( + `Pre-generated PKCE codes were not found`, + correlationId + ); + } + this.performanceClient.addFields( { usePreGeneratedPkce: !!res }, correlationId diff --git a/lib/msal-common/apiReview/msal-common.api.md b/lib/msal-common/apiReview/msal-common.api.md index 4e6222a134..9b9c9963ef 100644 --- a/lib/msal-common/apiReview/msal-common.api.md +++ b/lib/msal-common/apiReview/msal-common.api.md @@ -4663,12 +4663,12 @@ const X_MS_LIB_CAPABILITY_VALUE: string; // src/response/ResponseHandler.ts:340:8 - (tsdoc-param-tag-missing-hyphen) The @param block should be followed by a parameter name and then a hyphen // src/response/ResponseHandler.ts:341:8 - (tsdoc-param-tag-missing-hyphen) The @param block should be followed by a parameter name and then a hyphen // src/response/ResponseHandler.ts:342:8 - (tsdoc-param-tag-missing-hyphen) The @param block should be followed by a parameter name and then a hyphen -// src/telemetry/performance/PerformanceClient.ts:705:8 - (tsdoc-param-tag-missing-hyphen) The @param block should be followed by a parameter name and then a hyphen -// src/telemetry/performance/PerformanceClient.ts:705:15 - (tsdoc-param-tag-with-invalid-type) The @param block should not include a JSDoc-style '{type}' -// src/telemetry/performance/PerformanceClient.ts:717:8 - (tsdoc-param-tag-missing-hyphen) The @param block should be followed by a parameter name and then a hyphen -// src/telemetry/performance/PerformanceClient.ts:717:27 - (tsdoc-param-tag-with-invalid-type) The @param block should not include a JSDoc-style '{type}' -// src/telemetry/performance/PerformanceClient.ts:718:24 - (tsdoc-escape-right-brace) The "}" character should be escaped using a backslash to avoid confusion with a TSDoc inline tag -// src/telemetry/performance/PerformanceClient.ts:718:17 - (tsdoc-malformed-inline-tag) Expecting a TSDoc tag starting with "{@" +// src/telemetry/performance/PerformanceClient.ts:664:8 - (tsdoc-param-tag-missing-hyphen) The @param block should be followed by a parameter name and then a hyphen +// src/telemetry/performance/PerformanceClient.ts:664:15 - (tsdoc-param-tag-with-invalid-type) The @param block should not include a JSDoc-style '{type}' +// src/telemetry/performance/PerformanceClient.ts:676:8 - (tsdoc-param-tag-missing-hyphen) The @param block should be followed by a parameter name and then a hyphen +// src/telemetry/performance/PerformanceClient.ts:676:27 - (tsdoc-param-tag-with-invalid-type) The @param block should not include a JSDoc-style '{type}' +// src/telemetry/performance/PerformanceClient.ts:677:24 - (tsdoc-escape-right-brace) The "}" character should be escaped using a backslash to avoid confusion with a TSDoc inline tag +// src/telemetry/performance/PerformanceClient.ts:677:17 - (tsdoc-malformed-inline-tag) Expecting a TSDoc tag starting with "{@" // src/telemetry/performance/PerformanceEvent.ts:37:21 - (tsdoc-escape-right-brace) The "}" character should be escaped using a backslash to avoid confusion with a TSDoc inline tag // src/telemetry/performance/PerformanceEvent.ts:37:14 - (tsdoc-malformed-inline-tag) Expecting a TSDoc tag starting with "{@" // src/telemetry/performance/PerformanceEvent.ts:37:8 - (tsdoc-undefined-tag) The TSDoc tag "@type" is not defined in this configuration diff --git a/lib/msal-common/src/telemetry/performance/PerformanceClient.ts b/lib/msal-common/src/telemetry/performance/PerformanceClient.ts index 8cd8824f5d..4501218e0c 100644 --- a/lib/msal-common/src/telemetry/performance/PerformanceClient.ts +++ b/lib/msal-common/src/telemetry/performance/PerformanceClient.ts @@ -350,17 +350,6 @@ export abstract class PerformanceClient implements IPerformanceClient { ): InProgressPerformanceEvent { // Generate a placeholder correlation if the request does not provide one const eventCorrelationId = correlationId || this.generateId(); - if (!correlationId) { - this.logger.info( - `PerformanceClient: No correlation id provided for '${measureName}', generating`, - eventCorrelationId - ); - } - - this.logger.trace( - `PerformanceClient: Performance measurement started for '${measureName}'`, - eventCorrelationId - ); const inProgressEvent: PerformanceEvent = { eventId: this.generateId(), @@ -460,11 +449,6 @@ export abstract class PerformanceClient implements IPerformanceClient { rootEvent.incompleteSubMeasurements?.delete(event.eventId); } - this.logger.trace( - `PerformanceClient: Performance measurement ended for '${event.name}': '${event.durationMs}' ms`, - event.correlationId - ); - if (error) { addError(error, this.logger, rootEvent); } @@ -526,10 +510,6 @@ export abstract class PerformanceClient implements IPerformanceClient { fields: { [key: string]: {} | undefined }, correlationId: string ): void { - this.logger.trace( - "PerformanceClient: Updating static fields", - correlationId - ); const event = this.eventsByCorrelationId.get(correlationId); if (event) { this.eventsByCorrelationId.set(correlationId, { @@ -553,10 +533,6 @@ export abstract class PerformanceClient implements IPerformanceClient { fields: { [key: string]: number | undefined }, correlationId: string ): void { - this.logger.trace( - "PerformanceClient: Updating counters", - correlationId - ); const event = this.eventsByCorrelationId.get(correlationId); if (event) { for (const counter in fields) { @@ -587,10 +563,6 @@ export abstract class PerformanceClient implements IPerformanceClient { protected cacheEventByCorrelationId(event: PerformanceEvent): void { const rootEvent = this.eventsByCorrelationId.get(event.correlationId); if (rootEvent) { - this.logger.trace( - `PerformanceClient: Performance measurement for '${event.name}' added/updated`, - event.correlationId - ); rootEvent.incompleteSubMeasurements = rootEvent.incompleteSubMeasurements || new Map(); rootEvent.incompleteSubMeasurements.set(event.eventId, { @@ -598,10 +570,6 @@ export abstract class PerformanceClient implements IPerformanceClient { startTimeMs: event.startTimeMs, }); } else { - this.logger.trace( - `PerformanceClient: Performance measurement for '${event.name}' started`, - event.correlationId - ); this.eventsByCorrelationId.set(event.correlationId, { ...event }); this.eventStack.set(event.correlationId, []); } @@ -613,16 +581,7 @@ export abstract class PerformanceClient implements IPerformanceClient { * @param {string} correlationId */ discardMeasurements(correlationId: string): void { - this.logger.trace( - "PerformanceClient: Performance measurements discarded", - correlationId - ); this.eventsByCorrelationId.delete(correlationId); - - this.logger.trace( - "PerformanceClient: Event stack discarded", - correlationId - ); this.eventStack.delete(correlationId); } diff --git a/lib/msal-common/src/utils/FunctionWrappers.ts b/lib/msal-common/src/utils/FunctionWrappers.ts index 46af66eae0..b487f48d56 100644 --- a/lib/msal-common/src/utils/FunctionWrappers.ts +++ b/lib/msal-common/src/utils/FunctionWrappers.ts @@ -26,7 +26,6 @@ export const invoke = , U>( correlationId: string ) => { return (...args: T): U => { - logger.trace(`Executing function '${eventName}'`, correlationId); const inProgressEvent = telemetryClient.startMeasurement( eventName, correlationId @@ -41,7 +40,6 @@ export const invoke = , U>( inProgressEvent.end({ success: true, }); - logger.trace(`Returning result from '${eventName}'`, correlationId); return result; } catch (e) { logger.trace(`Error occurred in '${eventName}'`, correlationId); @@ -82,7 +80,6 @@ export const invokeAsync = , U>( correlationId: string ) => { return (...args: T): Promise => { - logger.trace(`Executing function '${eventName}'`, correlationId); const inProgressEvent = telemetryClient.startMeasurement( eventName, correlationId @@ -94,10 +91,6 @@ export const invokeAsync = , U>( } return callback(...args) .then((response) => { - logger.trace( - `Returning result from '${eventName}'`, - correlationId - ); inProgressEvent.end({ success: true, }); diff --git a/lib/msal-common/test/utils/FunctionWrappers.spec.ts b/lib/msal-common/test/utils/FunctionWrappers.spec.ts index 577613ddcf..016513b5ac 100644 --- a/lib/msal-common/test/utils/FunctionWrappers.spec.ts +++ b/lib/msal-common/test/utils/FunctionWrappers.spec.ts @@ -28,7 +28,6 @@ describe("FunctionWrappers Unit Tests", () => { end = jest.spyOn(inProgressMeasurement, "end"); return inProgressMeasurement; }); - const loggerSpy = jest.spyOn(logger, "trace"); const testCallback = (arg1: string, arg2: number): string => { expect(arg1).toBe("arg1"); @@ -50,7 +49,6 @@ describe("FunctionWrappers Unit Tests", () => { "testCorrelationId" ); expect(end).toHaveBeenCalledWith({ success: true }); - expect(loggerSpy).toHaveBeenCalledTimes(2); }); it("failure", () => { @@ -93,7 +91,7 @@ describe("FunctionWrappers Unit Tests", () => { "testCorrelationId" ); expect(end).toHaveBeenCalledWith({ success: false }, error); - expect(loggerSpy).toHaveBeenCalledTimes(3); + expect(loggerSpy).toHaveBeenCalledTimes(2); }); }); @@ -110,7 +108,6 @@ describe("FunctionWrappers Unit Tests", () => { end = jest.spyOn(inProgressMeasurement, "end"); return inProgressMeasurement; }); - const loggerSpy = jest.spyOn(logger, "trace"); const testCallback = ( arg1: string, @@ -135,7 +132,6 @@ describe("FunctionWrappers Unit Tests", () => { "testCorrelationId" ); expect(end).toHaveBeenCalledWith({ success: true }); - expect(loggerSpy).toHaveBeenCalledTimes(2); }); it("failure", async () => { @@ -180,7 +176,7 @@ describe("FunctionWrappers Unit Tests", () => { "testCorrelationId" ); expect(end).toHaveBeenCalledWith({ success: false }, error); - expect(loggerSpy).toHaveBeenCalledTimes(3); + expect(loggerSpy).toHaveBeenCalledTimes(2); }); }); });