MCPcopy
hub / github.com/sourcegraph/checkup / conclude

Method conclude

check/http/http.go:151–174  ·  view source on GitHub ↗

conclude takes the data in result from the attempts and computes remaining values needed to fill out the result. It detects degraded (high-latency) responses and makes the conclusion about the result's status.

(result types.Result)

Source from the content-addressed store, hash-verified

149// It detects degraded (high-latency) responses and makes
150// the conclusion about the result's status.
151func (c Checker) conclude(result types.Result) types.Result {
152 result.ThresholdRTT = c.ThresholdRTT
153
154 // Check errors (down)
155 for i := range result.Times {
156 if result.Times[i].Error != "" {
157 result.Down = true
158 return result
159 }
160 }
161
162 // Check round trip time (degraded)
163 if c.ThresholdRTT > 0 {
164 stats := result.ComputeStats()
165 if stats.Median > c.ThresholdRTT {
166 result.Notice = fmt.Sprintf("median round trip time exceeded threshold (%s)", c.ThresholdRTT)
167 result.Degraded = true
168 return result
169 }
170 }
171
172 result.Healthy = true
173 return result
174}
175
176// checkDown checks whether the endpoint is down based on resp and
177// the configuration of c. It returns a non-nil error if down.

Callers 1

CheckMethod · 0.95

Implementers 6

fakecheckup_test.go
Checkercheck/http/http.go
Checkercheck/dns/dns.go
Checkercheck/exec/exec.go
Checkercheck/tls/tls.go
Checkercheck/tcp/tcp.go

Calls 1

ComputeStatsMethod · 0.80

Tested by

no test coverage detected