001/**
002 * Licensed to the Apache Software Foundation (ASF) under one
003 * or more contributor license agreements.  See the NOTICE file
004 * distributed with this work for additional information
005 * regarding copyright ownership.  The ASF licenses this file
006 * to you under the Apache License, Version 2.0 (the
007 * "License"); you may not use this file except in compliance
008 * with the License.  You may obtain a copy of the License at
009 *
010 *     http://www.apache.org/licenses/LICENSE-2.0
011 *
012 * Unless required by applicable law or agreed to in writing, software
013 * distributed under the License is distributed on an "AS IS" BASIS,
014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015 * See the License for the specific language governing permissions and
016 * limitations under the License.
017 */
018
019package org.apache.hadoop.hbase.regionserver;
020
021import java.util.Map;
022
023import org.apache.yetus.audience.InterfaceAudience;
024
025/**
026 * Interface of class that will wrap an HRegion and export numbers so they can be
027 * used in MetricsRegionSource
028 */
029@InterfaceAudience.Private
030public interface MetricsRegionWrapper {
031
032  /**
033   * Get the name of the table the region belongs to.
034   *
035   * @return The string version of the table name.
036   */
037  String getTableName();
038
039  /**
040   * Get the name of the namespace this table is in.
041   * @return String version of the namespace.  Can't be empty.
042   */
043  String getNamespace();
044
045  /**
046   * Get the name of the region.
047   *
048   * @return The encoded name of the region.
049   */
050  String getRegionName();
051
052  /**
053   * Get the number of stores hosted on this region server.
054   */
055  long getNumStores();
056
057  /**
058   * Get the number of store files hosted on this region server.
059   */
060  long getNumStoreFiles();
061
062  /**
063   * Get the size of the memstore on this region server.
064   */
065  long getMemStoreSize();
066
067  /**
068   * Get the total size of the store files this region server is serving from.
069   */
070  long getStoreFileSize();
071
072  /**
073   * Get the total number of read requests that have been issued against this region
074   */
075  long getReadRequestCount();
076
077  /**
078   * Get the total number of filtered read requests that have been issued against this region
079   */
080  long getFilteredReadRequestCount();
081
082  /**
083   * @return Max age of store files under this region
084   */
085  long getMaxStoreFileAge();
086
087  /**
088   * @return Min age of store files under this region
089   */
090  long getMinStoreFileAge();
091
092  /**
093   *  @return Average age of store files under this region
094   */
095  long getAvgStoreFileAge();
096
097  /**
098   *  @return Number of reference files under this region
099   */
100  long getNumReferenceFiles();
101
102  /**
103   * Get the total number of mutations that have been issued against this region.
104   */
105  long getWriteRequestCount();
106
107  long getTotalRequestCount();
108
109  long getNumFilesCompacted();
110
111  long getNumBytesCompacted();
112
113  long getNumCompactionsCompleted();
114
115  /**
116   *  @return Age of the last major compaction
117   */
118  long getLastMajorCompactionAge();
119
120  /**
121   * Returns the total number of compactions that have been reported as failed on this region.
122   * Note that a given compaction can be reported as both completed and failed if an exception
123   * is thrown in the processing after {@code HRegion.compact()}.
124   */
125  long getNumCompactionsFailed();
126
127  /**
128   * @return the total number of compactions that are currently queued(or being executed) at point in
129   *  time
130   */
131  long getNumCompactionsQueued();
132
133  /**
134   * @return the total number of flushes currently queued(being executed) for this region at point in
135   *  time
136   */
137  long getNumFlushesQueued();
138
139  /**
140   * @return the max number of compactions queued for this region
141   * Note that this metric is updated periodically and hence might miss some data points
142   */
143  long getMaxCompactionQueueSize();
144
145  /**
146   * @return the max number of flushes queued for this region
147   * Note that this metric is updated periodically and hence might miss some data points
148   */
149  long getMaxFlushQueueSize();
150
151  int getRegionHashCode();
152
153  /**
154   * Get the replica id of this region.
155   */
156  int getReplicaId();
157
158  /**
159   * @return the number of references active on the store
160   */
161  long getStoreRefCount();
162
163  /**
164   * @return the max number of references active on any store file among
165   *   all compacted store files that belong to this region
166   */
167  long getMaxCompactedStoreFileRefCount();
168
169  /**
170   * @return the number of row reads completely on memstore per store
171   */
172  Map<String, Long> getMemstoreOnlyRowReadsCount();
173
174  /**
175   * @return the number of row reads on memstore and file per store
176   */
177  Map<String, Long> getMixedRowReadsCount();
178
179}