001/** 002 * Copyright The Apache Software Foundation 003 * 004 * Licensed to the Apache Software Foundation (ASF) under one 005 * or more contributor license agreements. See the NOTICE file 006 * distributed with this work for additional information 007 * regarding copyright ownership. The ASF licenses this file 008 * to you under the Apache License, Version 2.0 (the 009 * "License"); you may not use this file except in compliance 010 * with the License. You may obtain a copy of the License at 011 * 012 * http://www.apache.org/licenses/LICENSE-2.0 013 * 014 * Unless required by applicable law or agreed to in writing, software 015 * distributed under the License is distributed on an "AS IS" BASIS, 016 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 017 * See the License for the specific language governing permissions and 018 * limitations under the License. 019 */ 020 021package org.apache.hadoop.hbase; 022 023import java.util.Map; 024import org.apache.hadoop.hbase.util.Bytes; 025import org.apache.yetus.audience.InterfaceAudience; 026 027/** 028 * Encapsulates per-region load metrics. 029 */ 030@InterfaceAudience.Public 031public interface RegionMetrics { 032 033 /** 034 * @return the region name 035 */ 036 byte[] getRegionName(); 037 038 /** 039 * @return the number of stores 040 */ 041 int getStoreCount(); 042 043 /** 044 * @return the number of storefiles 045 */ 046 int getStoreFileCount(); 047 048 /** 049 * @return the total size of the storefiles 050 */ 051 Size getStoreFileSize(); 052 053 /** 054 * @return the memstore size 055 */ 056 Size getMemStoreSize(); 057 058 /** 059 * @return the number of read requests made to region 060 */ 061 long getReadRequestCount(); 062 063 /** 064 * @return the number of write requests made to region 065 */ 066 long getWriteRequestCount(); 067 068 /** 069 * @return the number of write requests and read requests made to region 070 */ 071 default long getRequestCount() { 072 return getReadRequestCount() + getWriteRequestCount(); 073 } 074 075 /** 076 * @return the region name as a string 077 */ 078 default String getNameAsString() { 079 return Bytes.toStringBinary(getRegionName()); 080 } 081 082 /** 083 * @return the number of filtered read requests made to region 084 */ 085 long getFilteredReadRequestCount(); 086 087 /** 088 * TODO: why we pass the same value to different counters? Currently, the value from 089 * getStoreFileIndexSize() is same with getStoreFileRootLevelIndexSize() 090 * see HRegionServer#createRegionLoad. 091 * @return The current total size of root-level indexes for the region 092 */ 093 Size getStoreFileIndexSize(); 094 095 /** 096 * @return The current total size of root-level indexes for the region 097 */ 098 Size getStoreFileRootLevelIndexSize(); 099 100 /** 101 * @return The total size of all index blocks, not just the root level 102 */ 103 Size getStoreFileUncompressedDataIndexSize(); 104 105 /** 106 * @return The total size of all Bloom filter blocks, not just loaded into the block cache 107 */ 108 Size getBloomFilterSize(); 109 110 /** 111 * @return the total number of cells in current compaction 112 */ 113 long getCompactingCellCount(); 114 115 /** 116 * @return the number of already compacted kvs in current compaction 117 */ 118 long getCompactedCellCount(); 119 120 /** 121 * This does not really belong inside RegionLoad but its being done in the name of expediency. 122 * @return the completed sequence Id for the region 123 */ 124 long getCompletedSequenceId(); 125 126 /** 127 * @return completed sequence id per store. 128 */ 129 Map<byte[], Long> getStoreSequenceId(); 130 131 132 /** 133 * @return the uncompressed size of the storefiles 134 */ 135 Size getUncompressedStoreFileSize(); 136 137 /** 138 * @return the data locality of region in the regionserver. 139 */ 140 float getDataLocality(); 141 142 /** 143 * @return the timestamp of the oldest hfile for any store of this region. 144 */ 145 long getLastMajorCompactionTimestamp(); 146 147}