Skip to content
This repository was archived by the owner on Sep 26, 2023. It is now read-only.

Conversation

@igorbernstein2
Copy link
Contributor

@igorbernstein2 igorbernstein2 commented Jan 3, 2019

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

@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Jan 3, 2019
@igorbernstein2 igorbernstein2 added the do not merge Indicates a pull request not ready for merge, due to either quality or timing. label Jan 3, 2019
@igorbernstein2 igorbernstein2 changed the title Start tracing client streaming callables. WIP: Start tracing client streaming callables. Jan 3, 2019
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.

@igorbernstein2 igorbernstein2 changed the title WIP: Start tracing client streaming callables. Start tracing client streaming callables. Jan 5, 2019
@igorbernstein2
Copy link
Contributor Author

rebased & ready for review

@igorbernstein2 igorbernstein2 removed do not merge Indicates a pull request not ready for merge, due to either quality or timing. labels Jan 5, 2019
@codecov-io
Copy link

codecov-io commented Jan 5, 2019

Codecov Report

Merging #637 into master will increase coverage by 0.17%.
The diff coverage is 92.3%.

Impacted file tree graph

@@             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
Impacted Files Coverage Δ Complexity Δ
...a/com/google/api/gax/grpc/GrpcCallableFactory.java 75% <100%> (+0.97%) 9 <0> (ø) ⬇️
...api/gax/tracing/TracedClientStreamingCallable.java 91.83% <91.83%> (ø) 2 <2> (?)
...oogle/api/gax/grpc/GrpcChannelUUIDInterceptor.java 33.33% <0%> (ø) 1% <0%> (?)
...api/gax/grpc/InstantiatingGrpcChannelProvider.java 75.17% <0%> (+0.17%) 27% <0%> (ø) ⬇️
...a/com/google/api/gax/tracing/OpencensusTracer.java 87.2% <0%> (+0.64%) 31% <0%> (+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 6359c0a...7c4560c. Read the comment docs.

@igorbernstein2 igorbernstein2 changed the title Start tracing client streaming callables. WIP: Start tracing client streaming callables. Jan 10, 2019
@igorbernstein2 igorbernstein2 added the do not merge Indicates a pull request not ready for merge, due to either quality or timing. label Jan 10, 2019
@igorbernstein2 igorbernstein2 changed the title WIP: Start tracing client streaming callables. WIP: Opencensus Tracing: Start tracing client streaming callables. Jan 11, 2019
@igorbernstein2 igorbernstein2 changed the title WIP: Opencensus Tracing: Start tracing client streaming callables. Opencensus Tracing: Start tracing client streaming callables. Jan 11, 2019
@igorbernstein2 igorbernstein2 removed the do not merge Indicates a pull request not ready for merge, due to either quality or timing. label Jan 11, 2019
@@ -0,0 +1,168 @@
/*
* Copyright 2018 Google LLC
Copy link
Contributor

Choose a reason for hiding this comment

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

2019

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

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

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

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

}

private static class FakeStreamObserver implements ApiStreamObserver<String> {
List<String> messages = Lists.newArrayList();
Copy link
Contributor

Choose a reason for hiding this comment

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

Please make these private

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

# Conflicts:
#	gax-grpc/src/main/java/com/google/api/gax/grpc/GrpcCallableFactory.java
@JustinBeckwith JustinBeckwith added the 🚨 This issue needs some love. label Feb 7, 2019
@yoshi-automation yoshi-automation added 🚨 This issue needs some love. and removed 🚨 This issue needs some love. labels Feb 7, 2019
@igorbernstein2 igorbernstein2 added 🚨 This issue needs some love. and removed 🚨 This issue needs some love. labels Feb 7, 2019
Copy link
Contributor

@vam-google vam-google left a 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) {
Copy link
Contributor

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?

Copy link
Contributor Author

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

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)

Copy link
Contributor Author

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

Copy link
Contributor

@vam-google vam-google left a 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).

@igorbernstein2 igorbernstein2 merged commit b685cf0 into googleapis:master Feb 20, 2019
@igorbernstein2 igorbernstein2 deleted the oc-client-streaming branch February 20, 2019 17:28
This was referenced Feb 20, 2019
This was referenced Feb 28, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

cla: yes This human has signed the Contributor License Agreement. 🚨 This issue needs some love.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants