-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Instrument cache location #7868
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
base: dev
Are you sure you want to change the base?
Conversation
konstantin-msft
commented
Jun 26, 2025
- Instrument cache location
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Adds instrumentation of the cache location into performance events and updates tests to supply and verify this new field.
- Introduces a new
cacheLocation
property onPerformanceEvent
and updates the API doc. - Populates
cacheLocation
inBaseInteractionClient
during initialization. - Updates existing tests and adds new ones in
PublicClientApplication.spec.ts
to set and assert oncacheLocation
.
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
lib/msal-common/src/telemetry/performance/PerformanceEvent.ts | Added optional cacheLocation field to performance events |
lib/msal-common/apiReview/msal-common.api.md | Updated API review to include cacheLocation |
lib/msal-browser/src/interaction_client/BaseInteractionClient.ts | Instrumented cacheLocation in performance client setup |
lib/msal-browser/test/custom_auth//SignClient.spec.ts | Imported cache enums, default perf client, and set cache config |
lib/msal-browser/test/app/PublicClientApplication.spec.ts | Added assertions/tests for cacheLocation instrumentation |
Comments suppressed due to low confidence (3)
lib/msal-common/src/telemetry/performance/PerformanceEvent.ts:902
- The cacheLocation property is typed as a generic string, which allows invalid values. Consider using the BrowserCacheLocation enum or a union type of allowed values (e.g., 'localStorage' | 'sessionStorage') for stronger type safety.
cacheLocation?: string;
lib/msal-browser/src/interaction_client/BaseInteractionClient.ts:85
- Accessing config.cache.cacheLocation directly can throw if cache or cacheLocation is undefined. Consider adding a null-check or default value, e.g., config.cache?.cacheLocation or providing a fallback.
}
lib/msal-browser/test/app/PublicClientApplication.spec.ts:930
- BrowserCacheLocation is used here but not imported at the top of the file, which will cause a compilation error. Please add
import { BrowserCacheLocation } from '../../../../src/utils/BrowserConstants.js';
.
cacheLocation: BrowserCacheLocation.LocalStorage,
c0eb420
to
4cad1ef
Compare