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 */
018package org.apache.hadoop.hbase.regionserver;
019
020import java.util.Map;
021import org.apache.yetus.audience.InterfaceAudience;
022
023/**
024 * Interface of class that will wrap an HRegion and export numbers so they can be used in
025 * MetricsRegionSource
026 */
027@InterfaceAudience.Private
028public interface MetricsRegionWrapper {
029
030  /**
031   * Get the name of the table the region belongs to.
032   * @return The string version of the table name.
033   */
034  String getTableName();
035
036  /**
037   * Get the name of the namespace this table is in.
038   * @return String version of the namespace. Can't be empty.
039   */
040  String getNamespace();
041
042  /**
043   * Get the name of the region.
044   * @return The encoded name of the region.
045   */
046  String getRegionName();
047
048  /**
049   * Get the number of stores hosted on this region server.
050   */
051  long getNumStores();
052
053  /**
054   * Get the number of store files hosted on this region server.
055   */
056  long getNumStoreFiles();
057
058  /**
059   * Get the size of the memstore on this region server.
060   */
061  long getMemStoreSize();
062
063  /**
064   * Get the total size of the store files this region server is serving from.
065   */
066  long getStoreFileSize();
067
068  /**
069   * Gets the current cache % ratio for this region.
070   */
071  float getCurrentRegionCacheRatio();
072
073  /**
074   * Get the total number of read requests that have been issued against this region
075   */
076  long getReadRequestCount();
077
078  /**
079   * Get the total number of CoprocessorService requests that have been issued against this region
080   */
081  long getCpRequestCount();
082
083  /**
084   * Get the total number of filtered read requests that have been issued against this region
085   */
086  long getFilteredReadRequestCount();
087
088  /** Returns Max age of store files under this region */
089  long getMaxStoreFileAge();
090
091  /** Returns Min age of store files under this region */
092  long getMinStoreFileAge();
093
094  /** Returns Average age of store files under this region */
095  long getAvgStoreFileAge();
096
097  /** Returns Number of reference files under this region */
098  long getNumReferenceFiles();
099
100  /**
101   * Get the total number of mutations that have been issued against this region.
102   */
103  long getWriteRequestCount();
104
105  long getTotalRequestCount();
106
107  long getNumFilesCompacted();
108
109  long getNumBytesCompacted();
110
111  long getNumCompactionsCompleted();
112
113  /** Returns Age of the last major compaction */
114  long getLastMajorCompactionAge();
115
116  /**
117   * Returns the total number of compactions that have been reported as failed on this region. Note
118   * that a given compaction can be reported as both completed and failed if an exception is thrown
119   * in the processing after {@code HRegion.compact()}.
120   */
121  long getNumCompactionsFailed();
122
123  /**
124   * Returns the total number of compactions that are currently queued(or being executed) at point
125   * in time
126   */
127  long getNumCompactionsQueued();
128
129  /**
130   * Returns the total number of flushes currently queued(being executed) for this region at point
131   * in time
132   */
133  long getNumFlushesQueued();
134
135  /**
136   * Note that this metric is updated periodically and hence might miss some data points.
137   * @return the max number of compactions queued for this region
138   */
139  long getMaxCompactionQueueSize();
140
141  /**
142   * Note that this metric is updated periodically and hence might miss some data points.
143   * @return the max number of flushes queued for this region
144   */
145  long getMaxFlushQueueSize();
146
147  int getRegionHashCode();
148
149  /**
150   * Get the replica id of this region.
151   */
152  int getReplicaId();
153
154  /** Returns the number of references active on the store */
155  long getStoreRefCount();
156
157  /**
158   * Returns the max number of references active on any store file among all compacted store files
159   * that belong to this region
160   */
161  long getMaxCompactedStoreFileRefCount();
162
163  /** Returns the number of row reads completely on memstore per store */
164  Map<String, Long> getMemstoreOnlyRowReadsCount();
165
166  /** Returns the number of row reads on memstore and file per store */
167  Map<String, Long> getMixedRowReadsCount();
168
169}