Package io.grpc.grpclb
Class GrpclbClientLoadRecorder
- java.lang.Object
-
- io.grpc.ClientStreamTracer.Factory
-
- io.grpc.grpclb.GrpclbClientLoadRecorder
-
@ThreadSafe final class GrpclbClientLoadRecorder extends ClientStreamTracer.Factory
Record and aggregate client-side load data for GRPCLB. This records load occurred during the span of an LB stream with the remote load-balancer.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classGrpclbClientLoadRecorder.LongHolderprivate classGrpclbClientLoadRecorder.StreamTracer
-
Field Summary
Fields Modifier and Type Field Description private java.util.Map<java.lang.String,GrpclbClientLoadRecorder.LongHolder>callsDroppedPerTokenprivate longcallsFailedToSendprivate static java.util.concurrent.atomic.AtomicLongFieldUpdater<GrpclbClientLoadRecorder>callsFailedToSendUpdaterprivate longcallsFinishedprivate longcallsFinishedKnownReceivedprivate static java.util.concurrent.atomic.AtomicLongFieldUpdater<GrpclbClientLoadRecorder>callsFinishedKnownReceivedUpdaterprivate static java.util.concurrent.atomic.AtomicLongFieldUpdater<GrpclbClientLoadRecorder>callsFinishedUpdaterprivate longcallsStartedprivate static java.util.concurrent.atomic.AtomicLongFieldUpdater<GrpclbClientLoadRecorder>callsStartedUpdaterprivate TimeProvidertime
-
Constructor Summary
Constructors Constructor Description GrpclbClientLoadRecorder(TimeProvider time)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) ClientStatsgenerateLoadReport()Generate the report with the data recorded this LB stream since the last report.ClientStreamTracernewClientStreamTracer(ClientStreamTracer.StreamInfo info, Metadata headers)Creates aClientStreamTracerfor a new client stream.(package private) voidrecordDroppedRequest(java.lang.String token)Records that a request has been dropped as instructed by the remote balancer.
-
-
-
Field Detail
-
callsStartedUpdater
private static final java.util.concurrent.atomic.AtomicLongFieldUpdater<GrpclbClientLoadRecorder> callsStartedUpdater
-
callsFinishedUpdater
private static final java.util.concurrent.atomic.AtomicLongFieldUpdater<GrpclbClientLoadRecorder> callsFinishedUpdater
-
callsFailedToSendUpdater
private static final java.util.concurrent.atomic.AtomicLongFieldUpdater<GrpclbClientLoadRecorder> callsFailedToSendUpdater
-
callsFinishedKnownReceivedUpdater
private static final java.util.concurrent.atomic.AtomicLongFieldUpdater<GrpclbClientLoadRecorder> callsFinishedKnownReceivedUpdater
-
time
private final TimeProvider time
-
callsStarted
private volatile long callsStarted
-
callsFinished
private volatile long callsFinished
-
callsDroppedPerToken
private java.util.Map<java.lang.String,GrpclbClientLoadRecorder.LongHolder> callsDroppedPerToken
-
callsFailedToSend
private volatile long callsFailedToSend
-
callsFinishedKnownReceived
private volatile long callsFinishedKnownReceived
-
-
Constructor Detail
-
GrpclbClientLoadRecorder
GrpclbClientLoadRecorder(TimeProvider time)
-
-
Method Detail
-
newClientStreamTracer
public ClientStreamTracer newClientStreamTracer(ClientStreamTracer.StreamInfo info, Metadata headers)
Description copied from class:ClientStreamTracer.FactoryCreates aClientStreamTracerfor a new client stream. This is called inside the transport when it's creating the stream.- Overrides:
newClientStreamTracerin classClientStreamTracer.Factory- Parameters:
info- information about the streamheaders- the mutable headers of the stream. It can be safely mutated within this method. Changes made to it will be sent by the stream. It should not be saved because it is not safe for read or write after the method returns.
-
recordDroppedRequest
void recordDroppedRequest(java.lang.String token)
Records that a request has been dropped as instructed by the remote balancer.
-
generateLoadReport
ClientStats generateLoadReport()
Generate the report with the data recorded this LB stream since the last report.
-
-