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
FieldsModifier and TypeFieldDescriptionstatic final int
static final int
-
Method Summary
Modifier and TypeMethodDescriptionhistoryAfterDate
(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
void
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
stopRecording
(String metricId) void
unregisterMetric
(String metricPath) Removes the metric this history manager.
-
Field Details
-
BASE_UPDATE_MILLIS
static final int BASE_UPDATE_MILLIS- See Also:
-
BASE_RETAIN_MINUTES
static final int BASE_RETAIN_MINUTES- See Also:
-
-
Method Details
-
record
-
record
void record(String metricId, com.codahale.metrics.Metric metric, int pollRateMillis, int retainMinutes) -
stopRecording
-
registerGauge
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
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
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
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
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
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
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
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
- Returns:
- true if the metric with the passed name is currently registered with the metric history system
-