コード例 #1
0
        public string Health()
        {
            if (_health != null)
            {
                var health = _health.Health();
                health.Details.TryGetValue("propertySources", out object sourcelist);

                var nameList = ToCSV(sourcelist as IList <string>);
                return(health.Status.ToString() + "," + nameList);
            }
            else
            {
                return(string.Empty);
            }
        }
コード例 #2
0
        public override Task <HealthCheckResponse> Check(HealthCheckRequest request, ServerCallContext context)
        {
            var health = _health.Health();

            if (_health.Id == request.Service)
            {
                return(Task.FromResult(new HealthCheckResponse
                {
                    Status = Map(health.Status)
                }));
            }
            else if (health.Details.TryGetValue(request.Service, out var status))
            {
                return(Task.FromResult(new HealthCheckResponse
                {
                    Status = Map(status)
                }));
            }

            return(Task.FromResult(new HealthCheckResponse
            {
                Status = HealthCheckResponse.Types.ServingStatus.Unknown
            }));
        }