Closed neelance closed 1 year ago
Please add unit tests
@yurishkuro Test added.
Looks good.
@neelance no real objection to this PR – it's nice and concise.
That said, basictracer
is intended to be an implementation detail for OpenTracing callers and, as such, this is going to be hard to use in practice without breaking abstraction boundaries.
I would be excited about something like a TeeTracer
that implements the opentracing.Tracer
interface and has both a "primary" Tracer
to use for Inject/Extract
as well as a "secondary" Tracer
to multiplex all Span
method calls to. If you have interest in taking that on, I suspect it would be more flexible.
@bensigelman Yes, I am aware that this only works if all your tracers are based on basictracer
. I was first thinking about a TeeTracer
, but that's much more complicated than this MultiRecorder
solution. This works for my use case and I am busy enough with my open source projects, so sorry, I simply don't have the spare time to work on a TeeTracer
.
library is deprecated
This new function is similar to
io.MultiWriter
and is useful for writing to multiple opentracing backends at the same time.