Skip to content
This repository has been archived by the owner on Dec 23, 2023. It is now read-only.

Add Span.Kind to the trace API. #1223

Merged
merged 3 commits into from
Jun 1, 2018

Conversation

bogdandrutu
Copy link
Contributor

Partially fix #1054

@codecov-io
Copy link

codecov-io commented May 31, 2018

Codecov Report

Merging #1223 into master will increase coverage by 0.04%.
The diff coverage is 100%.

Impacted file tree graph

@@             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
Impacted Files Coverage Δ Complexity Δ
api/src/main/java/io/opencensus/trace/Span.java 82.5% <100%> (+1.41%) 12 <0> (ø) ⬇️
...main/java/io/opencensus/trace/export/SpanData.java 95.23% <100%> (+0.11%) 7 <1> (+1) ⬆️
...src/main/java/io/opencensus/trace/SpanBuilder.java 100% <100%> (+6.25%) 4 <0> (ø) ⬇️
...in/java/io/opencensus/implcore/trace/SpanImpl.java 92.61% <100%> (+0.07%) 55 <1> (+1) ⬆️
.../io/opencensus/implcore/trace/SpanBuilderImpl.java 96.15% <100%> (+0.1%) 27 <1> (+1) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8adb02c...87bf1d5. Read the comment docs.

Copy link
Contributor

@songy23 songy23 left a 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}.
Copy link
Contributor

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.

Copy link
Contributor Author

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,
Copy link
Contributor

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)?

Copy link
Contributor Author

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.

Copy link
Contributor

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;
Copy link
Contributor

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() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Nullable?

Copy link
Contributor Author

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,
Copy link
Contributor

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

Copy link
Contributor Author

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

@bogdandrutu
Copy link
Contributor Author

PTAL.

Copy link
Contributor

@songy23 songy23 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@bogdandrutu bogdandrutu merged commit 55c1277 into census-instrumentation:master Jun 1, 2018
@bogdandrutu bogdandrutu deleted the spankind branch June 1, 2018 01:56
* Indicates that the span covers server-side handling of an RPC or other remote network
* request.
*/
SERVER,
Copy link
Contributor

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,
Copy link
Contributor

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.
Copy link
Contributor

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.

Copy link
Contributor Author

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.

Copy link
Contributor

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);
Copy link
Contributor

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?

@codefromthecrypt
Copy link
Contributor

codefromthecrypt commented Jun 3, 2018 via email

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SpanKind support in opencensus-java
6 participants