Deferred from #6 (review-findings-of-review-findings pass), flagged for triage before GA. Pre-existing behavior, not a regression introduced by #6.
Where
MarkMonitorClient.EnsureAuthenticatedAsync (markmonitor-caplugin/Client/MarkMonitorClient.cs:1130):
private async Task EnsureAuthenticatedAsync()
{
if (!TokenNeedsRefresh()) return;
await _authLock.WaitAsync();
try
{
if (TokenNeedsRefresh())
{
_logger.LogDebug("No valid bearer token on hand - authenticating");
await AuthenticateAsync();
}
}
finally
{
_authLock.Release();
}
}
Problem
Only the caller that actually wins the lock and calls AuthenticateAsync() logs anything. Callers
that were blocked on _authLock.WaitAsync() while another caller refreshed the token, then find
TokenNeedsRefresh() false once they acquire the lock, return silently. This makes it hard to tell
from logs alone how many concurrent operations were piled up waiting on a single re-authentication -
useful signal for diagnosing thundering-herd-style load against MarkMonitor's auth endpoint.
Suggested fix
Add a LogDebug/LogTrace in the else branch (i.e. when a waiter finds the token already
refreshed by someone else) noting that this call reused a token refreshed concurrently by another
caller.
Deferred from #6 (review-findings-of-review-findings pass), flagged for triage before GA. Pre-existing behavior, not a regression introduced by #6.
Where
MarkMonitorClient.EnsureAuthenticatedAsync(markmonitor-caplugin/Client/MarkMonitorClient.cs:1130):Problem
Only the caller that actually wins the lock and calls
AuthenticateAsync()logs anything. Callersthat were blocked on
_authLock.WaitAsync()while another caller refreshed the token, then findTokenNeedsRefresh()false once they acquire the lock, return silently. This makes it hard to tellfrom logs alone how many concurrent operations were piled up waiting on a single re-authentication -
useful signal for diagnosing thundering-herd-style load against MarkMonitor's auth endpoint.
Suggested fix
Add a
LogDebug/LogTracein theelsebranch (i.e. when a waiter finds the token alreadyrefreshed by someone else) noting that this call reused a token refreshed concurrently by another
caller.