24 lines
715 B
Go
24 lines
715 B
Go
package monitor
|
|
|
|
import (
|
|
"eino-project/internal/conf"
|
|
|
|
"github.com/go-kratos/kratos/v2/log"
|
|
"github.com/google/wire"
|
|
)
|
|
|
|
// ProviderSet is monitor providers.
|
|
var ProviderSet = wire.NewSet(NewMonitorFromBootstrapConfig)
|
|
|
|
// NewMonitorFromBootstrapConfig 从 Bootstrap 配置创建监控服务
|
|
func NewMonitorFromBootstrapConfig(c *conf.Bootstrap, logger log.Logger) Monitor {
|
|
base := NewMonitor(logger)
|
|
// 根据配置启用 Coze Loop 提供器
|
|
if c != nil && c.GetMonitoring() != nil && c.GetMonitoring().GetCozeLoop() != nil {
|
|
cl := c.GetMonitoring().GetCozeLoop()
|
|
if cl.GetEnable() {
|
|
return NewCozeLoopMonitor(base, cl, logger)
|
|
}
|
|
}
|
|
return base
|
|
} |