feat 模块删除bind函数

This commit is contained in:
2026-02-06 22:51:47 +08:00
parent 44ebbe4449
commit 5a0f4b71d4
6 changed files with 22 additions and 83 deletions

View File

@@ -14,9 +14,9 @@ import (
// Prometheus 普罗米修斯模块
type Prometheus struct {
DefaultModule
MetricCfg *config.MetricConfig
wg *sync.WaitGroup
server *http.Server
metricCfg *config.MetricConfig
}
func (m *Prometheus) Init() error {
@@ -29,7 +29,7 @@ func (m *Prometheus) Start(ready *sync.WaitGroup) error {
go func() {
defer m.wg.Done()
m.server = &http.Server{
Addr: fmt.Sprintf("%v:%v", m.metricCfg.Prometheus.Address, m.metricCfg.Prometheus.Port),
Addr: fmt.Sprintf("%v:%v", m.MetricCfg.Prometheus.Address, m.MetricCfg.Prometheus.Port),
Handler: promhttp.Handler(),
}
ready.Done()
@@ -48,13 +48,3 @@ func (m *Prometheus) Stop() error {
m.wg.Wait()
return nil
}
func (m *Prometheus) Bind(data ...any) Module {
if data == nil || len(data) == 0 {
return m
}
if mc, ok := data[0].(*config.MetricConfig); ok {
m.metricCfg = mc
}
return m
}