Interface MetricsDatabase


  • public interface MetricsDatabase
    Database for storing a metric.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Interface Description
      static interface  MetricsDatabase.Builder
      A builder of MetricsDatabase.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      long lastUpdate​(String metricType)
      Returns the latest metric update time.
      double maxMetric​(String metricType)
      Returns maximum metric value of a given metric type.
      String metricName()
      Returns the metric name of this database.
      double[] metrics​(String metricType)
      Returns a collection of metric values of a given metric type for a day.
      double[] metrics​(String metricType, long startTime, long endTime)
      Returns a collection of metric values of a given metric type for a given period.
      double minMetric​(String metricType)
      Returns minimum metric value of a given metric type.
      double recentMetric​(String metricType)
      Returns most recent metric value of a given metric type.
      double[] recentMetrics​(String metricType, int duration, TimeUnit unit)
      Return most recent metric values of a given metric type for a given period.
      String resourceName()
      Returns the resource name of this database.
      void updateMetric​(String metricType, double value)
      Update metric value by specifying metric type.
      void updateMetric​(String metricType, double value, long time)
      Update metric value by specifying metric type in a certain time.
      void updateMetrics​(Map<String,​Double> metrics)
      Update metric values of a collection of metric types.
      void updateMetrics​(Map<String,​Double> metrics, long time)
      Update metric values of a collection of metric types.
    • Method Detail

      • metricName

        String metricName()
        Returns the metric name of this database.
        Returns:
        metric name
      • resourceName

        String resourceName()
        Returns the resource name of this database.
        Returns:
        resource name
      • updateMetric

        void updateMetric​(String metricType,
                          double value)
        Update metric value by specifying metric type.
        Parameters:
        metricType - metric type (e.g., load, usage, etc.)
        value - metric value
      • updateMetric

        void updateMetric​(String metricType,
                          double value,
                          long time)
        Update metric value by specifying metric type in a certain time.
        Parameters:
        metricType - metric type (e.g., load, usage, etc.)
        value - metric value
        time - update time in seconds
      • updateMetrics

        void updateMetrics​(Map<String,​Double> metrics,
                           long time)
        Update metric values of a collection of metric types.
        Parameters:
        metrics - a collection of metrics which consists of a pair of metric type and metric value
        time - update time in seconds
      • updateMetrics

        void updateMetrics​(Map<String,​Double> metrics)
        Update metric values of a collection of metric types.
        Parameters:
        metrics - a collection of metrics which consists of a pair of metric type and metric value
      • recentMetric

        double recentMetric​(String metricType)
        Returns most recent metric value of a given metric type.
        Parameters:
        metricType - metric type
        Returns:
        metric value
      • recentMetrics

        double[] recentMetrics​(String metricType,
                               int duration,
                               TimeUnit unit)
        Return most recent metric values of a given metric type for a given period.
        Parameters:
        metricType - metric type
        duration - duration
        unit - time unit
        Returns:
        a collection of metric value
      • minMetric

        double minMetric​(String metricType)
        Returns minimum metric value of a given metric type.
        Parameters:
        metricType - metric type
        Returns:
        metric value
      • maxMetric

        double maxMetric​(String metricType)
        Returns maximum metric value of a given metric type.
        Parameters:
        metricType - metric type
        Returns:
        metric value
      • metrics

        double[] metrics​(String metricType)
        Returns a collection of metric values of a given metric type for a day.
        Parameters:
        metricType - metric type
        Returns:
        a collection of metric value
      • metrics

        double[] metrics​(String metricType,
                         long startTime,
                         long endTime)
        Returns a collection of metric values of a given metric type for a given period.
        Parameters:
        metricType - metric type
        startTime - start time
        endTime - end time
        Returns:
        a collection of metric value
      • lastUpdate

        long lastUpdate​(String metricType)
        Returns the latest metric update time.
        Parameters:
        metricType - metric type
        Returns:
        timestamp