コード例 #1
0
        public async Task <HealthCheckResult> CheckHealthAsync(HealthCheckContext context, CancellationToken cancellationToken = default)
        {
            var results = await _service.PingAllEndpoints();

            return(results.All(r => r.IsSuccessful)
                ? new HealthCheckResult(HealthStatus.Healthy)
                : new HealthCheckResult(context.Registration.FailureStatus, GetDescription(results)));
        }
コード例 #2
0
        public async Task Run()
        {
            Console.ForegroundColor = Constants.PrimaryColor;
            Console.WriteLine("Pinging all endpoints...");
            ConsoleHelper.ResetColor();

            var result = await _service.PingAllEndpoints();

            Console.ForegroundColor = Constants.PrimaryColor;
            Console.WriteLine(JsonConvert.SerializeObject(result, Formatting.Indented));
            ConsoleHelper.ResetColor();
        }