예제 #1
0
        public async Task <IndirectProbeResponse> ProbeIndirectly(SiloAddress target, TimeSpan probeTimeout, int probeNumber)
        {
            IndirectProbeResponse result;
            var healthScore        = this.ActivationServices.GetRequiredService <LocalSiloHealthMonitor>().GetLocalHealthDegradationScore(DateTime.UtcNow);
            var probeResponseTimer = ValueStopwatch.StartNew();

            try
            {
                var probeTask = this.ProbeInternal(target, probeNumber);
                await probeTask.WithTimeout(probeTimeout, exceptionMessage : $"Requested probe timeout {probeTimeout} exceeded");

                result = new IndirectProbeResponse
                {
                    Succeeded = true,
                    IntermediaryHealthScore = healthScore,
                    ProbeResponseTime       = probeResponseTimer.Elapsed,
                };
            }
            catch (Exception exception)
            {
                result = new IndirectProbeResponse
                {
                    Succeeded = false,
                    IntermediaryHealthScore = healthScore,
                    FailureMessage          = $"Encountered exception {LogFormatter.PrintException(exception)}",
                    ProbeResponseTime       = probeResponseTimer.Elapsed,
                };
            }

            return(result);
        }
예제 #2
0
 public static ProbeResult CreateIndirect(int failedProbeCount, ProbeResultStatus status, IndirectProbeResponse indirectProbeResponse)
 => new ProbeResult(failedProbeCount, status, isDirectProbe: false, indirectProbeResponse.IntermediaryHealthScore);