Skip to content
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

Dynamically load BrowserPerformanceMeasurement to capture browser perf measurements if session storage flag is set #6748

Merged
merged 8 commits into from
Dec 14, 2023

Conversation

konstantin-msft
Copy link
Collaborator

@konstantin-msft konstantin-msft commented Dec 5, 2023

Changes:

  • Dynamically load BrowserPerformanceMeasurement to capture browser perf measurements if session storage flag is set.
  • Calculate telemetry event duration using Unix epoch if browser performance API is not available.
  • Update browser performance doc.

Background:
Browser performance measures introduce additional overhead caused by buffer polling and linear-ish time complexity when calling getEntriesByName(). We can directly use window.performance.now() instead to measure telemetry event duration.

@github-actions github-actions bot added msal-browser Related to msal-browser package msal-common Related to msal-common package labels Dec 5, 2023
@konstantin-msft konstantin-msft force-pushed the reduce_telemetry_overhead branch from 6426d72 to 4d523b5 Compare December 5, 2023 19:04
@konstantin-msft konstantin-msft marked this pull request as ready for review December 5, 2023 19:19
@github-actions github-actions bot added the documentation Related to documentation. label Dec 11, 2023
@konstantin-msft konstantin-msft force-pushed the reduce_telemetry_overhead branch from 7caaead to 4d2c212 Compare December 11, 2023 18:13
@konstantin-msft konstantin-msft changed the title Deprecate BrowserPerformanceMeasurement in favor of calculating telemetry event duration in place with browser performance API Dynamically load BrowserPerformanceMeasurement to capture browser perf measurements if session storage flag is set Dec 11, 2023
Copy link
Collaborator

@tnorling tnorling left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good besides the breaking changes

@konstantin-msft konstantin-msft force-pushed the reduce_telemetry_overhead branch 2 times, most recently from b727943 to 884a55b Compare December 14, 2023 18:13
const inProgressEvent = super.startMeasurement(
measureName,
correlationId
);
const startTime: number | undefined = supportsBrowserPerformanceNow()
? window.performance.now()
: undefined;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do we see in our telemetry if the performance API isn't available? Do we get some sort of indication or do we toss out the data?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If performance API isn't available, then telemetry event duration is calculated using Unix epoch, a subject to clock skew, instead of browser.performance.now(). No data is tossed out. There is no indication of performance API availability in telemetry though.

konstantin-msft and others added 5 commits December 14, 2023 14:07
…elemetry event duration in place with browser performance API.

- Calculate telemetry event duration using Unix epoch if browser performance API is not available.
…surements if session storage flag is enabled.

- Update browser perf doc.
@konstantin-msft konstantin-msft force-pushed the reduce_telemetry_overhead branch from e0a6bc4 to b397807 Compare December 14, 2023 19:07
@konstantin-msft konstantin-msft merged commit 4aacf4d into dev Dec 14, 2023
56 checks passed
@konstantin-msft konstantin-msft deleted the reduce_telemetry_overhead branch December 14, 2023 19:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Related to documentation. msal-browser Related to msal-browser package msal-common Related to msal-common package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants