/// <summary> /// Constructs and instance of <see cref="LoupeMiddleware"/>. /// </summary> /// <param name="next"></param> /// <param name="agent"></param> /// <param name="applicationLifetime"></param> /// <exception cref="ArgumentNullException"></exception> public LoupeMiddleware(RequestDelegate next, LoupeAgent agent, IApplicationLifetime applicationLifetime) { _next = next ?? throw new ArgumentNullException(nameof(next)); _agent = agent ?? throw new ArgumentNullException(nameof(agent)); if (applicationLifetime == null) { throw new ArgumentNullException(nameof(applicationLifetime)); } applicationLifetime.ApplicationStarted.Register(StartSession); applicationLifetime.ApplicationStopped.Register(OnApplicationStopping); var requestMetricDefinition = DefineRequestMetric(agent.ApplicationName); _requestMetric = EventMetric.Register(requestMetricDefinition, null); }
/// <summary> /// Initializes a new instance of the <see cref="ActionDiagnosticListener"/> class. /// </summary> /// <param name="agent">The Loupe agent.</param> public ActionDiagnosticListener(LoupeAgent agent) { _actionMetricFactory = new ActionMetricFactory(); }
/// <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(); }
/// <summary> /// Initializes a new instance of the <see cref="EntityFrameworkCoreDiagnosticListener"/> class. /// </summary> /// <param name="agent">The Loupe agent.</param> /// <param name="configuration">Optional. The framework for the listener</param> public EntityFrameworkCoreDiagnosticListener(LoupeAgent agent, EntityFrameworkConfiguration configuration = null) { _configuration = configuration ?? new EntityFrameworkConfiguration(); }
/// <summary> /// Initializes a new instance of the <see cref="EntityFrameworkCoreDiagnosticListener"/> class. /// </summary> /// <param name="agent">The Loupe agent.</param> /// <param name="configuration">Optional. The framework for the listener</param> public EntityFrameworkCoreDiagnosticListener(LoupeAgent agent, EntityFrameworkConfiguration configuration = null) { _configuration = configuration ?? new EntityFrameworkConfiguration(); LogCallStack = _configuration.LogCallStack; LogExceptions = _configuration.LogExceptions; }