Pass options along when creating a span with StartSpanFromContext #114

Merged
merged 3 commits into from Sep 23, 2016

Projects

None yet

3 participants

@gwik
Contributor
gwik commented Sep 22, 2016

Options were ignored when creating a span.

@yurishkuro
Contributor

Do you mind adding unit tests?

@gwik
Contributor
gwik commented Sep 22, 2016

here you go.

testtracer_test.go
@@ -21,6 +21,7 @@ func nextFakeID() int {
type testSpanContext struct {
HasParent bool
FakeID int
+ Options *StartSpanOptions
@bensigelman
bensigelman Sep 22, 2016 Contributor

I'd have a slight preference to just add tags to testSpan and test that they get passed through correctly... if you don't feel like implementing this, I can do it :)

@@ -28,6 +29,35 @@ func (n testSpanContext) ForeachBaggageItem(handler func(k, v string) bool) {}
type testSpan struct {
spanContext testSpanContext
OperationName string
+ StartTime time.Time
+ Tags map[string]interface{}
@gwik
gwik Sep 22, 2016 Contributor

struct equality won't work with a map member, so I implemented an Equal method.

@gwik
gwik Sep 22, 2016 Contributor

maybe adding an id and compare it would make more sense.

@bensigelman
bensigelman Sep 22, 2016 Contributor

LGTM, thanks.

@bensigelman
Contributor

Thanks @gwik... the test LGTM but I will give @yurishkuro a chance to provide feedback if he so desires...

@yurishkuro

please fix lint errors

testtracer_test.go:64:1: receiver name n should be consistent with previous receiver name s for testSpan
@yurishkuro yurishkuro merged commit 449a42d into opentracing:master Sep 23, 2016

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment