java-web-servlet-filter icon indicating copy to clipboard operation
java-web-servlet-filter copied to clipboard

Check for null extracted context before creating a child span

Open kcirone opened this issue 6 years ago • 0 comments

There are some implementations (I've observed) of OpenTracing that do not accept null arguments to SpanBuilder.asChildOf(). If tracer.extract() returns null (ie. no span context was passed to the servlet) and it is used to create a child span, .asChildOf() will cause a NullPointerException.

The equivalent operation would be to avoid calling .asChildOf() if extractedContext is null, which should work for any implementation.

kcirone avatar Oct 26 '19 14:10 kcirone

Hi @bpholt

Sorry for the radio silence - obviously this year has been a bit unusual, but prompted by https://github.com/opentracing-contrib/java-xray-tracer/issues/10 I'm aiming to clean a few things up with this repo.

Yes if you have experience of deploying to Maven Central that would be very much appreciated. I had some contact before with the opentracing-java maintainers which I'll attempt to resurrect, they should have the necessary keys to deploy under the right Maven coordinates (or be able to give us our own keys to do so).

I don't have an objection to you publishing under different Maven co-ordinates but keeping the package names the same: changing imports everywhere would just be a nuisance, and given the license, I'm not sure there's much I could do to stop you anyway - but thanks for asking :)

ashleymercer avatar Nov 09 '20 13:11 ashleymercer