View Javadoc

1   /**
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *     http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing, software
13   * distributed under the License is distributed on an "AS IS" BASIS,
14   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15   * See the License for the specific language governing permissions and
16   * limitations under the License.
17   */
18  package org.apache.hadoop.hbase.metrics;
19  
20  import org.apache.hadoop.hbase.HBaseInterfaceAudience;
21  import org.apache.hadoop.hbase.classification.InterfaceAudience;
22  import org.apache.hadoop.hbase.classification.InterfaceStability;
23  
24  /**
25   * A metric which measure the rate at which some operation is invoked.
26   */
27  @InterfaceAudience.LimitedPrivate(HBaseInterfaceAudience.COPROC)
28  @InterfaceStability.Evolving
29  public interface Meter extends Metric {
30  
31    /**
32     * Records one occurrence.
33     */
34    void mark();
35  
36    /**
37     * Records {@code events} occurrences.
38     *
39     * @param events Number of occurrences to record.
40     */
41    void mark(long events);
42  
43    /**
44     * Returns the number of events.
45     * @return the number of events.
46     */
47    long getCount();
48  
49    /**
50     * Returns the mean rate at which events have occurred since the meter was created.
51     * @return the mean rate at which events have occurred since the meter was created
52     */
53    double getMeanRate();
54  
55    /**
56     * Returns the one-minute exponentially-weighted moving average rate at which events have
57     * occurred since the meter was created.
58     * <p/>
59     * This rate has the same exponential decay factor as the one-minute load average in the {@code
60     * top} Unix command.
61     *
62     * @return the one-minute exponentially-weighted moving average rate at which events have
63     *         occurred since the meter was created
64     */
65    double getOneMinuteRate();
66  
67    /**
68     * Returns the five-minute exponentially-weighted moving average rate at which events have
69     * occurred since the meter was created.
70     * <p/>
71     * This rate has the same exponential decay factor as the five-minute load average in the {@code
72     * top} Unix command.
73     *
74     * @return the five-minute exponentially-weighted moving average rate at which events have
75     *         occurred since the meter was created
76     */
77    double getFiveMinuteRate();
78  
79    /**
80     * Returns the fifteen-minute exponentially-weighted moving average rate at which events have
81     * occurred since the meter was created.
82     * <p/>
83     * This rate has the same exponential decay factor as the fifteen-minute load average in the
84     * {@code top} Unix command.
85     *
86     * @return the fifteen-minute exponentially-weighted moving average rate at which events have
87     *         occurred since the meter was created
88     */
89    double getFifteenMinuteRate();
90  }