Package io.grpc.util
Class ForwardingClientStreamTracer
- java.lang.Object
-
- io.grpc.StreamTracer
-
- io.grpc.ClientStreamTracer
-
- io.grpc.util.ForwardingClientStreamTracer
-
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/2861") public abstract class ForwardingClientStreamTracer extends ClientStreamTracer
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class io.grpc.ClientStreamTracer
ClientStreamTracer.Factory, ClientStreamTracer.StreamInfo
-
-
Field Summary
-
Fields inherited from class io.grpc.ClientStreamTracer
NAME_RESOLUTION_DELAYED
-
-
Constructor Summary
Constructors Constructor Description ForwardingClientStreamTracer()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
addOptionalLabel(String key, String value)
Information providing context to the call became available.void
createPendingStream()
Name resolution is completed and the connection starts getting established.protected abstract ClientStreamTracer
delegate()
Returns the underlyingClientStreamTracer
.void
inboundHeaders()
Headers has been received from the server.void
inboundHeaders(Metadata headers)
Headers has been received from the server.void
inboundMessage(int seqNo)
An inbound message has been received by the stream.void
inboundMessageRead(int seqNo, long optionalWireSize, long optionalUncompressedSize)
An inbound message has been fully read from the transport.void
inboundTrailers(Metadata trailers)
Trailing metadata has been received from the server.void
inboundUncompressedSize(long bytes)
The uncompressed size of some inbound data is revealed.void
inboundWireSize(long bytes)
The wire size of some inbound data is revealed.void
outboundHeaders()
Headers has been sent to the socket.void
outboundMessage(int seqNo)
An outbound message has been passed to the stream.void
outboundMessageSent(int seqNo, long optionalWireSize, long optionalUncompressedSize)
An outbound message has been serialized and sent to the transport.void
outboundUncompressedSize(long bytes)
The uncompressed size of some outbound data is revealed.void
outboundWireSize(long bytes)
The wire size of some outbound data is revealed.void
streamClosed(Status status)
Stream is closed.void
streamCreated(Attributes transportAttrs, Metadata headers)
The stream is being created on a ready transport.String
toString()
-
-
-
Method Detail
-
delegate
protected abstract ClientStreamTracer delegate()
Returns the underlyingClientStreamTracer
.
-
streamCreated
public void streamCreated(Attributes transportAttrs, Metadata headers)
Description copied from class:ClientStreamTracer
The stream is being created on a ready transport.- Overrides:
streamCreated
in classClientStreamTracer
headers
- the mutable initial metadata. Modifications to it will be sent to the socket but not be seen by client interceptors and the application.
-
createPendingStream
public void createPendingStream()
Description copied from class:ClientStreamTracer
Name resolution is completed and the connection starts getting established. This method is only invoked on the streams that encounter such delay. gRPC buffers the client call if the remote address and configurations, e.g. timeouts and retry policy, are not ready. Asynchronously gRPC internally does the name resolution to get this information. The streams that are processed immediately on ready transports by the time the RPC comes do not go through the pending process, thus this callback will not be invoked.- Overrides:
createPendingStream
in classClientStreamTracer
-
outboundHeaders
public void outboundHeaders()
Description copied from class:ClientStreamTracer
Headers has been sent to the socket.- Overrides:
outboundHeaders
in classClientStreamTracer
-
inboundHeaders
public void inboundHeaders()
Description copied from class:ClientStreamTracer
Headers has been received from the server.- Overrides:
inboundHeaders
in classClientStreamTracer
-
inboundHeaders
public void inboundHeaders(Metadata headers)
Description copied from class:ClientStreamTracer
Headers has been received from the server. This method does not pass ownership toheaders
, so implementations must not access the metadata after returning. Modifications to the metadata within this method will be seen by interceptors and the application.- Overrides:
inboundHeaders
in classClientStreamTracer
- Parameters:
headers
- the received header metadata
-
inboundTrailers
public void inboundTrailers(Metadata trailers)
Description copied from class:ClientStreamTracer
Trailing metadata has been received from the server. This method does not pass ownership totrailers
, so implementations must not access the metadata after returning. Modifications to the metadata within this method will be seen by interceptors and the application.- Overrides:
inboundTrailers
in classClientStreamTracer
- Parameters:
trailers
- the received trailing metadata
-
addOptionalLabel
public void addOptionalLabel(String key, String value)
Description copied from class:ClientStreamTracer
Information providing context to the call became available.- Overrides:
addOptionalLabel
in classClientStreamTracer
-
streamClosed
public void streamClosed(Status status)
Description copied from class:StreamTracer
Stream is closed. This will be called exactly once.- Overrides:
streamClosed
in classStreamTracer
-
outboundMessage
public void outboundMessage(int seqNo)
Description copied from class:StreamTracer
An outbound message has been passed to the stream. This is called as soon as the stream knows about the message, but doesn't have further guarantee such as whether the message is serialized or not.- Overrides:
outboundMessage
in classStreamTracer
- Parameters:
seqNo
- the sequential number of the message within the stream, starting from 0. It can be used to correlate withStreamTracer.outboundMessageSent(int, long, long)
for the same message.
-
inboundMessage
public void inboundMessage(int seqNo)
Description copied from class:StreamTracer
An inbound message has been received by the stream. This is called as soon as the stream knows about the message, but doesn't have further guarantee such as whether the message is deserialized or not.- Overrides:
inboundMessage
in classStreamTracer
- Parameters:
seqNo
- the sequential number of the message within the stream, starting from 0. It can be used to correlate withStreamTracer.inboundMessageRead(int, long, long)
for the same message.
-
outboundMessageSent
public void outboundMessageSent(int seqNo, long optionalWireSize, long optionalUncompressedSize)
Description copied from class:StreamTracer
An outbound message has been serialized and sent to the transport.- Overrides:
outboundMessageSent
in classStreamTracer
- Parameters:
seqNo
- the sequential number of the message within the stream, starting from 0. It can be used to correlate withStreamTracer.outboundMessage(int)
for the same message.optionalWireSize
- the wire size of the message. -1 if unknownoptionalUncompressedSize
- the uncompressed serialized size of the message. -1 if unknown
-
inboundMessageRead
public void inboundMessageRead(int seqNo, long optionalWireSize, long optionalUncompressedSize)
Description copied from class:StreamTracer
An inbound message has been fully read from the transport.- Overrides:
inboundMessageRead
in classStreamTracer
- Parameters:
seqNo
- the sequential number of the message within the stream, starting from 0. It can be used to correlate withStreamTracer.inboundMessage(int)
for the same message.optionalWireSize
- the wire size of the message. -1 if unknownoptionalUncompressedSize
- the uncompressed serialized size of the message. -1 if unknown
-
outboundWireSize
public void outboundWireSize(long bytes)
Description copied from class:StreamTracer
The wire size of some outbound data is revealed. This can only used to record the accumulative outbound wire size. There is no guarantee wrt timing or granularity of this method.- Overrides:
outboundWireSize
in classStreamTracer
-
outboundUncompressedSize
public void outboundUncompressedSize(long bytes)
Description copied from class:StreamTracer
The uncompressed size of some outbound data is revealed. This can only used to record the accumulative outbound uncompressed size. There is no guarantee wrt timing or granularity of this method.- Overrides:
outboundUncompressedSize
in classStreamTracer
-
inboundWireSize
public void inboundWireSize(long bytes)
Description copied from class:StreamTracer
The wire size of some inbound data is revealed. This can only be used to record the accumulative received wire size. There is no guarantee wrt timing or granularity of this method.- Overrides:
inboundWireSize
in classStreamTracer
-
inboundUncompressedSize
public void inboundUncompressedSize(long bytes)
Description copied from class:StreamTracer
The uncompressed size of some inbound data is revealed. This can only used to record the accumulative received uncompressed size. There is no guarantee wrt timing or granularity of this method.- Overrides:
inboundUncompressedSize
in classStreamTracer
-
-