Package org.onosproject.cpman
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(java.lang.String metricType)
Returns the latest metric update time.double
maxMetric(java.lang.String metricType)
Returns maximum metric value of a given metric type.java.lang.String
metricName()
Returns the metric name of this database.double[]
metrics(java.lang.String metricType)
Returns a collection of metric values of a given metric type for a day.double[]
metrics(java.lang.String metricType, long startTime, long endTime)
Returns a collection of metric values of a given metric type for a given period.double
minMetric(java.lang.String metricType)
Returns minimum metric value of a given metric type.double
recentMetric(java.lang.String metricType)
Returns most recent metric value of a given metric type.double[]
recentMetrics(java.lang.String metricType, int duration, java.util.concurrent.TimeUnit unit)
Return most recent metric values of a given metric type for a given period.java.lang.String
resourceName()
Returns the resource name of this database.void
updateMetric(java.lang.String metricType, double value)
Update metric value by specifying metric type.void
updateMetric(java.lang.String metricType, double value, long time)
Update metric value by specifying metric type in a certain time.void
updateMetrics(java.util.Map<java.lang.String,java.lang.Double> metrics)
Update metric values of a collection of metric types.void
updateMetrics(java.util.Map<java.lang.String,java.lang.Double> metrics, long time)
Update metric values of a collection of metric types.
-
-
-
Method Detail
-
metricName
java.lang.String metricName()
Returns the metric name of this database.- Returns:
- metric name
-
resourceName
java.lang.String resourceName()
Returns the resource name of this database.- Returns:
- resource name
-
updateMetric
void updateMetric(java.lang.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(java.lang.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 valuetime
- update time in seconds
-
updateMetrics
void updateMetrics(java.util.Map<java.lang.String,java.lang.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 valuetime
- update time in seconds
-
updateMetrics
void updateMetrics(java.util.Map<java.lang.String,java.lang.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(java.lang.String metricType)
Returns most recent metric value of a given metric type.- Parameters:
metricType
- metric type- Returns:
- metric value
-
recentMetrics
double[] recentMetrics(java.lang.String metricType, int duration, java.util.concurrent.TimeUnit unit)
Return most recent metric values of a given metric type for a given period.- Parameters:
metricType
- metric typeduration
- durationunit
- time unit- Returns:
- a collection of metric value
-
minMetric
double minMetric(java.lang.String metricType)
Returns minimum metric value of a given metric type.- Parameters:
metricType
- metric type- Returns:
- metric value
-
maxMetric
double maxMetric(java.lang.String metricType)
Returns maximum metric value of a given metric type.- Parameters:
metricType
- metric type- Returns:
- metric value
-
metrics
double[] metrics(java.lang.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(java.lang.String metricType, long startTime, long endTime)
Returns a collection of metric values of a given metric type for a given period.- Parameters:
metricType
- metric typestartTime
- start timeendTime
- end time- Returns:
- a collection of metric value
-
lastUpdate
long lastUpdate(java.lang.String metricType)
Returns the latest metric update time.- Parameters:
metricType
- metric type- Returns:
- timestamp
-
-