func outer() int { ctx := context.Background() defer trace.Trace(&ctx)(nil) time.Sleep(1 * time.Second) return inner1(ctx) + inner2(ctx) }
func ExampleSpanManager_Trace() { myfunc := func(ctx context.Context) (err error) { defer trace.Trace(&ctx)(&err) // do things return nil } myfunc(context.Background()) }
func RandomSQLCall(ctx context.Context) { defer trace.Trace(&ctx)(nil) time.Sleep(time.Duration(rand.Int()%10000) * time.Microsecond) }
func inner2(ctx context.Context) int { defer trace.Trace(&ctx)(nil) time.Sleep(1 * time.Second) return 1 }