in go/engine/engine.go [41:80]
func PrepareTelemetry(utilName string, ctconfig *config.CTConfig) {
metricsConf := metrics.DefaultConfig(utilName)
metricsConf.EnableHostname = false
metricsConf.EnableHostnameLabel = false
metricsConf.EnableRuntimeMetrics = false
metricsConf.EnableServiceLabel = false
if len(*ctconfig.StatsDHost) > 0 {
metricsSink, err := metrics.NewStatsdSink(fmt.Sprintf("%s:%d", *ctconfig.StatsDHost, *ctconfig.StatsDPort))
if err != nil {
glog.Fatal(err)
}
_, err = metrics.NewGlobal(metricsConf, metricsSink)
if err != nil {
glog.Fatal(err)
}
glog.Infof("%s is starting. Statistics are being reported to the StatsD server at %s:%d",
utilName, *ctconfig.StatsDHost, *ctconfig.StatsDPort)
return
}
infoDumpPeriod, err := time.ParseDuration(*ctconfig.StatsRefreshPeriod)
if err != nil {
glog.Fatalf("Could not parse StatsRefreshPeriod: %v", err)
}
glog.Infof("%s is starting. Local statistics will emit every: %s",
utilName, infoDumpPeriod)
metricsSink := metrics.NewInmemSink(infoDumpPeriod, 5*infoDumpPeriod)
telemetry.NewMetricsDumper(metricsSink, infoDumpPeriod)
_, err = metrics.NewGlobal(metricsConf, metricsSink)
if err != nil {
glog.Fatal(err)
}
}