Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix getting-started.md Run function #2527

Merged
merged 3 commits into from
Jan 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
8 changes: 4 additions & 4 deletions website_docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -184,16 +184,16 @@ Start by instrumenting the `Run` method.
// 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")
thinkgos marked this conversation as resolved.
Show resolved Hide resolved

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