This repository has been archived by the owner on May 23, 2023. It is now read-only.
Add setTag/withTag overloads that accept io.opentracing.tag
types
#271
Labels
To use the fluent syntax with Span/SpanBuilder and the tag types, one currently has to write
span.setTag(Tags.HTTP_STATUS.getKey(), 200)
. This has two issues:span.setTag(Tags.HTTP_STATUS.getKey(), "foo")
.getKey()
is an unnecessary inconvenience.Proposed solution
Add overloads on
Span
andSpanBuilder
that accept Tag types so that people can writespan.setTag(Tags.HTTP_STATUS, 200)
.We've been discussing this in opentracing/opentracing-csharp#72 and compared a few options - I'll copy my latest comment for your convenience:
Java might have different performance characteristics of course!
Adding overloads should be non-breaking for instrumentation code but it obviously is a breaking change for tracers.
Note that we could add this in a non-breaking way in C# by making them "extension methods" (see comment) but this gives tracers less flexibility and it would make the
NoopTracer
a little less efficient (because the extension method will still be executed and the no-op will happen later). Not sure if there's something similar in Java?The text was updated successfully, but these errors were encountered: