/// <summary> /// Constructor for .NET Core 3 and later /// </summary> internal PageMetric(AspNetConfiguration options, ObjectPool <StringBuilder> stringBuilderPool, HttpContext httpContext, PageActionDescriptor pageDescriptor, ActionMetricBase?rootActionMetric) : base(options, stringBuilderPool, httpContext, pageDescriptor, rootActionMetric) { Path = pageDescriptor.RelativePath; AreaName = pageDescriptor.AreaName; Request = pageDescriptor.RelativePath; DisplayName = pageDescriptor.DisplayName; }
/// <summary> /// Constructor for .NET Core 2 /// </summary> internal ControllerMetric(AspNetConfiguration options, ObjectPool <StringBuilder> stringBuilderPool, ActionExecutingContext actionExecutingContext) : base(options, stringBuilderPool, actionExecutingContext) { if (actionExecutingContext.ActionDescriptor is ControllerActionDescriptor controllerActionDescriptor) { ControllerName = controllerActionDescriptor.ControllerName; ActionName = controllerActionDescriptor.ActionName; ClassName = controllerActionDescriptor.ControllerTypeInfo.FullName; MethodName = controllerActionDescriptor.MethodInfo?.Name; } }
/// <summary> /// Constructor for .NET Core 3 and later /// </summary> internal ControllerMetric(AspNetConfiguration options, ObjectPool <StringBuilder> stringBuilderPool, HttpContext httpContext, ControllerActionDescriptor controllerDescriptor, ActionMetricBase?rootActionMetric) : base(options, stringBuilderPool, httpContext, controllerDescriptor, rootActionMetric) { _stringBuilderPool = stringBuilderPool; ControllerName = controllerDescriptor.ControllerName; ActionName = controllerDescriptor.ActionName; ClassName = controllerDescriptor.ControllerTypeInfo?.FullName; MethodName = controllerDescriptor.MethodInfo?.Name; Request = string.Format("{0}:{1}", ControllerName, ActionName); Path = httpContext.Request.Path; }
/// <summary> /// Constructor for .NET Core 2 /// </summary> internal ActionMetricBase(AspNetConfiguration options, ObjectPool <StringBuilder> stringBuilderPool, ActionExecutingContext actionExecutingContext) { Options = options; _stringBuilderPool = stringBuilderPool; StartTimestamp = DateTimeOffset.Now; _startTicks = Stopwatch.GetTimestamp(); var httpContext = actionExecutingContext.HttpContext; ConnectionId = httpContext.Connection.Id; RequestId = httpContext.TraceIdentifier; SessionId = httpContext.GetSessionId(); AgentSessionId = httpContext.GetAgentSessionId(); HttpMethod = httpContext.Request.Method; Parameters = StringifyParameterNames(actionExecutingContext.ActionDescriptor.Parameters); }
/// <summary> /// Initializes a new instance of the <see cref="ActionDiagnosticListener"/> class. /// </summary> /// <param name="agent">The Loupe agent.</param> public ActionDiagnosticListener(LoupeAgent agent) { _requestMetricFactory = new RequestMetricFactory(); _options = agent.Configuration.AspNet ?? new AspNetConfiguration(); }