示例#1
0
        public override void OnResultExecuted(ResultExecutedContext filterContext)
        {
            if (filterContext.HttpContext.Response.IsRequestBeingRedirected)
            {
                return;
            }
            if (CheckNeedTrace(filterContext.HttpContext) == false)
            {
                return;
            }
            TraceInfo info = filterContext.RequestContext.HttpContext.Items["ibb360_RequestTrace_6742"] as TraceInfo;

            if (info != null)
            {
                info.Stop(filterContext.Exception != null && (filterContext.Exception is BizException) == false);
                string urlReferrer = filterContext.RequestContext.HttpContext.Request.UrlReferrer != null?filterContext.RequestContext.HttpContext.Request.UrlReferrer.ToString() : null;

                string domainReferrer = filterContext.RequestContext.HttpContext.Request.UrlReferrer != null ? filterContext.RequestContext.HttpContext.Request.UrlReferrer.Host : null;
                string url            = filterContext.RequestContext.HttpContext.Request.RawUrl;
                string clientType     = DetectRequestClientType(filterContext.HttpContext);
                if (string.IsNullOrWhiteSpace(clientType))
                {
                    clientType = "OT";
                }
                RequestTraceMessage msg = info.ToMessage(filterContext.HttpContext, url, urlReferrer, domainReferrer, clientType);
                SetExtentionData(filterContext.HttpContext, msg.ExtentionData);
                TaskPool.Instance.Enqueue(msg);
            }
        }