opencensus-python icon indicating copy to clipboard operation
opencensus-python copied to clipboard

Make root span trace IDs unique

Open c24t opened this issue 6 years ago • 4 comments

This PR fixes a longstanding bug: that all spans generated by a given ContextTracer share the same trace ID regardless of the context. This meant sequential root spans were reported as siblings in the same trace instead of each belonging to its own trace.

Fixes #182 and #366. See https://github.com/census-instrumentation/opencensus-python/issues/182#issuecomment-461647639 for more detail.

cc @tab1293, @sduskis.

c24t avatar Feb 15 '19 21:02 c24t

@c24t, what's the story with this PR?

sduskis avatar Mar 06 '19 18:03 sduskis

I'll mention here too that this PR does not fix #182 for me while my proposed change #539 does.

nikhaldi avatar Mar 06 '19 20:03 nikhaldi

what's the story with this PR?

I hadn't merged it because it was breaking a system test that was asserting the wrong behavior. Still TODO.

this PR does not fix #182 for me while my proposed change #539 does

This PR deals with siblings spans having the same trace ID when the parent trace ID is null, #539 changes the grpc client interceptor so that it uses the current tracer to set trace IDs instead of the tracer that was current at the time the interceptor was created. Both problems affect the google-cloud-python integration, and both cause clashing traceIDs, but each has a different root cause.

@nikhaldi does that match your understanding?

c24t avatar Mar 06 '19 23:03 c24t

I see what you mean, thanks. I don't have enough background about how people use the API to judge if the case of a null parent trace id is valid. My reading of the code tracking down my issues was that the API requires a new tracer to be created for every individual trace. But if that's not case this PR seems reasonable.

nikhaldi avatar Mar 07 '19 00:03 nikhaldi