Package io.grpc.xds.client
Class LoadStatsManager2
- java.lang.Object
-
- io.grpc.xds.client.LoadStatsManager2
-
@ThreadSafe @Internal public final class LoadStatsManager2 extends java.lang.Object
Manages client side traffic stats. Drop stats are maintained in cluster (with edsServiceName) granularity and load stats (request counts) are maintained in locality granularity.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
LoadStatsManager2.ClusterDropStats
Recorder for dropped requests.private static class
LoadStatsManager2.ClusterDropStatsSnapshot
class
LoadStatsManager2.ClusterLocalityStats
Recorder for client loads.private static class
LoadStatsManager2.ClusterLocalityStatsSnapshot
-
Field Summary
Fields Modifier and Type Field Description private java.util.Map<java.lang.String,java.util.Map<java.lang.String,ReferenceCounted<LoadStatsManager2.ClusterDropStats>>>
allDropStats
private java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.util.Map<Locality,ReferenceCounted<LoadStatsManager2.ClusterLocalityStats>>>>
allLoadStats
private com.google.common.base.Supplier<com.google.common.base.Stopwatch>
stopwatchSupplier
-
Constructor Summary
Constructors Constructor Description LoadStatsManager2(com.google.common.base.Supplier<com.google.common.base.Stopwatch> stopwatchSupplier)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) java.util.List<Stats.ClusterStats>
getAllClusterStatsReports()
Gets the traffic stats (drops and loads) as a list ofStats.ClusterStats
recorded for all clusters since the previous call of this method orgetClusterStatsReports(java.lang.String)
for each specific cluster.LoadStatsManager2.ClusterDropStats
getClusterDropStats(java.lang.String cluster, java.lang.String edsServiceName)
Gets or creates the stats object for recording drops for the specified cluster with edsServiceName.LoadStatsManager2.ClusterLocalityStats
getClusterLocalityStats(java.lang.String cluster, java.lang.String edsServiceName, Locality locality)
Gets or creates the stats object for recording loads for the specified locality (in the specified cluster with edsServiceName).java.util.List<Stats.ClusterStats>
getClusterStatsReports(java.lang.String cluster)
Gets the traffic stats (drops and loads) as a list ofStats.ClusterStats
recorded for the specified cluster since the previous call of this method orgetAllClusterStatsReports()
.private void
releaseClusterDropCounter(java.lang.String cluster, java.lang.String edsServiceName)
private void
releaseClusterLocalityLoadCounter(java.lang.String cluster, java.lang.String edsServiceName, Locality locality)
-
-
-
Field Detail
-
allDropStats
private final java.util.Map<java.lang.String,java.util.Map<java.lang.String,ReferenceCounted<LoadStatsManager2.ClusterDropStats>>> allDropStats
-
allLoadStats
private final java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.util.Map<Locality,ReferenceCounted<LoadStatsManager2.ClusterLocalityStats>>>> allLoadStats
-
stopwatchSupplier
private final com.google.common.base.Supplier<com.google.common.base.Stopwatch> stopwatchSupplier
-
-
Method Detail
-
getClusterDropStats
public LoadStatsManager2.ClusterDropStats getClusterDropStats(java.lang.String cluster, @Nullable java.lang.String edsServiceName)
Gets or creates the stats object for recording drops for the specified cluster with edsServiceName. The returned object is reference counted and the caller should useLoadStatsManager2.ClusterDropStats.release()
to release its hard reference when it is safe to discard future stats for the cluster.
-
releaseClusterDropCounter
private void releaseClusterDropCounter(java.lang.String cluster, @Nullable java.lang.String edsServiceName)
-
getClusterLocalityStats
public LoadStatsManager2.ClusterLocalityStats getClusterLocalityStats(java.lang.String cluster, @Nullable java.lang.String edsServiceName, Locality locality)
Gets or creates the stats object for recording loads for the specified locality (in the specified cluster with edsServiceName). The returned object is reference counted and the caller should useLoadStatsManager2.ClusterLocalityStats.release()
to release its hard reference when it is safe to discard the future stats for the locality.
-
releaseClusterLocalityLoadCounter
private void releaseClusterLocalityLoadCounter(java.lang.String cluster, @Nullable java.lang.String edsServiceName, Locality locality)
-
getClusterStatsReports
public java.util.List<Stats.ClusterStats> getClusterStatsReports(java.lang.String cluster)
Gets the traffic stats (drops and loads) as a list ofStats.ClusterStats
recorded for the specified cluster since the previous call of this method orgetAllClusterStatsReports()
. AStats.ClusterStats
includes stats for a specific cluster with edsServiceName.
-
getAllClusterStatsReports
java.util.List<Stats.ClusterStats> getAllClusterStatsReports()
Gets the traffic stats (drops and loads) as a list ofStats.ClusterStats
recorded for all clusters since the previous call of this method orgetClusterStatsReports(java.lang.String)
for each specific cluster. AStats.ClusterStats
includes stats for a specific cluster with edsServiceName.
-
-