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 java.lang.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
Fields Modifier and Type Field Description private double
applicationUtilization
private double
cpuUtilization
private double
eps
private double
memoryUtilization
private java.util.concurrent.ConcurrentHashMap<java.lang.String,java.lang.Double>
metricsData
private double
qps
-
Constructor Summary
Constructors Modifier Constructor Description private
MetricRecorder()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clearApplicationUtilizationMetric()
Clear the application specific utilization metrics data.void
clearCpuUtilizationMetric()
Clear the CPU utilization metrics data.void
clearEpsMetric()
Clear the EPS metrics data.void
clearMemoryUtilizationMetric()
Clear the memory utilization metrics data.void
clearQpsMetric()
Clear the QPS metrics data.(package private) MetricReport
getMetricReport()
static MetricRecorder
newInstance()
void
putUtilizationMetric(java.lang.String key, double value)
Update the metrics value in the range [0, 1] corresponding to the specified key.void
removeUtilizationMetric(java.lang.String key)
Remove the metrics data entry corresponding to the specified key.void
setAllUtilizationMetrics(java.util.Map<java.lang.String,java.lang.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 Detail
-
metricsData
private volatile java.util.concurrent.ConcurrentHashMap<java.lang.String,java.lang.Double> 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
-
-
Method Detail
-
newInstance
public static MetricRecorder newInstance()
-
putUtilizationMetric
public void putUtilizationMetric(java.lang.String key, double value)
Update the metrics value in the range [0, 1] corresponding to the specified key. Values outside the valid range are ignored.
-
setAllUtilizationMetrics
public void setAllUtilizationMetrics(java.util.Map<java.lang.String,java.lang.Double> metrics)
Replace the whole metrics data using the specified map. No range validation.
-
removeUtilizationMetric
public void removeUtilizationMetric(java.lang.String key)
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()
-
-