Exemplo n.º 1
0
        public void Initialize(ITelemetry telemetry)
        {
            telemetry = _telemetryEnricher.Enrich(telemetry);

            if (_telemetryEnricher.AttachRequest(_httpContextAccessor.HttpContext))
            {
                AddRequestBody(telemetry);
            }

            if (_telemetryEnricher.AttachResponse(_httpContextAccessor.HttpContext))
            {
                AddResponseBody(telemetry);
            }
        }
Exemplo n.º 2
0
 public override async Task OnResultExecutionAsync(ResultExecutingContext context, ResultExecutionDelegate next)
 {
     if (_telemetryEnricher.AttachResponse(context.HttpContext))
     {
         _bodyAccessor.SetBody(context.HttpContext, context.Result)
         .Bind(
             x => x.ToSuccess(),
             err =>
         {
             _logger.LogWarning(err.Message, err);
             return(err.Message.ToFailure <Unit>());
         });
     }
     await next();
 }