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  
19  package org.apache.hadoop.hbase.thrift;
20  
21  import org.apache.hadoop.hbase.metrics.BaseSource;
22  import org.apache.hadoop.hbase.metrics.JvmPauseMonitorSource;
23  
24  /**
25   * Interface of a class that will export metrics about Thrift to hadoop's metrics2.
26   */
27  public interface MetricsThriftServerSource extends BaseSource, JvmPauseMonitorSource {
28  
29    String BATCH_GET_KEY = "batchGet";
30    String BATCH_MUTATE_KEY = "batchMutate";
31    String TIME_IN_QUEUE_KEY = "timeInQueue";
32    String THRIFT_CALL_KEY = "thriftCall";
33    String SLOW_THRIFT_CALL_KEY = "slowThriftCall";
34    String CALL_QUEUE_LEN_KEY = "callQueueLen";
35  
36    /**
37     * Add how long an operation was in the queue.
38     * @param time
39     */
40    void incTimeInQueue(long time);
41  
42    /**
43     * Set the call queue length.
44     * @param len Time
45     */
46    void setCallQueueLen(int len);
47  
48    /**
49     * Add how many keys were in a batch get.
50     * @param diff Num Keys
51     */
52    void incNumRowKeysInBatchGet(int diff);
53  
54    /**
55     * Add how many keys were in a batch mutate.
56     * @param diff Num Keys
57     */
58    void incNumRowKeysInBatchMutate(int diff);
59  
60    /**
61     * Add how long a method took
62     * @param name Method name
63     * @param time Time
64     */
65    void incMethodTime(String name, long time);
66  
67    /**
68     * Add how long a call took
69     * @param time Time
70     */
71    void incCall(long time);
72  
73    /**
74     * Increment how long a slow call took.
75     * @param time Time
76     */
77    void incSlowCall(long time);
78  
79  }