public HealthRoot( IHealth health, HealthOptions options, HealthFormatterCollection metricsOutputFormatters, IHealthOutputFormatter defaultMetricsOutputFormatter, IRunHealthChecks healthCheckRunner) { Options = options ?? throw new ArgumentNullException(nameof(options)); _health = health ?? throw new ArgumentNullException(nameof(health)); OutputHealthFormatters = metricsOutputFormatters ?? new HealthFormatterCollection(); DefaultOutputHealthFormatter = defaultMetricsOutputFormatter; HealthCheckRunner = healthCheckRunner; }
// ReSharper disable UnusedParameter.Local public HealthCheckEndpointMiddleware( RequestDelegate next, ILoggerFactory loggerFactory, IRunHealthChecks healthCheckRunner, IHealthResponseWriter healthResponseWriter, TimeSpan timeout) // ReSharper restore UnusedParameter.Local { _healthCheckRunner = healthCheckRunner; _logger = loggerFactory.CreateLogger <HealthCheckEndpointMiddleware>(); _healthResponseWriter = healthResponseWriter ?? throw new ArgumentNullException(nameof(healthResponseWriter)); _timeout = timeout <= TimeSpan.Zero ? TimeSpan.FromSeconds(20) : timeout; }