opentracing-contrib/go-stdlib

Understanding doubly nested spans for nethttp client traces

kujenga opened this issue · 2 comments

I was experimenting with using the client nethttp package, and I've been seeing what seems to be double nested spans for each client call. This seems to add noise to the traces when they are rendered, making them a bit harder to read, and diverges from the way some other instrumentation libraries I've experiments with do (I am using Jaeger for capturing and rendering the events currently).

Looking at the code, it seems that this might be because there is a root and an sp span, where the root nests the sp. Is this wrapping intentional, or is there a way to turn it off? Or perhaps, is there some benefit it provides that I'm missing?

it was a design decision in this library, which can be argued about (or made configurable). Specifically, this unit test shows how there can be two lower-level spans under a single client span due to a redirect returned from the server.

Thanks for the prompt reply! The redirect case is an interesting and neat one, with that in mind I can see the reasoning behind the decision. I may take a stab at a PR for making it configurable, thanks for that suggestion.

I mostly wanted to confirm that I had properly implemented things on my end. Thanks!

I suppose I'll close this issue out 👍