feat(health): add health check detail to health api

This commit is contained in:
yusing
2025-05-05 13:27:00 +08:00
parent 2cec88d3ce
commit c55c6c84bc
5 changed files with 33 additions and 0 deletions

View File

@@ -168,6 +168,15 @@ func (mon *monitor) Latency() time.Duration {
return res.Latency
}
// Detail implements HealthMonitor.
func (mon *monitor) Detail() string {
res := mon.lastResult.Load()
if res == nil {
return ""
}
return res.Detail
}
// Name implements HealthMonitor.
func (mon *monitor) Name() string {
parts := strutils.SplitRune(mon.service, '/')

View File

@@ -19,6 +19,7 @@ type (
Status() Status
Uptime() time.Duration
Latency() time.Duration
Detail() string
}
HealthMonitor interface {
task.TaskStarter