fix prometheus metrics gone after route changes

This commit is contained in:
yusing
2024-12-18 00:54:04 +08:00
parent 4ae3d5344c
commit 34858a1ba0
5 changed files with 24 additions and 8 deletions

View File

@@ -7,7 +7,6 @@ import (
"strings"
"time"
"github.com/prometheus/client_golang/prometheus"
"github.com/yusing/go-proxy/internal/common"
E "github.com/yusing/go-proxy/internal/error"
"github.com/yusing/go-proxy/internal/logging"
@@ -82,7 +81,7 @@ func (mon *monitor) Start(routeSubtask *task.Task) E.Error {
}
mon.task.Finish(nil)
if mon.metric != nil {
prometheus.Unregister(mon.metric)
mon.metric.Reset()
}
}()