Class MetricRecorderHelper

java.lang.Object
io.grpc.services.MetricRecorderHelper

final class MetricRecorderHelper extends Object
Utility helper class to check whether values for CallMetricRecorder and MetricRecorder are inside the valid range.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    private
     
  • Method Summary

    Modifier and Type
    Method
    Description
    (package private) static boolean
    Return true if the cpu utilization or application specific utilization value is in the range [0, inf) and false otherwise.
    (package private) static boolean
    isRateValid(double rate)
    Return true if a rate value (such as qps or eps) is in the range [0, inf) and false otherwise.
    (package private) static boolean
    isUtilizationValid(double utilization)
    Return true if the utilization value is in the range [0, 1] and false otherwise.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • MetricRecorderHelper

      private MetricRecorderHelper()
  • Method Details

    • isUtilizationValid

      static boolean isUtilizationValid(double utilization)
      Return true if the utilization value is in the range [0, 1] and false otherwise.
    • isCpuOrApplicationUtilizationValid

      static boolean isCpuOrApplicationUtilizationValid(double utilization)
      Return true if the cpu utilization or application specific utilization value is in the range [0, inf) and false otherwise. Occasionally users have over 100% cpu utilization and get a runaway effect where the backend with highest qps gets more and more qps sent to it. So we allow cpu utilization > 1.0, similarly for application specific utilization.
    • isRateValid

      static boolean isRateValid(double rate)
      Return true if a rate value (such as qps or eps) is in the range [0, inf) and false otherwise.