Skip to content

Conversation

@ericgribkoff
Copy link
Contributor

This brings Cronet client's stats reporting inline with InProcess, Netty, and OkHttp.

This was caught by AbstractInteropTest#assertClientStatsTrace when running the interop tests with a Cronet transport.

// Now that the stream is ready, call the listener's onReady callback if
// appropriate.
state.onStreamAllocated();
statsTraceCtx.clientOutboundHeaders();
Copy link
Contributor

Choose a reason for hiding this comment

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

At what point are the headers written to the socket?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It looks like I misread the implementation here. They may or may not have been written to socket by this point, and the Cronet API doesn't offer notification w.r.t. when the write actually occurs: source is at https://cs.chromium.org/chromium/src/components/cronet/android/java/src/org/chromium/net/impl/CronetBidirectionalStream.java?l=491&rcl=c1141f37e26d971f835f5958b2eec7627286616b

Given this, it probably doesn't make sense to report clientOutboundHeaders here, which means Cronet transport will never log this event. If this event is only applicable to certain (i.e., non-Cronet) transports, could we consider removing the assert at https://github.com/grpc/grpc-java/blob/master/interop-testing/src/main/java/io/grpc/testing/integration/AbstractInteropTest.java#L1868 in the interop test?

Copy link
Contributor

Choose a reason for hiding this comment

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

I see there is onWriteCompleted() callback, with a ByteBuffer passed in. Will there be a ByteBuffer for headers that will receive such notification?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think so. Headers are provided to the stream by a separate mechanism, without a ByteBuffer.

Copy link
Contributor

Choose a reason for hiding this comment

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

We can probably just mark the first onWriteCompleted() as the most accurate time for clientOutboundHeaders(). It's better than nothing.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sgtm, thanks. Done

@ericgribkoff ericgribkoff merged commit fd73209 into grpc:master Aug 29, 2018
@ericgribkoff ericgribkoff deleted the cronet_outbound_client_headers branch August 29, 2018 03:19
@lock lock bot locked as resolved and limited conversation to collaborators Nov 27, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants