opentracing / opentracing-javascript

OpenTracing API for Javascript (both Node and browser). 🛑 This library is DEPRECATED! https://github.com/opentracing/specification/issues/163
http://opentracing.io
Apache License 2.0
1.09k stars 108 forks source link

Handle non-extending Span classes in Reference constructor #162

Closed treble-snake closed 3 years ago

treble-snake commented 3 years ago

The interface allows passing both Span and SpanContext as an argument for creating References. But the instanceof check won't always work in runtime, for example, for cases when Span implementation does not extend the opentracing.Span class, but just implements the interface. The popular jaeger-client-node library does exactly that.

This produces hard-to-track errors.

I added additional checks to distinguish between Span and SpanContext instances.

Resolves: #161

yurishkuro commented 3 years ago

Thanks

treble-snake commented 3 years ago

It's been a pleasure :)

yurishkuro commented 2 years ago

@treble-snake it's possible this change introduced a bug, see https://github.com/opentracing/opentracing-javascript/issues/172