Jian Li | 65f5aa2 | 2016-03-22 11:49:42 -0700 | [diff] [blame] | 1 | /* |
Brian O'Connor | a09fe5b | 2017-08-03 21:12:30 -0700 | [diff] [blame] | 2 | * Copyright 2016-present Open Networking Foundation |
Jian Li | 65f5aa2 | 2016-03-22 11:49:42 -0700 | [diff] [blame] | 3 | * |
| 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 | */ |
| 16 | package org.onosproject.influxdbmetrics; |
| 17 | |
Yuta HIGUCHI | 0c47d53 | 2017-08-18 23:16:35 -0700 | [diff] [blame] | 18 | import java.time.Instant; |
Jian Li | 65f5aa2 | 2016-03-22 11:49:42 -0700 | [diff] [blame] | 19 | |
| 20 | /** |
| 21 | * Metric that represents all values queried from influx database. |
| 22 | */ |
| 23 | public interface InfluxMetric { |
| 24 | |
| 25 | /** |
| 26 | * Returns one minute rate of the given metric. |
| 27 | * |
| 28 | * @return one minute rate of the given metric |
| 29 | */ |
| 30 | double oneMinRate(); |
| 31 | |
| 32 | |
| 33 | /** |
| 34 | * Returns collected timestamp of the given metric. |
| 35 | * |
| 36 | * @return collected timestamp of the given metric |
| 37 | */ |
Yuta HIGUCHI | 0c47d53 | 2017-08-18 23:16:35 -0700 | [diff] [blame] | 38 | Instant time(); |
Jian Li | 65f5aa2 | 2016-03-22 11:49:42 -0700 | [diff] [blame] | 39 | |
| 40 | /** |
| 41 | * A builder of InfluxMetric. |
| 42 | */ |
| 43 | interface Builder { |
| 44 | |
| 45 | /** |
| 46 | * Sets one minute rate. |
| 47 | * |
| 48 | * @param rate one minute rate |
| 49 | * @return builder object |
| 50 | */ |
| 51 | Builder oneMinRate(double rate); |
| 52 | |
| 53 | /** |
| 54 | * Sets collected timestamp. |
| 55 | * |
| 56 | * @param time timestamp |
| 57 | * @return builder object |
| 58 | */ |
| 59 | Builder time(String time); |
| 60 | |
| 61 | /** |
| 62 | * Builds a influx metric instance. |
| 63 | * |
| 64 | * @return influx metric instance |
| 65 | */ |
| 66 | InfluxMetric build(); |
| 67 | } |
| 68 | } |