public override async Task <TResponse> UnaryServerHandler <TRequest, TResponse>(TRequest request, Grpc.Core.ServerCallContext context, Grpc.Core.UnaryServerMethod <TRequest, TResponse> continuation) { var method = context.Method; var flowId = GetFlowId(request); var result = await base.UnaryServerHandler(request, context, continuation); if (flowId.HasValue) { commandsRepository.Add(request, flowId.Value); } return(result); }
public override async Task <TResponse> UnaryServerHandler <TRequest, TResponse>(TRequest request, Grpc.Core.ServerCallContext context, Grpc.Core.UnaryServerMethod <TRequest, TResponse> continuation) { var method = context.Method; var flowId = context.RequestHeaders.FirstOrDefault(h => h.Key == "flowid")?.Value; this.logger.LogInformation($"Service='{serviceName}' FlowId='{flowId}' Method='{method}' Type='Start'"); var stopwatch = Stopwatch.StartNew(); try { return(await base.UnaryServerHandler(request, context, continuation)); } finally { logger.LogInformation($"Service='{serviceName}' FlowId='{flowId}' Method='{method}' Type='End' Processing='{stopwatch.ElapsedMilliseconds}'"); } }