예제 #1
0
        public static HealthCheckBuilder AddUrlCheck(this HealthCheckBuilder builder, string url,
                                                     Func <HttpResponseMessage, ValueTask <IHealthCheckResult> > checkFunc)
        {
            Guard.ArgumentNotNull(nameof(builder), builder);
            Guard.ArgumentNotNullOrEmpty(nameof(url), url);
            Guard.ArgumentNotNull(nameof(checkFunc), checkFunc);

            var urlCheck = new UrlChecker(checkFunc, url);

            builder.AddCheck($"UrlCheck({url})", () => urlCheck.CheckAsync());
            return(builder);
        }
예제 #2
0
        public static HealthCheckBuilder AddUrlChecks(this HealthCheckBuilder builder, IEnumerable <string> urlItems, string groupName,
                                                      CheckStatus partialSuccessStatus, Func <HttpResponseMessage, ValueTask <IHealthCheckResult> > checkFunc)
        {
            var urls = urlItems?.ToArray();

            Guard.ArgumentNotNull(nameof(builder), builder);
            Guard.ArgumentNotNullOrEmpty(nameof(urlItems), urls);
            Guard.ArgumentNotNullOrWhitespace(nameof(groupName), groupName);

            var urlChecker = new UrlChecker(checkFunc, urls)
            {
                PartiallyHealthyStatus = partialSuccessStatus
            };

            builder.AddCheck($"UrlChecks({groupName})", () => urlChecker.CheckAsync());
            return(builder);
        }
예제 #3
0
파일: UrlChecks.cs 프로젝트: jcambert/eerp
 public static HealthCheckBuilder AddUrlCheck(this HealthCheckBuilder builder, string url, TimeSpan cacheDuration)
 => AddUrlCheck(builder, url, response => UrlChecker.DefaultUrlCheck(response), cacheDuration);
예제 #4
0
        // URL checks

        public static HealthCheckBuilder AddUrlCheck(this HealthCheckBuilder builder, string url)
        => AddUrlCheck(builder, url, response => UrlChecker.DefaultUrlCheck(response));
예제 #5
0
 public static HealthCheckBuilder AddUrlChecks(this HealthCheckBuilder builder, IEnumerable <string> urlItems, string groupName,
                                               CheckStatus partialSuccessStatus)
 => AddUrlChecks(builder, urlItems, groupName, partialSuccessStatus, response => UrlChecker.DefaultUrlCheck(response));