Skip to content

Commit

Permalink
update example fib
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkgos committed Jan 21, 2022
1 parent 215a9b5 commit 443f780
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions example/fib/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,16 @@ func NewApp(r io.Reader, l *log.Logger) *App {
// Run starts polling users for Fibonacci number requests and writes results.
func (a *App) Run(ctx context.Context) error {
for {
var span trace.Span
ctx, span = otel.Tracer(name).Start(ctx, "Run")
// Each execution of the run loop, we should get a new "root" span and context.
newCtx, span := otel.Tracer(name).Start(ctx, "Run")

n, err := a.Poll(ctx)
n, err := a.Poll(newCtx)
if err != nil {
span.End()
return err
}

a.Write(ctx, n)
a.Write(newCtx, n)
span.End()
}
}
Expand Down

0 comments on commit 443f780

Please sign in to comment.