View Javadoc

1   // Autogenerated Jamon implementation
2   // /home/jenkins/jenkins-slave/workspace/hbase_generate_website/hbase/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/regionserver/RegionListTmpl.jamon
3   
4   package org.apache.hadoop.hbase.tmpl.regionserver;
5   
6   // 24, 9
7   import java.util.*;
8   // 25, 9
9   import org.apache.hadoop.hbase.regionserver.HRegionServer;
10  // 26, 9
11  import org.apache.hadoop.hbase.util.Bytes;
12  // 27, 9
13  import org.apache.hadoop.hbase.HRegionInfo;
14  // 28, 9
15  import org.apache.hadoop.hbase.regionserver.Region;
16  // 29, 9
17  import org.apache.hadoop.hbase.ServerName;
18  // 30, 9
19  import org.apache.hadoop.hbase.HBaseConfiguration;
20  // 31, 9
21  import org.apache.hadoop.hbase.protobuf.ProtobufUtil;
22  // 32, 9
23  import org.apache.hadoop.hbase.protobuf.generated.AdminProtos.ServerInfo;
24  // 33, 9
25  import org.apache.hadoop.hbase.protobuf.generated.ClusterStatusProtos.RegionLoad;
26  // 34, 9
27  import org.apache.hadoop.hbase.client.RegionReplicaUtil;
28  // 35, 9
29  import org.apache.hadoop.hbase.regionserver.MetricsRegionWrapper;
30  // 36, 9
31  import org.apache.hadoop.util.StringUtils.TraditionalBinaryPrefix;
32  
33  public class RegionListTmplImpl
34    extends org.jamon.AbstractTemplateImpl
35    implements org.apache.hadoop.hbase.tmpl.regionserver.RegionListTmpl.Intf
36  
37  {
38    private final HRegionServer regionServer;
39    private final List<HRegionInfo> onlineRegions;
40    protected static org.apache.hadoop.hbase.tmpl.regionserver.RegionListTmpl.ImplData __jamon_setOptionalArguments(org.apache.hadoop.hbase.tmpl.regionserver.RegionListTmpl.ImplData p_implData)
41    {
42      return p_implData;
43    }
44    public RegionListTmplImpl(org.jamon.TemplateManager p_templateManager, org.apache.hadoop.hbase.tmpl.regionserver.RegionListTmpl.ImplData p_implData)
45    {
46      super(p_templateManager, __jamon_setOptionalArguments(p_implData));
47      regionServer = p_implData.getRegionServer();
48      onlineRegions = p_implData.getOnlineRegions();
49    }
50    
51    @Override public void renderNoFlush(final java.io.Writer jamonWriter)
52      throws java.io.IOException
53    {
54      // 38, 1
55      if ((onlineRegions != null && onlineRegions.size() > 0) )
56      {
57        // 38, 60
58        jamonWriter.write("\n\n    ");
59        // 40, 5
60        
61          Collections.sort(onlineRegions);
62      
63        // 44, 5
64        jamonWriter.write("<div class=\"tabbable\">\n        <ul class=\"nav nav-pills\">\n            <li class=\"active\"><a href=\"#tab_regionBaseInfo\" data-toggle=\"tab\">Base Info</a> </li>\n            <li><a href=\"#tab_regionRequestStats\" data-toggle=\"tab\">Request metrics</a></li>\n            <li class=\"\"><a href=\"#tab_regionStoreStats\" data-toggle=\"tab\">Storefile Metrics</a></li>\n            <li class=\"\"><a href=\"#tab_regionMemstoreStats\" data-toggle=\"tab\">Memstore Metrics</a></li>\n            <li class=\"\"><a href=\"#tab_regionCompactStats\" data-toggle=\"tab\">Compaction Metrics</a></li>\n        </ul>\n        <div class=\"tab-content\" style=\"padding-bottom: 9px; border-bottom: 1px solid #ddd;\">\n            <div class=\"tab-pane active\" id=\"tab_regionBaseInfo\">\n                ");
65        // 54, 17
66        {
67          // 54, 17
68          __jamon_innerUnit__baseInfo(jamonWriter, onlineRegions);
69        }
70        // 54, 63
71        jamonWriter.write("\n            </div>\n            <div class=\"tab-pane\" id=\"tab_regionRequestStats\">\n                ");
72        // 57, 17
73        {
74          // 57, 17
75          __jamon_innerUnit__requestStats(jamonWriter, onlineRegions);
76        }
77        // 57, 67
78        jamonWriter.write("\n            </div>\n            <div class=\"tab-pane\" id=\"tab_regionStoreStats\">\n                ");
79        // 60, 17
80        {
81          // 60, 17
82          __jamon_innerUnit__storeStats(jamonWriter, onlineRegions);
83        }
84        // 60, 65
85        jamonWriter.write("\n            </div>\n            <div class=\"tab-pane\" id=\"tab_regionMemstoreStats\">\n                ");
86        // 63, 17
87        {
88          // 63, 17
89          __jamon_innerUnit__memstoreStats(jamonWriter, onlineRegions);
90        }
91        // 63, 68
92        jamonWriter.write("\n            </div>\n            <div class=\"tab-pane\" id=\"tab_regionCompactStats\">\n                ");
93        // 66, 17
94        {
95          // 66, 17
96          __jamon_innerUnit__compactStats(jamonWriter, onlineRegions);
97        }
98        // 66, 67
99        jamonWriter.write("\n            </div>\n        </div>\n    </div>\n    <p>Region names are made of the containing table's name, a comma,\n    the start key, a comma, and a randomly generated region id.  To illustrate,\n    the region named\n    <em>domains,apache.org,5464829424211263407</em> is party to the table\n    <em>domains</em>, has an id of <em>5464829424211263407</em> and the first key\n    in the region is <em>apache.org</em>.  The <em>hbase:meta</em> 'table' is an internal\n    system table (or a 'catalog' table in db-speak).\n    The hbase:meta table keeps a list of all regions in the system. The empty key is used to denote\n    table start and table end.  A region with an empty start key is the first region in a table.\n    If a region has both an empty start key and an empty end key, it's the only region in the\n    table. See <a href=\"http://hbase.org\">HBase Home</a> for further explication.<p>\n");
100     }
101     // 81, 1
102     else
103     {
104       // 81, 8
105       jamonWriter.write("\n    <p>Not serving regions</p>\n");
106     }
107     // 83, 7
108     jamonWriter.write("\n\n");
109   }
110   
111   
112   // 114, 1
113   private void __jamon_innerUnit__requestStats(final java.io.Writer jamonWriter, final List<HRegionInfo> onlineRegions)
114     throws java.io.IOException
115   {
116     // 118, 5
117     jamonWriter.write("<table class=\"table table-striped\">\n        <tr>\n            <th>Region Name</th>\n            <th>Read Request Count</th>\n            <th>Filtered Read Request Count</th>\n            <th>Write Request Count</th>\n        </tr>\n\n        ");
118     // 126, 9
119     for (HRegionInfo r: onlineRegions )
120     {
121       // 126, 46
122       jamonWriter.write("\n\n        <tr>\n        ");
123       // 129, 9
124       
125             RegionLoad load = regionServer.createRegionLoad(r.getEncodedName());
126             String displayName = HRegionInfo.getRegionNameAsStringForDisplay(r,
127               regionServer.getConfiguration());
128         
129       // 134, 13
130       jamonWriter.write("<td><a href=\"region.jsp?name=");
131       // 134, 42
132       org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(r.getEncodedName()), jamonWriter);
133       // 134, 66
134       jamonWriter.write("\">");
135       // 134, 68
136       org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(displayName), jamonWriter);
137       // 134, 85
138       jamonWriter.write("</a></td>\n            ");
139       // 135, 13
140       if (load != null )
141       {
142         // 135, 33
143         jamonWriter.write("\n            <td>");
144         // 136, 17
145         org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(load.getReadRequestsCount()), jamonWriter);
146         // 136, 50
147         jamonWriter.write("</td>\n            <td>");
148         // 137, 17
149         org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(load.getFilteredReadRequestsCount()), jamonWriter);
150         // 137, 58
151         jamonWriter.write("</td>\n            <td>");
152         // 138, 17
153         org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(load.getWriteRequestsCount()), jamonWriter);
154         // 138, 51
155         jamonWriter.write("</td>\n            ");
156       }
157       // 139, 19
158       jamonWriter.write("\n        </tr>\n        ");
159     }
160     // 141, 16
161     jamonWriter.write("\n    </table>\n");
162   }
163   
164   
165   // 226, 1
166   private void __jamon_innerUnit__memstoreStats(final java.io.Writer jamonWriter, final List<HRegionInfo> onlineRegions)
167     throws java.io.IOException
168   {
169     // 230, 5
170     jamonWriter.write("<table class=\"table table-striped\">\n        <tr>\n            <th>Region Name</th>\n            <th>Memstore Size</th>\n        </tr>\n\n        ");
171     // 236, 9
172     for (HRegionInfo r: onlineRegions )
173     {
174       // 236, 46
175       jamonWriter.write("\n\n        <tr>\n        ");
176       // 239, 9
177       
178             RegionLoad load = regionServer.createRegionLoad(r.getEncodedName());
179             String displayName = HRegionInfo.getRegionNameAsStringForDisplay(r,
180               regionServer.getConfiguration());
181         
182       // 244, 13
183       jamonWriter.write("<td><a href=\"region.jsp?name=");
184       // 244, 42
185       org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(r.getEncodedName()), jamonWriter);
186       // 244, 66
187       jamonWriter.write("\">");
188       // 244, 68
189       org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(displayName), jamonWriter);
190       // 244, 85
191       jamonWriter.write("</a></td>\n            ");
192       // 245, 13
193       if (load != null )
194       {
195         // 245, 33
196         jamonWriter.write("\n            <td>");
197         // 246, 17
198         org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(TraditionalBinaryPrefix.long2String(
199                 load.getMemstoreSizeMB() * TraditionalBinaryPrefix.MEGA.value, "B", 1)), jamonWriter);
200         // 247, 90
201         jamonWriter.write("</td>\n            ");
202       }
203       // 248, 19
204       jamonWriter.write("\n        </tr>\n        ");
205     }
206     // 250, 16
207     jamonWriter.write("\n    </table>\n");
208   }
209   
210   
211   // 190, 1
212   private void __jamon_innerUnit__compactStats(final java.io.Writer jamonWriter, final List<HRegionInfo> onlineRegions)
213     throws java.io.IOException
214   {
215     // 194, 5
216     jamonWriter.write("<table class=\"table table-striped\">\n        <tr>\n            <th>Region Name</th>\n            <th>Num. Compacting KVs</th>\n            <th>Num. Compacted KVs</th>\n            <th>Compaction Progress</th>\n        </tr>\n\n        ");
217     // 202, 9
218     for (HRegionInfo r: onlineRegions )
219     {
220       // 202, 46
221       jamonWriter.write("\n\n        <tr>\n        ");
222       // 205, 9
223       
224             RegionLoad load = regionServer.createRegionLoad(r.getEncodedName());
225             String percentDone = "";
226             if  (load != null && load.getTotalCompactingKVs() > 0) {
227             percentDone = String.format("%.2f", 100 *
228             ((float) load.getCurrentCompactedKVs() / load.getTotalCompactingKVs())) + "%";
229             }
230             String displayName = HRegionInfo.getRegionNameAsStringForDisplay(r,
231               regionServer.getConfiguration());
232         
233       // 215, 13
234       jamonWriter.write("<td><a href=\"region.jsp?name=");
235       // 215, 42
236       org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(r.getEncodedName()), jamonWriter);
237       // 215, 66
238       jamonWriter.write("\">");
239       // 215, 68
240       org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(displayName), jamonWriter);
241       // 215, 85
242       jamonWriter.write("</a></td>\n            ");
243       // 216, 13
244       if (load != null )
245       {
246         // 216, 33
247         jamonWriter.write("\n            <td>");
248         // 217, 17
249         org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(load.getTotalCompactingKVs()), jamonWriter);
250         // 217, 51
251         jamonWriter.write("</td>\n            <td>");
252         // 218, 17
253         org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(load.getCurrentCompactedKVs()), jamonWriter);
254         // 218, 52
255         jamonWriter.write("</td>\n            <td>");
256         // 219, 17
257         org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(percentDone), jamonWriter);
258         // 219, 34
259         jamonWriter.write("</td>\n            ");
260       }
261       // 220, 19
262       jamonWriter.write("\n        </tr>\n        ");
263     }
264     // 222, 16
265     jamonWriter.write("\n    </table>\n");
266   }
267   
268   
269   // 85, 1
270   private void __jamon_innerUnit__baseInfo(final java.io.Writer jamonWriter, final List<HRegionInfo> onlineRegions)
271     throws java.io.IOException
272   {
273     // 89, 5
274     jamonWriter.write("<table class=\"table table-striped\">\n        <tr>\n            <th>Region Name</th>\n            <th>Start Key</th>\n            <th>End Key</th>\n            <th>ReplicaID</th>\n        </tr>\n\n        ");
275     // 97, 9
276     for (HRegionInfo r: onlineRegions )
277     {
278       // 97, 46
279       jamonWriter.write("\n        <tr>\n            ");
280       // 99, 13
281       
282              String displayName = HRegionInfo.getRegionNameAsStringForDisplay(r,
283                regionServer.getConfiguration());
284             
285       // 103, 13
286       jamonWriter.write("<td><a href=\"region.jsp?name=");
287       // 103, 42
288       org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(r.getEncodedName()), jamonWriter);
289       // 103, 66
290       jamonWriter.write("\">");
291       // 103, 68
292       org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(displayName), jamonWriter);
293       // 103, 85
294       jamonWriter.write("</a></td>\n            <td>");
295       // 104, 17
296       org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(Bytes.toStringBinary(HRegionInfo.getStartKeyForDisplay(r,
297                                         regionServer.getConfiguration()))), jamonWriter);
298       // 105, 77
299       jamonWriter.write("</td>\n            <td>");
300       // 106, 17
301       org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(Bytes.toStringBinary(HRegionInfo.getEndKeyForDisplay(r,
302                                         regionServer.getConfiguration()))), jamonWriter);
303       // 107, 77
304       jamonWriter.write("</td>\n            <td>");
305       // 108, 17
306       org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(r.getReplicaId()), jamonWriter);
307       // 108, 39
308       jamonWriter.write("</td>\n        </tr>\n        ");
309     }
310     // 110, 16
311     jamonWriter.write("\n    </table>\n");
312   }
313   
314   
315   // 146, 1
316   private void __jamon_innerUnit__storeStats(final java.io.Writer jamonWriter, final List<HRegionInfo> onlineRegions)
317     throws java.io.IOException
318   {
319     // 150, 5
320     jamonWriter.write("<table class=\"table table-striped\">\n        <tr>\n            <th>Region Name</th>\n            <th>Num. Stores</th>\n            <th>Num. Storefiles</th>\n            <th>Storefile Size Uncompressed</th>\n            <th>Storefile Size</th>\n            <th>Index Size</th>\n            <th>Bloom Size</th>\n            <th>Data Locality</th>\n        </tr>\n\n        ");
321     // 162, 9
322     for (HRegionInfo r: onlineRegions )
323     {
324       // 162, 46
325       jamonWriter.write("\n\n        <tr>\n        ");
326       // 165, 9
327       
328             RegionLoad load = regionServer.createRegionLoad(r.getEncodedName());
329             String displayName = HRegionInfo.getRegionNameAsStringForDisplay(r,
330               regionServer.getConfiguration());
331         
332       // 170, 13
333       jamonWriter.write("<td><a href=\"region.jsp?name=");
334       // 170, 42
335       org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(r.getEncodedName()), jamonWriter);
336       // 170, 66
337       jamonWriter.write("\">");
338       // 170, 68
339       org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(displayName), jamonWriter);
340       // 170, 85
341       jamonWriter.write("</a></td>\n            ");
342       // 171, 13
343       if (load != null )
344       {
345         // 171, 33
346         jamonWriter.write("\n            <td>");
347         // 172, 17
348         org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(load.getStores()), jamonWriter);
349         // 172, 39
350         jamonWriter.write("</td>\n            <td>");
351         // 173, 17
352         org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(load.getStorefiles()), jamonWriter);
353         // 173, 43
354         jamonWriter.write("</td>\n            <td>");
355         // 174, 17
356         org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(TraditionalBinaryPrefix.long2String(load.getStoreUncompressedSizeMB()
357                 * TraditionalBinaryPrefix.MEGA.value, "B", 1)), jamonWriter);
358         // 175, 64
359         jamonWriter.write("</td>\n            <td>");
360         // 176, 17
361         org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(TraditionalBinaryPrefix.long2String(load.getStorefileSizeMB()
362                 * TraditionalBinaryPrefix.MEGA.value, "B", 1)), jamonWriter);
363         // 177, 65
364         jamonWriter.write("</td>\n            <td>");
365         // 178, 17
366         org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(TraditionalBinaryPrefix.long2String(load.getTotalStaticIndexSizeKB()
367                 * TraditionalBinaryPrefix.KILO.value, "B", 1)), jamonWriter);
368         // 179, 65
369         jamonWriter.write("</td>\n            <td>");
370         // 180, 17
371         org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(TraditionalBinaryPrefix.long2String(load.getTotalStaticBloomSizeKB()
372                 * TraditionalBinaryPrefix.KILO.value, "B", 1)), jamonWriter);
373         // 181, 65
374         jamonWriter.write("</td>\n            <td>");
375         // 182, 17
376         org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(load.getDataLocality()), jamonWriter);
377         // 182, 45
378         jamonWriter.write("</td>\n            ");
379       }
380       // 183, 19
381       jamonWriter.write("\n        </tr>\n        ");
382     }
383     // 185, 16
384     jamonWriter.write("\n    </table>\n");
385   }
386   
387   
388 }