Skip to content

OpenTracing breaking API change: SpanContext#311

Merged
basvanbeek merged 3 commits intogo-kit:masterfrom
basvanbeek:master
Jul 7, 2016
Merged

OpenTracing breaking API change: SpanContext#311
basvanbeek merged 3 commits intogo-kit:masterfrom
basvanbeek:master

Conversation

@basvanbeek
Copy link
Copy Markdown
Member

@basvanbeek basvanbeek commented Jul 6, 2016

OpenTracing changed its API and deprecated the Inject method in favor of the new Extract method.

@bensigelman: can you comment if this conforms to an idiomatic OpenTracing solution

@basvanbeek basvanbeek changed the title OpenTracing breaking API change: SpanContext [WIP]: OpenTracing breaking API change: SpanContext Jul 6, 2016
Comment thread tracing/opentracing/grpc.go Outdated
if wireContext != nil {
span = tracer.StartSpan(operationName, ext.RPCServerOption(wireContext))
} else {
span = tracer.StartSpan(operationName)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess (?) we could include the rpc server tag here even if there's no client SpanContext to reference...

@bhs
Copy link
Copy Markdown

bhs commented Jul 6, 2016

LGTM, thanks!

@basvanbeek
Copy link
Copy Markdown
Member Author

@bensigelman it looked very consumer unfriendly to add this:

opentracing.Tags{string(ext.SpanKind): ext.SpanKindRPCServer}

if we update the Apply function of RPCServerOption to this:

func (r rpcServerOption) Apply(o *opentracing.StartSpanOptions) {
    if r.clientContext != nil {
        opentracing.ChildOf(r.clientContext).Apply(o)
    }
    (opentracing.Tags{string(SpanKind): SpanKindRPCServer}).Apply(o)
}

we can change from this in Go kit and other consumers:

if wireContext != nil {
    span = tracer.StartSpan(operationName, ext.RPCServerOption(wireContext))
} else {
    span = tracer.StartSpan(operationName, opentracing.Tags{string(ext.SpanKind): ext.SpanKindRPCServer})
}

to simply this:

span = tracer.StartSpan(operationName, ext.RPCServerOption(wireContext))

I think it is a very common scenario for servers especially at the edge (API gateways and such) to start the trace with a RPC Server span without an upstream Client as the client often is not instrumented.

@bhs
Copy link
Copy Markdown

bhs commented Jul 6, 2016

@basvanbeek I think that makes sense, yeah. Let's do it.

@peterbourgon
Copy link
Copy Markdown
Member

We are still waiting for changes to be merged in openzipkin/zipkin-go-opentracing, is that right?

@basvanbeek
Copy link
Copy Markdown
Member Author

correct... that will be ready today

@basvanbeek basvanbeek changed the title [WIP]: OpenTracing breaking API change: SpanContext OpenTracing breaking API change: SpanContext Jul 7, 2016
@basvanbeek basvanbeek closed this Jul 7, 2016
@basvanbeek basvanbeek reopened this Jul 7, 2016
@peterbourgon
Copy link
Copy Markdown
Member

LGTM! You can merge, right?

@basvanbeek basvanbeek merged commit 4c2dfa9 into go-kit:master Jul 7, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants