-
Notifications
You must be signed in to change notification settings - Fork 337
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
Add time metrics to AuthenticationResult metadata #2581
Conversation
bgavrilMS
commented
Apr 26, 2021
- time in total
- time spent in HTTP
- time spent in token cache callbacks
c7840fb
to
3c1c598
Compare
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.
Some thoughts + small nits below (but most are shared in our offline discussion). Good to see the data results and comparison. BenchmarkDotNet does seem to offer custom columns that could maybe show the duration metrics; iteration/global setup methods can be used to set up the CCA and cache; and WithIterationCount/WithIterationTime can modify how many times the iterations are called - (although that seems like more work and you already have working test).
src/client/Microsoft.Identity.Client/AuthenticationResultMetadata.cs
Outdated
Show resolved
Hide resolved
|
||
/// <summary> | ||
/// Time (in ms) MSAL spent in reading and writing to the token cache, i.e. in the OnBeforeAccess, OnAfterAccess etc. callbacks. | ||
/// Does not include internal MSAL logic for searching through the cache once loaded. |
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.
Should this be included to measure the whole cache operation? Otherwise, only measuring accessing serialization cache, the property name might be misleading then.
Stopwatch sw = new Stopwatch(); | ||
sw.Start(); |
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.
Nit: can be combined into Stopwatch sw = Stopwatch.StartNew();
@@ -12,6 +12,8 @@ namespace Microsoft.Identity.Client.Http | |||
{ | |||
internal interface IHttpManager | |||
{ | |||
long LastRequestTime { get; } |
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.
LastRequestDurationInMs
// execute won't start here because IEnumerable is lazy | ||
IEnumerable<Task<AuthenticationResult>> tasks = accounts.Select(acc => | ||
pca.AcquireTokenSilent(TestConstants.s_scope, acc).ExecuteAsync()); | ||
//return cca.AcquireTokenForClient(new[] { "scope" }) |
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.
Uncomment and use s_cca here?
@@ -234,6 +104,8 @@ private void ConfigureCacheSerialization(IPublicClientApplication pca) | |||
/// </summary> | |||
internal class ParallelRequestMockHanler : IHttpManager |
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.
ParallelRequestMockHandler
/// - provides a standard reponse for discovery calls | ||
/// - responds with valid tokens based on a naming convention (uid = "uid" + rtSecret, upn = "user_" + rtSecret) | ||
/// </summary> | ||
internal class ParallelRequestMockHanler : IHttpManager |
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.
typo: ParallelRequestMockHandler
[Route("[controller]")] | ||
public class StaticDictionaryController : ControllerBase | ||
{ | ||
private readonly ILogger<SingletonController> _logger; |
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.
private readonly ILogger<StaticDictionaryController> _logger;