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 int
BASE_RETAIN_MINUTES
static int
BASE_UPDATE_MILLIS
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.util.List<Datapoint>
historyAfterDate(java.lang.String metricName, java.util.Date date)
Returns all history for the metric that occurred after the specified date.java.util.List<Datapoint>
historyAll(java.lang.String metricName)
Returns all history for the metric.java.util.List<Datapoint>
historyInterpolated(java.lang.String metricName, int density)
Returns all available history for the metric in a compressed form.java.util.List<Datapoint>
historyMostRecent(java.lang.String metricName, int dataPoints)
Returns the most recent X datapoints for the metric.boolean
isRegistered(java.lang.String metricName)
void
record(java.lang.String metricId, com.codahale.metrics.Metric metric)
void
record(java.lang.String metricId, com.codahale.metrics.Metric metric, int pollRateMillis, int retainMinutes)
void
registerCounter(com.codahale.metrics.Counter counter, java.lang.String counterPath)
Registers the counter in both the GatewayContext metricRegistry and in this history manager.void
registerCounter(com.codahale.metrics.Counter counter, java.lang.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<java.lang.Double> gauge, java.lang.String gaugePath)
Registers the gauge in this history manager.void
registerGauge(com.codahale.metrics.Gauge<java.lang.Double> gauge, java.lang.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, java.lang.String meterPath)
Registers the meter in both the GatewayContext metricRegistry and in this history manager.void
registerMeter(com.codahale.metrics.Meter meter, java.lang.String meterPath, int pollRateMillis, int retainMinutes)
Registers the counter in this history manager at the specified poll rate in milliseconds.void
stopRecording(java.lang.String metricId)
void
unregisterMetric(java.lang.String metricPath)
Removes the metric this history manager.
-
-
-
Field Detail
-
BASE_UPDATE_MILLIS
static final int BASE_UPDATE_MILLIS
- See Also:
- Constant Field Values
-
BASE_RETAIN_MINUTES
static final int BASE_RETAIN_MINUTES
- See Also:
- Constant Field Values
-
-
Method Detail
-
record
void record(java.lang.String metricId, com.codahale.metrics.Metric metric)
-
record
void record(java.lang.String metricId, com.codahale.metrics.Metric metric, int pollRateMillis, int retainMinutes)
-
stopRecording
void stopRecording(java.lang.String metricId)
-
registerGauge
void registerGauge(com.codahale.metrics.Gauge<java.lang.Double> gauge, java.lang.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<java.lang.Double> gauge, java.lang.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, java.lang.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, java.lang.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, java.lang.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, java.lang.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(java.lang.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
java.util.List<Datapoint> historyAll(java.lang.String metricName) throws java.sql.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:
java.sql.SQLException
-
historyMostRecent
java.util.List<Datapoint> historyMostRecent(java.lang.String metricName, int dataPoints) throws java.sql.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:
java.sql.SQLException
-
historyInterpolated
java.util.List<Datapoint> historyInterpolated(java.lang.String metricName, int density) throws java.sql.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:
java.sql.SQLException
-
historyAfterDate
java.util.List<Datapoint> historyAfterDate(java.lang.String metricName, java.util.Date date) throws java.sql.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:
java.sql.SQLException
-
isRegistered
boolean isRegistered(java.lang.String metricName)
- Returns:
- true if the metric with the passed name is currently registered with the metric history system
-
-