bilibili-backup/app/service/ops/log-agent/pkg/flowmonitor/conf.go
2019-04-22 02:59:20 +00:00

27 lines
450 B
Go

package flowmonitor
import (
"time"
"errors"
xtime "go-common/library/time"
)
type Config struct {
Interval xtime.Duration
Addr string
}
func (fm *FlowMonitor) checkConfig() (err error) {
if fm.conf == nil {
return errors.New("config for flowmonitor is nil")
}
if fm.conf.Interval == 0 {
fm.conf.Interval = xtime.Duration(time.Second * 5)
}
if fm.conf.Addr == "" {
return errors.New("addr of flowmonitor is nil")
}
return
}