-
Notifications
You must be signed in to change notification settings - Fork 104
Opencensus Tracing: Start tracing client streaming callables. #637
Opencensus Tracing: Start tracing client streaming callables. #637
Conversation
This depends on googleapis#633 and is extracted from googleapis#613. This introduces TracedClientStreamCallables that will create a trace and complete it. It is inserted as one of the outermost links in the callable chain to allow all other callables to contribute their annotations. google-cloud-java that extend the chains (like cloud bigtable) will also use this class to trace their extensions.
| String clientName = fullServiceName.substring(serviceIndex + 1); | ||
|
|
||
| return SpanName.of(clientName, methodName); | ||
| } |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
c1abb7d to
b2e0b6a
Compare
|
rebased & ready for review |
Codecov Report
@@ Coverage Diff @@
## master #637 +/- ##
============================================
+ Coverage 75.54% 75.71% +0.17%
- Complexity 1025 1029 +4
============================================
Files 192 194 +2
Lines 4543 4608 +65
Branches 352 356 +4
============================================
+ Hits 3432 3489 +57
- Misses 954 961 +7
- Partials 157 158 +1
Continue to review full report at Codecov.
|
| @@ -0,0 +1,168 @@ | |||
| /* | |||
| * Copyright 2018 Google LLC | |||
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.
2019
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
| /** | ||
| * A wrapper callable that will wrap a callable chain in a trace. | ||
| * | ||
| * <p>This class is meant to be an internal implementation google-cloud-java clients only. |
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 remove google-cloud-java from the documentation (more details in the previous PR).
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
| } | ||
|
|
||
| private static class FakeStreamObserver implements ApiStreamObserver<String> { | ||
| List<String> messages = Lists.newArrayList(); |
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 make these private
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
# Conflicts: # gax-grpc/src/main/java/com/google/api/gax/grpc/GrpcCallableFactory.java
vam-google
left a comment
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 (to speedup the process, but please check/address the comments first)
|
|
||
| @Override | ||
| public void onError(Throwable t) { | ||
| if (t == null) { |
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.
So onError can be called only in case of cancelation? Why? Btw, please rename t to throwable or error or exception.
Why is it different from similar logic in TraceResponseObserver on line 153?
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.
This is the request stream half. Sending an error on the request stream will end up closing the response stream. So this is more similar to unary future cancellation then a TraceResponseObserver
| } | ||
|
|
||
| @Override | ||
| public void onError(Throwable t) { |
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.
tracer is not called in this method (suspicious)
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.
added a comment explaining that this will end up closing the entire stream and tracing is deferred until then
gax/src/main/java/com/google/api/gax/tracing/TracedClientStreamingCallable.java
Show resolved
Hide resolved
gax/src/test/java/com/google/api/gax/tracing/TracedClientStreamingCallableTest.java
Outdated
Show resolved
Hide resolved
vam-google
left a comment
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.
(One more comment, which I forgot to add initially).
gax/src/main/java/com/google/api/gax/tracing/TracedClientStreamingCallable.java
Show resolved
Hide resolved
# Conflicts: # gax-grpc/src/main/java/com/google/api/gax/grpc/GrpcCallableFactory.java
This depends on #633 and is extracted from #613.
This introduces TracedClientStreamCallables that will create a trace and complete it. It is inserted as one of the outermost links in the callable chain to allow all other callables to contribute their annotations.
google-cloud-java that extend the chains (like cloud bigtable) will also use this class to trace their extensions.
TODO:
[ ] trace operation cancellation after it's reviewed in #634