public override void OnActionExecuted(HttpActionExecutedContext actionExecutedContext) { base.OnActionExecuted(actionExecutedContext); try { var instrumentationContext = string.Format("{0}_{1}", actionExecutedContext.Request.Method, actionExecutedContext.Request.RequestUri); if (_instrumentationContextProvider != null) { instrumentationContext = _instrumentationContextProvider.GetContext(actionExecutedContext); } if (actionExecutedContext.Request.Properties.ContainsKey(PerfItTwoStageKey)) { var token = actionExecutedContext.Request.Properties[PerfItTwoStageKey] as InstrumentationToken; if (actionExecutedContext.Exception != null && token != null) { token.Contexts.Item2.SetContextToErrorState(); } _instrumentor.Finish(token, instrumentationContext); } } catch (Exception exception) { Trace.TraceError(exception.ToString()); if (RaisePublishErrors) { throw; } } }
public override void OnActionExecuted(ActionExecutedContext actionExecutedContext) { base.OnActionExecuted(actionExecutedContext); try { var instrumentationContext = string.Format("{0}_{1}", actionExecutedContext.ActionDescriptor.ActionName, actionExecutedContext.HttpContext.Request.Url); if (_instrumentationContextProvider != null) { instrumentationContext = _instrumentationContextProvider.GetContext(actionExecutedContext); } if (!actionExecutedContext.HttpContext.Items.Contains(PerfItTwoStageKey)) { return; } var token = actionExecutedContext.HttpContext.Items[PerfItTwoStageKey] as InstrumentationToken; if (!(actionExecutedContext.Exception == null || token == null)) { token.Context.Data.SetContextToErrorState(); } _instrumentor.Finish(token, instrumentationContext); } catch (Exception ex) { Trace.TraceError(ex.ToString()); if (RaisePublishErrors) { throw; } } }
public override void OnActionExecuted(ActionExecutedContext context) { base.OnActionExecuted(context); try { var instrumentationContext = new InstrumentationContext { Text1 = string.Format("{0}_{1}", context.ActionDescriptor.DisplayName, context.HttpContext.Request.Path) }; if (_instrumentationContextProvider != null) { instrumentationContext = _instrumentationContextProvider.GetContext(context); } if (context.HttpContext.Items.ContainsKey(PerfItTwoStageKey)) { var token = context.HttpContext.Items[PerfItTwoStageKey] as InstrumentationToken; if (context.Exception != null && token != null) { token.Contexts.SetContextToErrorState(); } _instrumentor.Finish(token, instrumentationContext); } } catch (Exception exception) { if (RaisePublishErrors) { throw; } } }