Пример #1
0
// for debugging, show goroutine trace on receipt of USR1. uninstall by calling
// Stop on the returned object
func InstallStackTracer() stopper.Stopper {
	signals := make(chan os.Signal, 1)
	signal.Notify(signals, traceSignal)
	stopper := stopper.NewChanStopper()
	go func() {
		defer func() {
			signal.Stop(signals)
			close(signals)
		}()
		for {
			select {
			case <-signals:
				log.Print(instrumentation.GetStackTrace(true))
			case <-stopper.Chan:
				return
			}
		}
	}()
	return stopper
}
Пример #2
0
func TestGetStackTrace(t *testing.T) {
	instrumentation.GetStackTrace(false)
	instrumentation.GetStackTrace(true)
}
Пример #3
0
func GetStackTrace(all bool) string {
	return instrumentation.GetStackTrace(all)
}