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

Missing trace when converting HTTP Timeout to 503 #3831

Closed
ealsur opened this issue Apr 28, 2023 · 0 comments · Fixed by #3866
Closed

Missing trace when converting HTTP Timeout to 503 #3831

ealsur opened this issue Apr 28, 2023 · 0 comments · Fixed by #3866
Assignees
Labels
bug Something isn't working

Comments

@ealsur
Copy link
Member

ealsur commented Apr 28, 2023

When we convert HTTP timeouts to a 503 response, we are failing to pass the trace parameter.

if (isOutOfRetries || !timeoutPolicy.IsSafeToRetry(requestMessage.Method))
{
// throw current exception (caught in transport handler)
string message =
$"GatewayStoreClient Request Timeout. Start Time UTC:{startDateTimeUtc}; Total Duration:{(DateTime.UtcNow - startDateTimeUtc).TotalMilliseconds} Ms; Request Timeout {requestTimeout.TotalMilliseconds} Ms; Http Client Timeout:{this.httpClient.Timeout.TotalMilliseconds} Ms; Activity id: {System.Diagnostics.Trace.CorrelationManager.ActivityId};";
e.Data.Add("Message", message);
if (timeoutPolicy.ShouldThrow503OnTimeout)
{
throw CosmosExceptionFactory.CreateServiceUnavailableException(
message: message,
headers: new Headers()
{
ActivityId = System.Diagnostics.Trace.CorrelationManager.ActivityId.ToString(),
SubStatusCode = SubStatusCodes.TransportGenerated503
},
innerException: e);
}

CosmosExceptionFactory.CreateServiceUnavailableException has a trace parameter that we are not passing.

This generates empty diagnostics:

Response status code does not indicate success: ServiceUnavailable (503); Substatus: 20003; ActivityId: xxxxx; Reason: (GatewayStoreClient Request Timeout. Start Time UTC:xx/xx/xxxx xx:xx:xx xx; Total Duration:65013.1998 Ms; Request Timeout 65000 Ms; Http Client Timeout:65000 Ms; Activity id: xxxx;);; 
Diagnostics:{"Summary":{},"name":"NoOp","start time":"00:00:00:000","duration in milliseconds":0}
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants