Skip to content

Commit

Permalink
fix NewChildSpanFromContext
Browse files Browse the repository at this point in the history
when called on a specific tracer, it should create the span from this tracer, not from the default one
  • Loading branch information
vbehar committed Jun 23, 2017
1 parent 01676c0 commit 668e032
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion tracer/tracer.go
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ func (t *Tracer) NewChildSpanFromContext(name string, ctx context.Context) *Span
// child span. If the context contains no span, an empty root span will be returned.
// If nil is passed in for the context, a context will be created.
func (t *Tracer) NewChildSpanWithContext(name string, ctx context.Context) (*Span, context.Context) {
span := NewChildSpanFromContext(name, ctx)
span := t.NewChildSpanFromContext(name, ctx)
return span, span.Context(ctx)
}

Expand Down
1 change: 1 addition & 0 deletions tracer/tracer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ func TestNewChildSpanWithContext(t *testing.T) {
assert.Equal("abc", span.Name)
assert.Equal("", span.Service)
assert.Equal(span.ParentID, span.SpanID) // it should be a root span
assert.Equal(span.Tracer(), tracer)
// the returned ctx should contain the created span
assert.NotNil(ctx)
ctxSpan, ok := SpanFromContext(ctx)
Expand Down

0 comments on commit 668e032

Please sign in to comment.