FILE / ScuroNeko/mtg

_stats/init.go

Исходный файл и его история в репозитории.
FILE 691954bd16d8fc5c0c0b5be9540f3c5e2a341088
Files
mtg/_stats/init.go
T
2019-09-04 10:19:01 +03:00

29 lines
576 B
Go

package stats
import (
"github.com/juju/errors"
"github.com/9seconds/mtg/config"
)
// Init initializes stats subsystem.
func Init(conf *config.Config) error {
if conf.StatsD.Enabled {
client, err := newStatsd(conf)
if err != nil {
return errors.Annotate(err, "Cannot initialize statsd client")
}
go client.run()
}
prometheus, err := newPrometheus(conf)
if err != nil {
return errors.Annotate(err, "Cannot initialize prometheus client")
}
go prometheus.run()
go NewStats(conf).start()
go startServer(conf, prometheus.getHTTPHandler())
return nil
}