Closed carlosalberto closed 6 years ago
Hey, any opinion on this @yurishkuro @tylerbenson ? If it looks right, I will merge and this will be included in the RC1 else, we might probably roll it in the next RC ;)
Why not use a typed interface? I'm not a fan of overloaded methods (even though it is consistent with the plain set methods).
@yurishkuro
You refer to something like this?
// IntTag and the others would be inheriting this class.
public class TypedTag<T> extends AbstractTag<T> {
protected void set(Span span, T tagValue)
{
span.setTag(super.key, tagValue.toString());
}
}
Hey @yurishkuro sorry, re-read your message today and figured you simply wanted the same, but through an interface ;)
Hey @yurishkuro
I added Tag.set()
and updated AbstractTag
as well - but left the call to MockTracer.setObjectTag()
as this extra checks that no tags are added after a Span
was finished, and would love to keep it around:
// An error will be reported if this Span is already finished.
private synchronized MockSpan setObjectTag(String key, Object value) {
finishedCheck("Adding tag {%s:%s} to already finished span", key, value);
Let me know ;)
I think it should do tag.set(span, value)
instead. This way the correct typed set() method will be called by the tag itself, and those methods would call setObjectTag
@yurishkuro Updated it to looks just like that ;) If you think that's fine, I will merge soon
🚢
👍
This is done to not use an abstract class for our public API, so we take overloads of BooleanTag, IntTag and StringTag.
Addresses a small detail mentioned in #314
@yurishkuro @tylerbenson