public static IHealthBuilder AddHttpGetCheck(
            this IHealthCheckBuilder healthCheckBuilder,
            string name,
            Uri uri,
            int retries,
            TimeSpan delayBetweenRetries,
            TimeSpan timeoutPerRequest,
            HealthCheck.QuiteTime quiteTime,
            bool degradedOnError = false)
        {
            EnsureValidRetries(retries);
            EnsureValidDelayBetweenRequests(delayBetweenRetries);
            EnsureValidTimeoutPerRequest(timeoutPerRequest);

            healthCheckBuilder.AddQuiteTimeCheck(
                name,
                async cancellationToken => await ExecuteHealthCheckWithRetriesAsync(
                    uri,
                    retries,
                    delayBetweenRetries,
                    timeoutPerRequest,
                    degradedOnError,
                    cancellationToken),
                quiteTime);

            return(healthCheckBuilder.Builder);
        }
Esempio n. 2
0
        public static IHealthBuilder AddQuiteTimeCheck(
            this IHealthCheckBuilder builder,
            string name,
            Func <CancellationToken, ValueTask <HealthCheckResult> > check,
            HealthCheck.QuiteTime quiteTime)
        {
            builder.AddCheck(new HealthCheck(name, check, quiteTime));

            return(builder.Builder);
        }
Esempio n. 3
0
        public static IHealthBuilder AddPingCheck(
            this IHealthCheckBuilder healthCheckBuilder,
            string name,
            string host,
            TimeSpan timeout,
            HealthCheck.QuiteTime quiteTime,
            bool degradedOnError = false)
        {
            healthCheckBuilder.AddQuiteTimeCheck(
                name,
                async() => await ExecutePingCheckAsync(host, timeout, degradedOnError),
                quiteTime);

            return(healthCheckBuilder.Builder);
        }
        public static IHealthBuilder AddHttpGetCheck(
            this IHealthCheckBuilder healthCheckBuilder,
            string name,
            Uri uri,
            TimeSpan timeout,
            HealthCheck.QuiteTime quiteTime,
            bool degradedOnError = false)
        {
            EnsureValidTimeout(timeout);

            healthCheckBuilder.AddQuiteTimeCheck(
                name,
                async cancellationToken => await ExecuteHttpCheckNoRetriesAsync(uri, timeout, degradedOnError, cancellationToken),
                quiteTime);

            return(healthCheckBuilder.Builder);
        }
Esempio n. 5
0
        public static IHealthBuilder AddHttpPostCheck(
            this IHealthCheckBuilder healthCheckBuilder,
            string name,
            Uri uri,
            HttpContent content,
            TimeSpan timeout,
            HealthCheck.QuiteTime quiteTime,
            bool degradedOnError = false,
            Dictionary <string, string> requestHeaders = null)
        {
            EnsureValidTimeout(timeout);

            healthCheckBuilder.AddQuiteTimeCheck(
                name,
                async cancellationToken =>
                await ExecuteHttpCheckNoRetriesAsync(uri, content, timeout, degradedOnError, cancellationToken,
                                                     requestHeaders),
                quiteTime);

            return(healthCheckBuilder.Builder);
        }