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 class
GrpclbClientLoadRecorder.LongHolder
private class
GrpclbClientLoadRecorder.StreamTracer
-
Field Summary
Fields Modifier and Type Field Description private java.util.Map<java.lang.String,GrpclbClientLoadRecorder.LongHolder>
callsDroppedPerToken
private long
callsFailedToSend
private static java.util.concurrent.atomic.AtomicLongFieldUpdater<GrpclbClientLoadRecorder>
callsFailedToSendUpdater
private long
callsFinished
private long
callsFinishedKnownReceived
private static java.util.concurrent.atomic.AtomicLongFieldUpdater<GrpclbClientLoadRecorder>
callsFinishedKnownReceivedUpdater
private static java.util.concurrent.atomic.AtomicLongFieldUpdater<GrpclbClientLoadRecorder>
callsFinishedUpdater
private long
callsStarted
private static java.util.concurrent.atomic.AtomicLongFieldUpdater<GrpclbClientLoadRecorder>
callsStartedUpdater
private TimeProvider
time
-
Constructor Summary
Constructors Constructor Description GrpclbClientLoadRecorder(TimeProvider time)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) ClientStats
generateLoadReport()
Generate the report with the data recorded this LB stream since the last report.ClientStreamTracer
newClientStreamTracer(ClientStreamTracer.StreamInfo info, Metadata headers)
Creates aClientStreamTracer
for a new client stream.(package private) void
recordDroppedRequest(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.Factory
Creates aClientStreamTracer
for a new client stream. This is called inside the transport when it's creating the stream.- Overrides:
newClientStreamTracer
in 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.
-
-