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.ExceptionTrackingSource;
22
23 /**
24 * Interface of a class that will export metrics about Thrift to hadoop's metrics2.
25 */
26 public interface MetricsThriftServerSource extends ExceptionTrackingSource {
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 String ACTIVE_WORKER_COUNT_KEY = "numActiveWorkers";
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 /**
80 * Increment number of active thrift workers.
81 */
82 void incActiveWorkerCount();
83
84 /**
85 * Decrement number of active thrift workers.
86 */
87 void decActiveWorkerCount();
88 }