Fix tracing wrapper. (#966)

This commit is contained in:
Alex Kursov 2019-07-23 20:54:42 -07:00 committed by Thiago Loureiro
parent 176a7bb960
commit ad00f20a23

View File

@ -79,12 +79,12 @@ namespace Ocelot.Middleware.Pipeline
var diagnosticListener = (DiagnosticListener)app.ApplicationServices.GetService(typeof(DiagnosticListener)); var diagnosticListener = (DiagnosticListener)app.ApplicationServices.GetService(typeof(DiagnosticListener));
var middlewareName = ocelotDelegate.Target.GetType().Name; var middlewareName = ocelotDelegate.Target.GetType().Name;
OcelotRequestDelegate wrapped = context => OcelotRequestDelegate wrapped = async context =>
{ {
try try
{ {
Write(diagnosticListener, "Ocelot.MiddlewareStarted", middlewareName, context); Write(diagnosticListener, "Ocelot.MiddlewareStarted", middlewareName, context);
return ocelotDelegate(context); await ocelotDelegate(context);
} }
catch (Exception ex) catch (Exception ex)
{ {