Exemplo n.º 1
0
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
			}
		}
	}
}
Exemplo n.º 2
0
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 {}
}