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.HashMap; 021import java.util.Map; 022 023public class MetricsRegionWrapperStub implements MetricsRegionWrapper { 024 int replicaid = 0; 025 026 /** 027 * Replica ID set to 0 028 */ 029 public MetricsRegionWrapperStub() { 030 this.replicaid = 0; 031 } 032 033 /** 034 * Pass in replica ID 035 */ 036 public MetricsRegionWrapperStub(int replicaid) { 037 this.replicaid = replicaid; 038 } 039 040 @Override 041 public String getTableName() { 042 return "MetricsRegionWrapperStub"; 043 } 044 045 @Override 046 public String getNamespace() { 047 return "TestNS"; 048 } 049 050 @Override 051 public String getRegionName() { 052 return "DEADBEEF001"; 053 } 054 055 @Override 056 public long getNumStores() { 057 return 101; 058 } 059 060 @Override 061 public long getNumStoreFiles() { 062 return 102; 063 } 064 065 @Override 066 public long getStoreRefCount() { 067 return 0; 068 } 069 070 @Override 071 public long getMaxCompactedStoreFileRefCount() { 072 return 0; 073 } 074 075 @Override 076 public long getMemStoreSize() { 077 return 103; 078 } 079 080 @Override 081 public long getStoreFileSize() { 082 return 104; 083 } 084 085 @Override 086 public float getCurrentRegionCacheRatio() { 087 return 0; 088 } 089 090 @Override 091 public long getReadRequestCount() { 092 return 105; 093 } 094 095 @Override 096 public long getFilteredReadRequestCount() { 097 return 107; 098 } 099 100 @Override 101 public long getMaxStoreFileAge() { 102 return 2; 103 } 104 105 @Override 106 public long getMinStoreFileAge() { 107 return 2; 108 } 109 110 @Override 111 public long getAvgStoreFileAge() { 112 return 2; 113 } 114 115 @Override 116 public long getNumReferenceFiles() { 117 return 2; 118 } 119 120 @Override 121 public long getCpRequestCount() { 122 return 108; 123 } 124 125 @Override 126 public long getWriteRequestCount() { 127 return 106; 128 } 129 130 @Override 131 public long getNumFilesCompacted() { 132 return 0; 133 } 134 135 @Override 136 public long getNumBytesCompacted() { 137 return 0; 138 } 139 140 @Override 141 public long getNumCompactionsCompleted() { 142 return 0; 143 } 144 145 @Override 146 public long getLastMajorCompactionAge() { 147 return 0; 148 } 149 150 @Override 151 public long getNumCompactionsFailed() { 152 return 0; 153 } 154 155 @Override 156 public int getRegionHashCode() { 157 return 42; 158 } 159 160 /** 161 * Get the replica id of this region. 162 */ 163 @Override 164 public int getReplicaId() { 165 return replicaid; 166 } 167 168 @Override 169 public long getNumCompactionsQueued() { 170 return 4; 171 } 172 173 @Override 174 public long getNumFlushesQueued() { 175 return 6; 176 } 177 178 @Override 179 public long getMaxCompactionQueueSize() { 180 return 4; 181 } 182 183 @Override 184 public long getMaxFlushQueueSize() { 185 return 6; 186 } 187 188 @Override 189 public long getTotalRequestCount() { 190 return 0; 191 } 192 193 @Override 194 public Map<String, Long> getMemstoreOnlyRowReadsCount() { 195 Map<String, Long> map = new HashMap<>(); 196 map.put("info", 0L); 197 return map; 198 } 199 200 @Override 201 public Map<String, Long> getMixedRowReadsCount() { 202 Map<String, Long> map = new HashMap<>(); 203 map.put("info", 0L); 204 return map; 205 } 206}