gosdk/metric/config.go

34 lines
447 B
Go

package metric
var (
serv *service
TypeCount = "count"
TypeDuration = "duration"
)
type Config struct {
Address string
Username string
Password string
Database string
Interval int
}
func NewConfg() *Config {
return &Config{
Address: "http://10.0.0.131:8086",
Interval: 10,
Database: "telegraf",
}
}
func Init(c *Config) error {
if serv != nil {
return nil
}
serv = NewService(c)
go serv.run()
return nil
}