api: add /v1/health/ws for health bubbles on dashboard

This commit is contained in:
yusing
2025-01-19 04:34:20 +08:00
parent fe7740f1b0
commit 1adba05065
13 changed files with 89 additions and 23 deletions

View File

@@ -142,6 +142,14 @@ func (mon *monitor) Uptime() time.Duration {
return time.Since(mon.startTime)
}
// Latency implements HealthMonitor.
func (mon *monitor) Latency() time.Duration {
if mon.lastResult == nil {
return 0
}
return mon.lastResult.Latency
}
// Name implements HealthMonitor.
func (mon *monitor) Name() string {
parts := strutils.SplitRune(mon.service, '/')