public override void OnActionExecuting(HttpActionContext actionContext)
        {
            var traceProvider = AspNetTracing.GetProvider(HttpContext.Current);
            var requestTrace  = traceProvider?.CurrentTrace;

            if (requestTrace == null)
            {
                return;
            }

            requestTrace.SetTag(TraceTagNames.Operation, actionContext.ControllerContext.RouteData.Route.RouteTemplate);
            traceProvider.StartActionTrace(m_serviceName, actionContext.ControllerContext.ControllerDescriptor.ControllerName, actionContext.ActionDescriptor.ActionName);

            base.OnActionExecuting(actionContext);
        }
示例#2
0
        public static void Initialize(HttpApplication application, AspNetMvcTracingSettings settings)
        {
            if (application == null)
            {
                throw new ArgumentNullException(nameof(application));
            }
            if (settings == null)
            {
                throw new ArgumentNullException(nameof(settings));
            }

            if (AspNetTracing.Initialize(application, settings.ServiceName, settings.CreateTracer, settings.SamplingRate))
            {
                GlobalFilters.Filters.Add(new TracingActionFilterAttribute(settings.ServiceName));
            }
        }
示例#3
0
        public override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            var traceProvider = AspNetTracing.GetProvider(filterContext.HttpContext);
            var requestTrace  = traceProvider?.CurrentTrace;

            if (requestTrace == null)
            {
                return;
            }

            var routeData = filterContext.Controller.ControllerContext.RouteData;

            if (routeData.Route is Route route)
            {
                requestTrace.SetTag(TraceTagNames.Operation, route.Url);
            }

            traceProvider.StartActionTrace(m_serviceName, (string)routeData.Values["controller"], (string)routeData.Values["action"]);

            base.OnActionExecuting(filterContext);
        }
示例#4
0
        public override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            var provider    = AspNetTracing.GetProvider(filterContext.HttpContext);
            var requestSpan = provider?.CurrentSpan;

            if (requestSpan == null)
            {
                return;
            }

            var routeData = filterContext.Controller.ControllerContext.RouteData;

            if (routeData.Route is Route route && !filterContext.IsChildAction)
            {
                requestSpan.SetTag(SpanTagNames.Operation, route.Url);
            }

            provider.StartActionSpan(m_serviceName, (string)routeData.Values["controller"], (string)routeData.Values["action"]);

            base.OnActionExecuting(filterContext);
        }
示例#5
0
 public static ITraceProvider GetProvider(HttpContext httpContext) => AspNetTracing.GetProvider(httpContext) ?? NullTraceProvider.Instance;
 public static ITraceProvider GetProvider(HttpContext context) => AspNetTracing.GetProvider(context);
示例#7
0
 public override void OnActionExecuted(ActionExecutedContext filterContext)
 {
     AspNetTracing.GetProvider(filterContext.HttpContext)?.FinishActionTrace();
     base.OnActionExecuted(filterContext);
 }
 public override void OnActionExecuted(HttpActionExecutedContext actionExecutedContext)
 {
     AspNetTracing.GetProvider(HttpContext.Current)?.FinishActionTrace();
     base.OnActionExecuted(actionExecutedContext);
 }