in src/Middleware/Grpc/Client/ClientApiRequestLogger.cs [19:48]
public override AsyncUnaryCall<TResponse> AsyncUnaryCall<TRequest, TResponse>(
TRequest request,
ClientInterceptorContext<TRequest, TResponse> context,
AsyncUnaryCallContinuation<TRequest, TResponse> continuation)
{
DateTime start = DateTime.Now;
string requestId = string.Empty;
var headers = context.Options.Headers;
if (headers != null)
{
var headerValue = headers.GetValue(Constants.RequestIDMetadataKey);
if (headerValue != null)
{
requestId = headerValue;
}
}
var logger = _logger.WithServiceProperties(context.Method.FullName)
.ForContext(Constants.RequestIDLogKey, requestId)
.ForContext(Constants.ComponentFieldKey, Constants.ComponentValueClient)
.ForContext(Constants.MethodTypeFieldKey, context.Method.Type.ToString().ToLower())
.ForContext(Constants.StartTimeKey, start.ToString("yyyy-MM-ddTHH:mm:sszzz"))
// readding here since source field seems to get removed, even after adding in interceptor.cs
.ForContext("source", "ApiRequestLog");
var response = continuation(request, context);
Task.Run(() => HandleResponse(response, start, logger));
return response;
}