fix docker health checker metrics missing from prometheus

This commit is contained in:
yusing
2024-12-19 14:01:55 +08:00
parent 84675b5c0f
commit 751594860a
3 changed files with 4 additions and 3 deletions

View File

@@ -97,7 +97,7 @@ func (r *HTTPRoute) Start(providerSubtask *task.Task) E.Error {
client, err := docker.ConnectClient(r.Idlewatcher.DockerHost)
if err == nil {
fallback := monitor.NewHTTPHealthChecker(r.rp.TargetURL, r.Raw.HealthCheck)
r.HealthMon = monitor.NewDockerHealthMonitor(client, r.Idlewatcher.ContainerID, r.Raw.HealthCheck, fallback)
r.HealthMon = monitor.NewDockerHealthMonitor(client, r.Idlewatcher.ContainerID, r.TargetName(), r.Raw.HealthCheck, fallback)
r.task.OnCancel("close docker client", client.Close)
}
}

View File

@@ -72,7 +72,7 @@ func (r *StreamRoute) Start(providerSubtask *task.Task) E.Error {
client, err := docker.ConnectClient(r.Idlewatcher.DockerHost)
if err == nil {
fallback := monitor.NewRawHealthChecker(r.TargetURL(), r.Raw.HealthCheck)
r.HealthMon = monitor.NewDockerHealthMonitor(client, r.Idlewatcher.ContainerID, r.Raw.HealthCheck, fallback)
r.HealthMon = monitor.NewDockerHealthMonitor(client, r.Idlewatcher.ContainerID, r.TargetName(), r.Raw.HealthCheck, fallback)
r.task.OnCancel("close docker client", client.Close)
}
}