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.regionserver;
20
21 /**
22 * Interface of class that will wrap an HRegion and export numbers so they can be
23 * used in MetricsRegionSource
24 */
25 public interface MetricsRegionWrapper {
26
27 /**
28 * Get the name of the table the region belongs to.
29 *
30 * @return The string version of the table name.
31 */
32 String getTableName();
33
34 /**
35 * Get the name of the namespace this table is in.
36 * @return String version of the namespace. Can't be empty.
37 */
38 String getNamespace();
39
40 /**
41 * Get the name of the region.
42 *
43 * @return The encoded name of the region.
44 */
45 String getRegionName();
46
47 /**
48 * Get the number of stores hosted on this region server.
49 */
50 long getNumStores();
51
52 /**
53 * Get the number of store files hosted on this region server.
54 */
55 long getNumStoreFiles();
56
57 /**
58 * Get the size of the memstore on this region server.
59 */
60 long getMemstoreSize();
61
62 /**
63 * Get the total size of the store files this region server is serving from.
64 */
65 long getStoreFileSize();
66
67 /**
68 * Get the total number of read requests that have been issued against this region
69 */
70 long getReadRequestCount();
71
72 /**
73 * @return Max age of store files under this region
74 */
75 long getMaxStoreFileAge();
76
77 /**
78 * @return Min age of store files under this region
79 */
80 long getMinStoreFileAge();
81
82 /**
83 * @return Average age of store files under this region
84 */
85 long getAvgStoreFileAge();
86
87 /**
88 * @return Number of reference files under this region
89 */
90 long getNumReferenceFiles();
91
92 /**
93 * Get the total number of mutations that have been issued against this region.
94 */
95 long getWriteRequestCount();
96
97 long getNumFilesCompacted();
98
99 long getNumBytesCompacted();
100
101 long getNumCompactionsCompleted();
102
103 /**
104 * @return Age of the last major compaction
105 */
106 long getLastMajorCompactionAge();
107
108 /**
109 * Returns the total number of compactions that have been reported as failed on this region.
110 * Note that a given compaction can be reported as both completed and failed if an exception
111 * is thrown in the processing after {@code HRegion.compact()}.
112 */
113 long getNumCompactionsFailed();
114
115 /**
116 * @return the total number of compactions that are currently queued(or being executed) at point in
117 * time
118 */
119 long getNumCompactionsQueued();
120
121 /**
122 * @return the total number of flushes currently queued(being executed) for this region at point in
123 * time
124 */
125 long getNumFlushesQueued();
126
127 /**
128 * @return the max number of compactions queued for this region
129 * Note that this metric is updated periodically and hence might miss some data points
130 */
131 long getMaxCompactionQueueSize();
132
133 /**
134 * @return the max number of flushes queued for this region
135 * Note that this metric is updated periodically and hence might miss some data points
136 */
137 long getMaxFlushQueueSize();
138
139 int getRegionHashCode();
140
141 /**
142 * Get the replica id of this region.
143 */
144 int getReplicaId();
145
146 /**
147 * @return the number of references active on the store
148 */
149 long getStoreRefCount();
150
151 /**
152 * @return the max number of references active on any store file among
153 * all compacted store files that belong to this region
154 */
155 int getMaxCompactedStoreFileRefCount();
156 }