-
Notifications
You must be signed in to change notification settings - Fork 201
Add Span.Kind to the trace API. #1223
Add Span.Kind to the trace API. #1223
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1223 +/- ##
============================================
+ Coverage 81.96% 82.01% +0.04%
- Complexity 1233 1236 +3
============================================
Files 193 193
Lines 6017 6026 +9
Branches 558 558
============================================
+ Hits 4932 4942 +10
+ Misses 937 936 -1
Partials 148 148
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add this change to CHANGELOG.md.
/** | ||
* Returns a new immutable {@code SpanData}. | ||
* | ||
* @deprecated Use the version that contains the {@code Kind}. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: you can add a Javadoc link to the new method instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
@@ -111,6 +149,7 @@ public static SpanData create( | |||
parentSpanId, | |||
hasRemoteParent, | |||
name, | |||
kind, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we checkNotNull() here (since the arg Kind kind
of this method is not marked Nullable
)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Made it @nullable. Actually null is a valid value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should SpanBuilder.setSpanKind also use @Nullable
?
|
||
@Override | ||
public SpanBuilderImpl setSpanKind(Kind kind) { | ||
this.kind = kind; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same, checkNotNull() here?
* | ||
* @return the kind of this {@code Span}. | ||
*/ | ||
public Kind getKind() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Nullable
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
* Indicates that the span covers server-side handling of an RPC or other remote network | ||
* request. | ||
*/ | ||
SERVER, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/me wants PRODUCER, CONSUMER for christmas, santa
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should continue our discussion here census-instrumentation/opencensus-specs#54
PTAL. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
* Indicates that the span covers server-side handling of an RPC or other remote network | ||
* request. | ||
*/ | ||
SERVER, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The enum constants should also have @since
tags, for when we add more.
@@ -111,6 +149,7 @@ public static SpanData create( | |||
parentSpanId, | |||
hasRemoteParent, | |||
name, | |||
kind, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should SpanBuilder.setSpanKind also use @Nullable
?
* @return this. | ||
* @since 0.5 | ||
*/ | ||
public abstract SpanBuilder setRecordEvents(boolean recordEvents); | ||
|
||
/** | ||
* Sets the {@link Span.Kind} for the newly created {@code Span}. If not called, the | ||
* implementation will provide a default. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can the default be null? It looks like this implementation doesn't set a non-null default.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, null is a valid option. we can do unspecified if really is important but I think null is fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't we specify that the default is null then? Allowing the implementation to use CLIENT or SERVER as a default doesn't seem correct.
* @return this. | ||
* @since 0.14 | ||
*/ | ||
public abstract SpanBuilder setSpanKind(Span.Kind spanKind); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this method be non-abstract, to avoid breaking existing subclasses?
agree null as default
|
Partially fix #1054