Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 3
0
 public static HealthCheckBuilder AddUrlCheck(this HealthCheckBuilder builder, string url, TimeSpan cacheDuration)
 => AddUrlCheck(builder, url, response => UrlChecker.DefaultUrlCheck(response), cacheDuration);
Ejemplo n.º 4
0
        // URL checks

        public static HealthCheckBuilder AddUrlCheck(this HealthCheckBuilder builder, string url)
        => AddUrlCheck(builder, url, response => UrlChecker.DefaultUrlCheck(response));
Ejemplo n.º 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));