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 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 ExceptionTrackingSource, 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 String ACTIVE_WORKER_COUNT_KEY = "numActiveWorkers";
36
37 /**
38 * Add how long an operation was in the queue.
39 * @param time
40 */
41 void incTimeInQueue(long time);
42
43 /**
44 * Set the call queue length.
45 * @param len Time
46 */
47 void setCallQueueLen(int len);
48
49 /**
50 * Add how many keys were in a batch get.
51 * @param diff Num Keys
52 */
53 void incNumRowKeysInBatchGet(int diff);
54
55 /**
56 * Add how many keys were in a batch mutate.
57 * @param diff Num Keys
58 */
59 void incNumRowKeysInBatchMutate(int diff);
60
61 /**
62 * Add how long a method took
63 * @param name Method name
64 * @param time Time
65 */
66 void incMethodTime(String name, long time);
67
68 /**
69 * Add how long a call took
70 * @param time Time
71 */
72 void incCall(long time);
73
74 /**
75 * Increment how long a slow call took.
76 * @param time Time
77 */
78 void incSlowCall(long time);
79
80 /**
81 * Increment number of active thrift workers.
82 */
83 void incActiveWorkerCount();
84
85 /**
86 * Decrement number of active thrift workers.
87 */
88 void decActiveWorkerCount();
89 }