mirror of
https://github.com/yusing/godoxy.git
synced 2026-04-23 09:18:51 +02:00
uptime metrics
This commit is contained in:
@@ -7,8 +7,10 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/yusing/go-proxy/internal/common"
|
||||
E "github.com/yusing/go-proxy/internal/error"
|
||||
"github.com/yusing/go-proxy/internal/logging"
|
||||
"github.com/yusing/go-proxy/internal/metrics"
|
||||
"github.com/yusing/go-proxy/internal/net/types"
|
||||
"github.com/yusing/go-proxy/internal/notif"
|
||||
"github.com/yusing/go-proxy/internal/task"
|
||||
@@ -172,6 +174,16 @@ func (mon *monitor) checkUpdateHealth() error {
|
||||
logger.Debug().Msg(detail)
|
||||
notif.Notify(mon.service, "server is down")
|
||||
}
|
||||
if common.PrometheusEnabled {
|
||||
go func() {
|
||||
m := metrics.GetRouteMetrics()
|
||||
var up float64
|
||||
if healthy {
|
||||
up = 1
|
||||
}
|
||||
m.HealthStatus.With(metrics.HealthMetricLabels(mon.service)).Set(up)
|
||||
}()
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user