-
Notifications
You must be signed in to change notification settings - Fork 231
Rename 'io.jaegertracing.Span' to 'io.jaegertracing.JaegerSpan' #434
Comments
Then it probably applies to more classes e.g. |
Doesn't Java support renaming as part of the import? Maybe I am confusing it with Scala. |
cc @vprithvi |
I don't think so |
Can we instead use some linter that will require fully qualified names for Span class usage? |
I think it would be a step in the wrong direction, to be honest. As part of #435, these classes wouldn't be public. Ideally, we'd consume and expose only OpenTracing's |
By the way: |
I just updated the description of this issue with the current state of the discussion. |
I prepared a branch with a draft based on this: @pavolloffay, @yurishkuro, @vprithvi, would this be something desirable? The renaming itself is only part of the story now, I believe. |
That might be problematic. Some users may depend on more detailed API of Jaeger span than the OpenTracing span. There are certainly users who cast to Jaeger span today in order to read trace/span ID, and sampling state, which weren't available via OT. I am all in favor of tightening the API though. |
We need something different, then. We need an interface that serves as the contract, telling which methods they can rely on. Something like:
Where we today accept/return Jaeger's Span/SpanContext, we'd start accepting/returning
Those are part of the |
I am still not sold on this renaming being a good thing. It creates redundancy in the naming that is already being addressed by the package namspacing provided by the language. Why do we need to go to C-style naming? There are going to be clear domains in the code where only one import makes sense, so all others can be prohibited via linter. For example, why is there a need to ever used unqualified io.opentracing.Span? The full name is not long, and it is namespaced. |
In most of the cases, the consumer code will only have to deal with OpenTracing's Span/SpanContext/Tracer, so, whatever names we use internally won't matter. If they do decide to use an implementation-specific class, then it's far more readable to have I thought we were past the phase where we discussed whether this was a good thing or not? |
What about backwards-compatibility where the current |
This is a good point. This change will break the compatibility with clients currently referencing I think we would break them anyway with #396, though. For instance, we'll probably remove the |
If we keep the interface name as io.jaegertracing.Span, we can potentially avoid these problems. If we only call the internal span JaegerSpan, then I have less concerns with this renaming. |
If this is a blocking concern, we can settle on In fact, on #439 @vprithvi suggested using sonarcloud for code quality analysis. Interestingly, one of the "code smells" that it reports is about this class name: To recap, looks like we have the following contributors in favor of the rename of And the following against:
I would also really appreciate feedback from other contributors as well. @black-adder? @vprithvi? |
Would sonarcloud still complain if |
I'll try that out and report back
That's a great question, actually. I would say that it's indeed desirable, as it makes it easier to pass spans around, casting to a specific type whenever necessary. For instance, our If they don't belong to the same type hierarchy, we need a converter, like there's between Thrift's Span and Jaeger's |
Are you thinking of having the reporter accept the new public interface? The reporter will need access to full span details, not just the minimal methods exposed on the interface. |
The PR actually goes one step further and makes reporters accept an OpenTracing's Span. Turns out, only senders need Jaeger-specific details and even there, it's converted into a Thrift Span. |
I commented on the PR about that - don't think that's a good direction. Which brings back to my question above. |
Agree, I'll revert that part. I'm not sure yet which signature the method should have after we define the internal API. I was originally thinking about setting it to |
The
Span
class clashes with OpenTracing'sSpan
, which is confusing when debugging and reading code like:It's also not clear what is part of the public API and what is not.
I suggest renaming the class
io.jaegertracing.Span
toio.jaegertracing.internal.JaegerSpan
. This class would still extendio.opentracing.Span
. Usage ofJaegerSpan
would be allowed only by internal components and will not be part of the public API.This means that the
Span
from the sender example above would be OpenTracing's, as well asReporter#report(Span)
.The same applies to
Tracer
andSpanContext
.The text was updated successfully, but these errors were encountered: