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