47
}
48
50
>
CheckType: healthcheck.CheckTypeGRPCHealth,
51
>
// Convert to SERVING to avoid false positives during initialization
52
>
State: suppressStartupErrors(status.Status, now.Sub(h.startupTime), h.config.HealthHistoryInitializationTime()),
53
>
Message: fmt.Sprintf("historyservice gRPC health check: %s", status.Status.String()),
54
>
})
55
>
56
>
// TODO: Remove AverageLatency check once Latency is used by default.
57
>
checks = append(checks, errorIfOverThreshold(healthcheck.CheckTypeRPCLatency,
58
>
h.historyHealthSignal.AverageLatency(), h.config.HealthRPCLatencyFailure(),
59
>
"historyservice latency", true))
60
>
61
>
for _, settings := range h.config.HealthRPCLatencyPercentiles().PercentileSettings {
62
>
checks = append(checks, errorIfOverThreshold(
63
>
healthcheck.CheckTypeRPCLatency+fmt.Sprintf("_P%0.2f", 100.0*settings.Percentile),
64
>
h.historyHealthSignal.LatencyQuantile(settings.Percentile),
65
>
float64(settings.Threshold.Milliseconds()),
66
>
fmt.Sprintf("historyservice percentile latency (P%0.2f < %d, enforced: %t)", 100.0*settings.Percentile, settings.Threshold.Milliseconds(), settings.Enforced),
67
>
settings.Enforced,
68
>
))
69
>
}
70
71
>
checks = append(checks, errorIfOverThreshold(healthcheck.CheckTypeRPCErrorRatio,
deep_health_check.go
72
>
h.historyHealthSignal.ErrorRatio(), h.config.HealthRPCErrorRatio(),
73
>
"historyservice error ratio", true))
74
>
75
>
// TODO: Remove AverageLatency check once Latency is used by default.
76
>
checks = append(checks, errorIfOverThreshold(healthcheck.CheckTypePersistenceLatency,
77
>
h.persistenceHealthSignal.AverageLatency(), h.config.HealthPersistenceLatencyFailure(),
78
>
"persistenceservice latency", true))
79
>
80
>
for _, settings := range h.config.HealthPersistenceLatencyPercentiles().PercentileSettings {
81
>
checks = append(checks, errorIfOverThreshold(
82
>
healthcheck.CheckTypePersistenceLatency+fmt.Sprintf("_P%0.2f", 100.0*settings.Percentile),
83
>
h.persistenceHealthSignal.LatencyQuantile(settings.Percentile),
84
>
float64(settings.Threshold.Milliseconds()),
85
>
fmt.Sprintf("persistenceservice percentile latency (P%0.2f < %d, enforced: %t)", 100.0*settings.Percentile, settings.Threshold.Milliseconds(), settings.Enforced),
86
>
settings.Enforced,
87
>
))
88
>
}
89
90
>
checks = append(checks, errorIfOverThreshold(healthcheck.CheckTypePersistenceErrRatio,
deep_health_check.go
91
>
h.persistenceHealthSignal.ErrorRatio(), h.config.HealthPersistenceErrorRatio(),
92
>
"persistenceservice error ratio", true))
93
>
94
>
overallState := enumsspb.HEALTH_STATE_SERVING
95
>
96
>
for _, check := range checks {
97
>
if check.State == enumsspb.HEALTH_STATE_NOT_SERVING {
98
overallState = check.State
99
break