Package io.grpc.services
Class MetricRecorder
java.lang.Object
io.grpc.services.MetricRecorder
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/9006")
public final class MetricRecorder
extends Object
Implements the service/APIs for Out-of-Band metrics reporting, only for utilization metrics.
A user should use the public set-APIs to update the server machine's utilization metrics data.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate double
private double
private double
private double
private ConcurrentHashMap
<String, Double> private double
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Clear the application specific utilization metrics data.void
Clear the CPU utilization metrics data.void
Clear the EPS metrics data.void
Clear the memory utilization metrics data.void
Clear the QPS metrics data.(package private) MetricReport
static MetricRecorder
void
putUtilizationMetric
(String key, double value) Update the metrics value in the range [0, 1] corresponding to the specified key.void
Remove the metrics data entry corresponding to the specified key.void
setAllUtilizationMetrics
(Map<String, Double> metrics) Replace the whole metrics data using the specified map.void
setApplicationUtilizationMetric
(double value) Update the application specific utilization metrics data in the range [0, inf).void
setCpuUtilizationMetric
(double value) Update the CPU utilization metrics data in the range [0, inf).void
setEpsMetric
(double value) Update the EPS metrics data in the range [0, inf).void
setMemoryUtilizationMetric
(double value) Update the memory utilization metrics data in the range [0, 1].void
setQpsMetric
(double value) Update the QPS metrics data in the range [0, inf).
-
Field Details
-
metricsData
-
cpuUtilization
private volatile double cpuUtilization -
applicationUtilization
private volatile double applicationUtilization -
memoryUtilization
private volatile double memoryUtilization -
qps
private volatile double qps -
eps
private volatile double eps
-
-
Constructor Details
-
MetricRecorder
private MetricRecorder()
-
-
Method Details
-
newInstance
-
putUtilizationMetric
Update the metrics value in the range [0, 1] corresponding to the specified key. Values outside the valid range are ignored. -
setAllUtilizationMetrics
Replace the whole metrics data using the specified map. No range validation. -
removeUtilizationMetric
Remove the metrics data entry corresponding to the specified key. -
setCpuUtilizationMetric
public void setCpuUtilizationMetric(double value) Update the CPU utilization metrics data in the range [0, inf). Values outside the valid range are ignored. -
clearCpuUtilizationMetric
public void clearCpuUtilizationMetric()Clear the CPU utilization metrics data. -
setApplicationUtilizationMetric
public void setApplicationUtilizationMetric(double value) Update the application specific utilization metrics data in the range [0, inf). Values outside the valid range are ignored. -
clearApplicationUtilizationMetric
public void clearApplicationUtilizationMetric()Clear the application specific utilization metrics data. -
setMemoryUtilizationMetric
public void setMemoryUtilizationMetric(double value) Update the memory utilization metrics data in the range [0, 1]. Values outside the valid range are ignored. -
clearMemoryUtilizationMetric
public void clearMemoryUtilizationMetric()Clear the memory utilization metrics data. -
setQpsMetric
public void setQpsMetric(double value) Update the QPS metrics data in the range [0, inf). Values outside the valid range are ignored. -
clearQpsMetric
public void clearQpsMetric()Clear the QPS metrics data. -
setEpsMetric
public void setEpsMetric(double value) Update the EPS metrics data in the range [0, inf). Values outside the valid range are ignored. -
clearEpsMetric
public void clearEpsMetric()Clear the EPS metrics data. -
getMetricReport
MetricReport getMetricReport()
-