Package io.grpc.xds.client
Class LoadStatsManager2
java.lang.Object
io.grpc.xds.client.LoadStatsManager2
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 ClassesModifier and TypeClassDescriptionfinal class
Recorder for dropped requests.private static final class
final class
Recorder for client loads.private static final class
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Map
<String, Map<String, ReferenceCounted<LoadStatsManager2.ClusterDropStats>>> private final Map
<String, Map<String, Map<Locality, ReferenceCounted<LoadStatsManager2.ClusterLocalityStats>>>> private final com.google.common.base.Supplier
<com.google.common.base.Stopwatch> -
Constructor Summary
ConstructorsConstructorDescriptionLoadStatsManager2
(com.google.common.base.Supplier<com.google.common.base.Stopwatch> stopwatchSupplier) -
Method Summary
Modifier and TypeMethodDescription(package private) List
<Stats.ClusterStats> 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.getClusterDropStats
(String cluster, String edsServiceName) Gets or creates the stats object for recording drops for the specified cluster with edsServiceName.getClusterLocalityStats
(String cluster, String edsServiceName, Locality locality) Gets or creates the stats object for recording loads for the specified locality (in the specified cluster with edsServiceName).getClusterStatsReports
(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
(String cluster, String edsServiceName) private void
releaseClusterLocalityLoadCounter
(String cluster, String edsServiceName, Locality locality)
-
Field Details
-
allDropStats
private final Map<String,Map<String, allDropStatsReferenceCounted<LoadStatsManager2.ClusterDropStats>>> -
allLoadStats
private final Map<String,Map<String, allLoadStatsMap<Locality, ReferenceCounted<LoadStatsManager2.ClusterLocalityStats>>>> -
stopwatchSupplier
private final com.google.common.base.Supplier<com.google.common.base.Stopwatch> stopwatchSupplier
-
-
Constructor Details
-
LoadStatsManager2
public LoadStatsManager2(com.google.common.base.Supplier<com.google.common.base.Stopwatch> stopwatchSupplier)
-
-
Method Details
-
getClusterDropStats
public LoadStatsManager2.ClusterDropStats getClusterDropStats(String cluster, @Nullable 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
-
getClusterLocalityStats
public LoadStatsManager2.ClusterLocalityStats getClusterLocalityStats(String cluster, @Nullable 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
-
getClusterStatsReports
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
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.
-