mirror of
https://github.com/yusing/godoxy.git
synced 2026-04-19 15:31:37 +02:00
feat(health): add health check detail to health api
This commit is contained in:
@@ -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, '/')
|
||||
|
||||
@@ -19,6 +19,7 @@ type (
|
||||
Status() Status
|
||||
Uptime() time.Duration
|
||||
Latency() time.Duration
|
||||
Detail() string
|
||||
}
|
||||
HealthMonitor interface {
|
||||
task.TaskStarter
|
||||
|
||||
Reference in New Issue
Block a user