Class TehutiUtils


  • public class TehutiUtils
    extends java.lang.Object
    Utils for venice metrics
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  TehutiUtils.RatioStat
      Generate a ratio stat that is based on two arbitrary Rate.
      static class  TehutiUtils.SimpleRatioStat
      Generate a ratio stat that is based on two arbitrary MeasurableStat.
    • Constructor Summary

      Constructors 
      Constructor Description
      TehutiUtils()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String fixMalformedMetricName​(java.lang.String metricName)
      A valid metric name needs to pass the test in ObjectName.
      static io.tehuti.metrics.stats.Percentiles getFineGrainedPercentileStat​(java.lang.String name, int sizeInBytes, double max)  
      static io.tehuti.metrics.stats.Percentiles getFineGrainedPercentileStat​(java.lang.String sensorName, java.lang.String storeName)  
      static io.tehuti.metrics.MeasurableStat[] getFineGrainedPercentileStatWithAvgAndMax​(java.lang.String sensorName, java.lang.String storeName)  
      static io.tehuti.metrics.MetricsRepository getMetricsRepository​(java.lang.String serviceName)
      Get default MetricRepository.
      static io.tehuti.metrics.stats.Percentiles getPercentileStat​(java.lang.String name)
      Generate a histogram stat that emits P50, P95, and P99 values.
      static io.tehuti.metrics.stats.Percentiles getPercentileStat​(java.lang.String name, int sizeInBytes, double max)
      Generate a histogram stat that emits P50, P95, and P99 values.
      static io.tehuti.metrics.stats.Percentiles getPercentileStat​(java.lang.String name, int sizeInBytes, double max, double... percentiles)  
      static io.tehuti.metrics.stats.Percentiles getPercentileStat​(java.lang.String sensorName, java.lang.String storeName)
      TODO: need to investigate why percentiles with big values (> 10^6) won't show in InGraph.
      static io.tehuti.metrics.stats.Percentiles getPercentileStatForNetworkLatency​(java.lang.String sensorName, java.lang.String storeName)
      Generate a histogram stat that emits P50, P77, P90, P95, P99 and P99.9 values.
      static io.tehuti.metrics.MeasurableStat[] getPercentileStatWithAvgAndMax​(java.lang.String sensorName, java.lang.String storeName)  
      • Methods inherited from class java.lang.Object

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

      • TehutiUtils

        public TehutiUtils()
    • Method Detail

      • getPercentileStat

        public static io.tehuti.metrics.stats.Percentiles getPercentileStat​(java.lang.String sensorName,
                                                                            java.lang.String storeName)
        TODO: need to investigate why percentiles with big values (> 10^6) won't show in InGraph.
      • getPercentileStatWithAvgAndMax

        public static io.tehuti.metrics.MeasurableStat[] getPercentileStatWithAvgAndMax​(java.lang.String sensorName,
                                                                                        java.lang.String storeName)
      • getFineGrainedPercentileStatWithAvgAndMax

        public static io.tehuti.metrics.MeasurableStat[] getFineGrainedPercentileStatWithAvgAndMax​(java.lang.String sensorName,
                                                                                                   java.lang.String storeName)
      • getFineGrainedPercentileStat

        public static io.tehuti.metrics.stats.Percentiles getFineGrainedPercentileStat​(java.lang.String sensorName,
                                                                                       java.lang.String storeName)
      • getPercentileStatForNetworkLatency

        public static io.tehuti.metrics.stats.Percentiles getPercentileStatForNetworkLatency​(java.lang.String sensorName,
                                                                                             java.lang.String storeName)
        Generate a histogram stat that emits P50, P77, P90, P95, P99 and P99.9 values. N.B.: These are useful percentiles to estimate the latency we would get with speculative queries: P77 latency with one query would become: P95 with the fastest of two queries, and P99 with the fastest of three P90 latency with one query would become: P99 with the fastest of two queries, and P99.9 with the fastest of three
      • getPercentileStat

        public static io.tehuti.metrics.stats.Percentiles getPercentileStat​(java.lang.String name)
        Generate a histogram stat that emits P50, P95, and P99 values.
        Parameters:
        name -
        Returns:
        3 sub stats that emit p50, P95, and P99 values.
      • getPercentileStat

        public static io.tehuti.metrics.stats.Percentiles getPercentileStat​(java.lang.String name,
                                                                            int sizeInBytes,
                                                                            double max)
        Generate a histogram stat that emits P50, P95, and P99 values.
        Parameters:
        name -
        sizeInBytes - Histogram's memory consumption
        max - Histogram's max value
        Returns:
        3 sub stats that emit p50, P95, and P99 values.
      • getFineGrainedPercentileStat

        public static io.tehuti.metrics.stats.Percentiles getFineGrainedPercentileStat​(java.lang.String name,
                                                                                       int sizeInBytes,
                                                                                       double max)
      • getPercentileStat

        public static io.tehuti.metrics.stats.Percentiles getPercentileStat​(java.lang.String name,
                                                                            int sizeInBytes,
                                                                            double max,
                                                                            double... percentiles)
      • getMetricsRepository

        public static io.tehuti.metrics.MetricsRepository getMetricsRepository​(java.lang.String serviceName)
        Get default MetricRepository. It will emit metrics via JMX.
        Parameters:
        serviceName - Prefix name of all emitted metrics
        Returns:
      • fixMalformedMetricName

        public static java.lang.String fixMalformedMetricName​(java.lang.String metricName)
        A valid metric name needs to pass the test in ObjectName. This helper function will try to fix all invalid character mentioned in the above function to avoid MalformedObjectNameException; besides, dot(.) will also be replaced since dot is a separator used in InGraph.