示例#1
0
文件: main.go 项目: jmptrader/goinfo
func main() {
	countDS := &CountsDataSource{}

	goinfo.AddSource(countDS)
	err := goinfo.Start("example")
	if err != nil {
		panic("Oh no! could not mount our monitoring file system: " + err.Error())
	}
	defer goinfo.StopAll()

	//Start app business logic
	for {
		select {
		case <-time.After(500 * time.Millisecond):
			ts := uint64(time.Now().Unix())
			if ts%3 == 0 {
				countDS.arbitraryCountA += 1
				countDS.timestampA = ts
			} else {
				countDS.arbitraryCountB += 1
				countDS.timestampB = ts
			}
		}
	}
}
示例#2
0
文件: main.go 项目: jmptrader/goinfo
func main() {
	err := goinfo.Start("/opt/go/example")
	if err != nil {
		panic("Oh no! could not mount our monitoring file system: " + err.Error())
	}
	defer goinfo.StopAll()

	//Start app business logic
	select {}
}