Interface MetricHistoryManager


public interface MetricHistoryManager
Created by mattgross on 3/15/2016. Defines the methods used to register a metric and retrieve a metric and its historical values from the internal system. Note that the internal system is NOT the internal database in /data/db.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
     
    static final int
     
  • Method Summary

    Modifier and Type
    Method
    Description
    historyAfterDate(String metricName, Date date)
    Returns all history for the metric that occurred after the specified date.
    historyAll(String metricName)
    Returns all history for the metric.
    historyInterpolated(String metricName, int density)
    Returns all available history for the metric in a compressed form.
    historyMostRecent(String metricName, int dataPoints)
    Returns the most recent X datapoints for the metric.
    boolean
    isRegistered(String metricName)
     
    void
    record(String metricId, com.codahale.metrics.Metric metric)
     
    void
    record(String metricId, com.codahale.metrics.Metric metric, int pollRateMillis, int retainMinutes)
     
    void
    registerCounter(com.codahale.metrics.Counter counter, String counterPath)
    Registers the counter in both the GatewayContext metricRegistry and in this history manager.
    void
    registerCounter(com.codahale.metrics.Counter counter, String counterPath, int pollRateMillis, int retainMinutes)
    Registers the counter in this history manager at the specified poll rate in milliseconds.
    void
    registerGauge(com.codahale.metrics.Gauge<Double> gauge, String gaugePath)
    Registers the gauge in this history manager.
    void
    registerGauge(com.codahale.metrics.Gauge<Double> gauge, String gaugePath, int pollRateMillis, int retainMinutes)
    Registers the gauge in this history manager at the specified poll rate in milliseconds.
    void
    registerMeter(com.codahale.metrics.Meter meter, String meterPath)
    Registers the meter in both the GatewayContext metricRegistry and in this history manager.
    void
    registerMeter(com.codahale.metrics.Meter meter, String meterPath, int pollRateMillis, int retainMinutes)
    Registers the counter in this history manager at the specified poll rate in milliseconds.
    void
     
    void
    Removes the metric this history manager.
  • Field Details

  • Method Details

    • record

      void record(String metricId, com.codahale.metrics.Metric metric)
    • record

      void record(String metricId, com.codahale.metrics.Metric metric, int pollRateMillis, int retainMinutes)
    • stopRecording

      void stopRecording(String metricId)
    • registerGauge

      void registerGauge(com.codahale.metrics.Gauge<Double> gauge, String gaugePath)
      Registers the gauge in this history manager. After the gauge is registered, it is polled at the base update rate, and the polled value recorded in history. Values are retained for a few minutes (determined by the BASE_RETAIN_MINUTES value) and then are deleted from the internal database.
      Parameters:
      gaugePath - the gauge can be retrieved at any time using this path
    • registerGauge

      void registerGauge(com.codahale.metrics.Gauge<Double> gauge, String gaugePath, int pollRateMillis, int retainMinutes)
      Registers the gauge in this history manager at the specified poll rate in milliseconds. The retainMinutes parameter determines the number of minutes to retain the value in history before it is deleted.
      Parameters:
      gaugePath - the gauge can be retrieved at any time using this path
    • registerCounter

      void registerCounter(com.codahale.metrics.Counter counter, String counterPath)
      Registers the counter in both the GatewayContext metricRegistry and in this history manager. After the counter is registered, it is polled at the base update rate, and the polled value recorded in history. Values are retained for a few minutes (determined by the BASE_RETAIN_MINUTES value) and then are deleted from the internal database.
      Parameters:
      counterPath - the counter can be retrieved at any time using this path
    • registerCounter

      void registerCounter(com.codahale.metrics.Counter counter, String counterPath, int pollRateMillis, int retainMinutes)
      Registers the counter in this history manager at the specified poll rate in milliseconds. The retainMinutes parameter determines the number of minutes to retain the value in the internal system before it is deleted.
      Parameters:
      counterPath - the counter can be retrieved at any time using this path
    • registerMeter

      void registerMeter(com.codahale.metrics.Meter meter, String meterPath)
      Registers the meter in both the GatewayContext metricRegistry and in this history manager. After the meter is registered, it is polled at the base update rate, and the polled value recorded in history. The meter's one minute rate is used as the historical recorded value. Values are retained for a few minutes (determined by the BASE_RETAIN_MINUTES value) and then are deleted from the internal database.
    • registerMeter

      void registerMeter(com.codahale.metrics.Meter meter, String meterPath, int pollRateMillis, int retainMinutes)
      Registers the counter in this history manager at the specified poll rate in milliseconds. The meter's one minute rate is used as the historical recorded value. The retainMinutes parameter determines the number of minutes to retain the value in the internal system before it is deleted.
    • unregisterMetric

      void unregisterMetric(String metricPath)
      Removes the metric this history manager. All records related to the metric will also be purged.
      Parameters:
      metricPath - the path that was originally used to register the metric.
    • historyAll

      List<Datapoint> historyAll(String metricName) throws SQLException
      Returns all history for the metric. The list is sorted chronologically, where the most recent value is at the end of the list.
      Throws:
      SQLException
    • historyMostRecent

      List<Datapoint> historyMostRecent(String metricName, int dataPoints) throws SQLException
      Returns the most recent X datapoints for the metric. The list is sorted chronologically, where the most recent value is at the end of the list.
      Parameters:
      dataPoints - the most recent X datapoints to return
      Throws:
      SQLException
    • historyInterpolated

      List<Datapoint> historyInterpolated(String metricName, int density) throws SQLException
      Returns all available history for the metric in a compressed form. Use the density parameter to thin out the history and remove in-between points. A value of 1 includes all points. A value of 2 includes every other point, and a value of 4 includes every 4th point, etc.
      Throws:
      SQLException
    • historyAfterDate

      List<Datapoint> historyAfterDate(String metricName, Date date) throws SQLException
      Returns all history for the metric that occurred after the specified date. Use to limit data to something like the last 24 hours.
      Throws:
      SQLException
    • isRegistered

      boolean isRegistered(String metricName)
      Returns:
      true if the metric with the passed name is currently registered with the metric history system