blob: f978f6a65ad52463803d9065b826ccc92eef819b [file] [log] [blame]
Jian Li65f5aa22016-03-22 11:49:42 -07001/*
Brian O'Connor5ab426f2016-04-09 01:19:45 -07002 * Copyright 2016-present Open Networking Laboratory
Jian Li65f5aa22016-03-22 11:49:42 -07003 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16package org.onosproject.influxdbmetrics;
17
18import org.onosproject.cluster.NodeId;
19
20import java.util.List;
21import java.util.Map;
22import java.util.concurrent.TimeUnit;
23
24/**
25 * A Metric retriever interface for querying metrics value from influxDB server.
26 */
27public interface InfluxDbMetricsRetriever {
28
29 /**
30 * Returns last metric values from all nodes.
31 *
32 * @return all metrics from all nodes
33 */
34 Map<NodeId, Map<String, InfluxMetric>> allMetrics();
35
36 /**
37 * Returns last metric values from a node.
38 *
39 * @param nodeId node identification
40 * @return all metrics from a given node
41 */
42 Map<String, InfluxMetric> metricsByNodeId(NodeId nodeId);
43
44 /**
45 * Returns a collection of last metric values from all nodes.
46 *
47 * @param metricName metric name
48 * @return a collection of metrics from all nodes
49 */
50 Map<NodeId, InfluxMetric> metricsByName(String metricName);
51
52 /**
53 * Returns a last metric value from a given node.
54 *
55 * @param nodeId node identification
56 * @param metricName metric name
57 * @return a metric value from a given node
58 */
59 InfluxMetric metric(NodeId nodeId, String metricName);
60
61 /**
62 * Returns metric values of all nodes within a given period of time.
63 *
64 * @param period projected period
65 * @param unit time unit
66 * @return all metric values of all nodes
67 */
68 Map<NodeId, Map<String, List<InfluxMetric>>> allMetrics(int period, TimeUnit unit);
69
70 /**
71 * Returns metric values of a node within a given period of time.
72 *
73 * @param nodeId node identification
74 * @param period projected period
75 * @param unit time unit
76 * @return metric value of a node
77 */
78 Map<String, List<InfluxMetric>> metricsByNodeId(NodeId nodeId, int period, TimeUnit unit);
79
80 /**
81 * Returns a collection of last metric values of all nodes within a given period of time.
82 *
83 * @param metricName metric name
84 * @param period projected period
85 * @param unit time unit
86 * @return metric value of all nodes
87 */
88 Map<NodeId, List<InfluxMetric>> metricsByName(String metricName, int period, TimeUnit unit);
89
90 /**
91 * Returns metric value of a given node within a given period of time.
92 *
93 * @param nodeId node identification
94 * @param metricName metric name
95 * @param period projected period
96 * @param unit time unit
97 * @return metric value of a node
98 */
99 List<InfluxMetric> metric(NodeId nodeId, String metricName, int period, TimeUnit unit);
Jian Libdfd37f2016-03-24 16:36:35 -0700100
101 /**
102 * Configures default parameters for influx database metrics retriever.
103 *
104 * @param address IP address of influxDB server
105 * @param port Port number of influxDB server
106 * @param database Database name of influxDB server
107 * @param username Username of influxDB server
108 * @param password Password of influxDB server
109 */
110 void config(String address, int port, String database, String username, String password);
Jian Li65f5aa22016-03-22 11:49:42 -0700111}