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 size of the on heap memstore of this region 065 */ 066 long getMemStoreHeapSize(); 067 068 /** 069 * Get the size of the off heap memstore of this region 070 */ 071 long getMemStoreOffHeapSize(); 072 073 /** 074 * Get the total size of the store files this region server is serving from. 075 */ 076 long getStoreFileSize(); 077 078 /** 079 * Gets the current cache % ratio for this region. 080 */ 081 float getCurrentRegionCacheRatio(); 082 083 /** 084 * Gets the current cold data % ratio for this region. 085 */ 086 float getCurrentRegionColdDataRatio(); 087 088 /** 089 * Get the total number of read requests that have been issued against this region 090 */ 091 long getReadRequestCount(); 092 093 /** 094 * Get the total number of CoprocessorService requests that have been issued against this region 095 */ 096 long getCpRequestCount(); 097 098 /** 099 * Get the total number of filtered read requests that have been issued against this region 100 */ 101 long getFilteredReadRequestCount(); 102 103 /** Returns Max age of store files under this region */ 104 long getMaxStoreFileAge(); 105 106 /** Returns Min age of store files under this region */ 107 long getMinStoreFileAge(); 108 109 /** Returns Average age of store files under this region */ 110 long getAvgStoreFileAge(); 111 112 /** Returns Number of reference files under this region */ 113 long getNumReferenceFiles(); 114 115 /** 116 * Get the total number of mutations that have been issued against this region. 117 */ 118 long getWriteRequestCount(); 119 120 long getTotalRequestCount(); 121 122 long getNumFilesCompacted(); 123 124 long getNumBytesCompacted(); 125 126 long getNumCompactionsCompleted(); 127 128 /** Returns Age of the last major compaction */ 129 long getLastMajorCompactionAge(); 130 131 /** 132 * Returns the total number of compactions that have been reported as failed on this region. Note 133 * that a given compaction can be reported as both completed and failed if an exception is thrown 134 * in the processing after {@code HRegion.compact()}. 135 */ 136 long getNumCompactionsFailed(); 137 138 /** 139 * Returns the total number of compactions that are currently queued(or being executed) at point 140 * in time 141 */ 142 long getNumCompactionsQueued(); 143 144 /** 145 * Returns the total number of flushes currently queued(being executed) for this region at point 146 * in time 147 */ 148 long getNumFlushesQueued(); 149 150 /** 151 * Note that this metric is updated periodically and hence might miss some data points. 152 * @return the max number of compactions queued for this region 153 */ 154 long getMaxCompactionQueueSize(); 155 156 /** 157 * Note that this metric is updated periodically and hence might miss some data points. 158 * @return the max number of flushes queued for this region 159 */ 160 long getMaxFlushQueueSize(); 161 162 int getRegionHashCode(); 163 164 /** 165 * Get the replica id of this region. 166 */ 167 int getReplicaId(); 168 169 /** Returns the number of references active on the store */ 170 long getStoreRefCount(); 171 172 /** 173 * Returns the max number of references active on any store file among all compacted store files 174 * that belong to this region 175 */ 176 long getMaxCompactedStoreFileRefCount(); 177 178 /** Returns the number of row reads completely on memstore per store */ 179 Map<String, Long> getMemstoreOnlyRowReadsCount(); 180 181 /** Returns the number of row reads on memstore and file per store */ 182 Map<String, Long> getMixedRowReadsCount(); 183 184 /** 185 * Returns a hash of the table descriptor that this region was opened with. This hash uniquely 186 * identifies the table configuration (column families, compression, TTL, block size, etc.) and 187 * can be used to determine if a region needs to be reopened to pick up descriptor changes. 188 * @return hex-encoded hash of the serialized TableDescriptor 189 */ 190 String getTableDescriptorHash(); 191 192}