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   // 85, 1
113   private void __jamon_innerUnit__baseInfo(final java.io.Writer jamonWriter, final List<HRegionInfo> onlineRegions)
114     throws java.io.IOException
115   {
116     // 89, 5
117     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        ");
118     // 97, 9
119     for (HRegionInfo r: onlineRegions )
120     {
121       // 97, 46
122       jamonWriter.write("\n        <tr>\n            ");
123       // 99, 13
124       
125              String displayName = HRegionInfo.getRegionNameAsStringForDisplay(r,
126                regionServer.getConfiguration());
127
128       // 103, 13
129       jamonWriter.write("<td><a href=\"region.jsp?name=");
130       // 103, 42
131       org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(r.getEncodedName()), jamonWriter);
132       // 103, 66
133       jamonWriter.write("\">");
134       // 103, 68
135       org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(displayName), jamonWriter);
136       // 103, 85
137       jamonWriter.write("</a></td>\n            <td>");
138       // 104, 17
139       org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(Bytes.toStringBinary(HRegionInfo.getStartKeyForDisplay(r,
140                                         regionServer.getConfiguration()))), jamonWriter);
141       // 105, 77
142       jamonWriter.write("</td>\n            <td>");
143       // 106, 17
144       org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(Bytes.toStringBinary(HRegionInfo.getEndKeyForDisplay(r,
145                                         regionServer.getConfiguration()))), jamonWriter);
146       // 107, 77
147       jamonWriter.write("</td>\n            <td>");
148       // 108, 17
149       org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(r.getReplicaId()), jamonWriter);
150       // 108, 39
151       jamonWriter.write("</td>\n        </tr>\n        ");
152     }
153     // 110, 16
154     jamonWriter.write("\n    </table>\n");
155   }
156
157
158   // 146, 1
159   private void __jamon_innerUnit__storeStats(final java.io.Writer jamonWriter, final List<HRegionInfo> onlineRegions)
160     throws java.io.IOException
161   {
162     // 150, 5
163     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        ");
164     // 162, 9
165     for (HRegionInfo r: onlineRegions )
166     {
167       // 162, 46
168       jamonWriter.write("\n\n        <tr>\n        ");
169       // 165, 9
170
171             RegionLoad load = regionServer.createRegionLoad(r.getEncodedName());
172             String displayName = HRegionInfo.getRegionNameAsStringForDisplay(r,
173               regionServer.getConfiguration());
174
175       // 170, 13
176       jamonWriter.write("<td><a href=\"region.jsp?name=");
177       // 170, 42
178       org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(r.getEncodedName()), jamonWriter);
179       // 170, 66
180       jamonWriter.write("\">");
181       // 170, 68
182       org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(displayName), jamonWriter);
183       // 170, 85
184       jamonWriter.write("</a></td>\n            ");
185       // 171, 13
186       if (load != null )
187       {
188         // 171, 33
189         jamonWriter.write("\n            <td>");
190         // 172, 17
191         org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(load.getStores()), jamonWriter);
192         // 172, 39
193         jamonWriter.write("</td>\n            <td>");
194         // 173, 17
195         org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(load.getStorefiles()), jamonWriter);
196         // 173, 43
197         jamonWriter.write("</td>\n            <td>");
198         // 174, 17
199         org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(TraditionalBinaryPrefix.long2String(load.getStoreUncompressedSizeMB()
200                 * TraditionalBinaryPrefix.MEGA.value, "B", 1)), jamonWriter);
201         // 175, 64
202         jamonWriter.write("</td>\n            <td>");
203         // 176, 17
204         org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(TraditionalBinaryPrefix.long2String(load.getStorefileSizeMB()
205                 * TraditionalBinaryPrefix.MEGA.value, "B", 1)), jamonWriter);
206         // 177, 65
207         jamonWriter.write("</td>\n            <td>");
208         // 178, 17
209         org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(TraditionalBinaryPrefix.long2String(load.getTotalStaticIndexSizeKB()
210                 * TraditionalBinaryPrefix.KILO.value, "B", 1)), jamonWriter);
211         // 179, 65
212         jamonWriter.write("</td>\n            <td>");
213         // 180, 17
214         org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(TraditionalBinaryPrefix.long2String(load.getTotalStaticBloomSizeKB()
215                 * TraditionalBinaryPrefix.KILO.value, "B", 1)), jamonWriter);
216         // 181, 65
217         jamonWriter.write("</td>\n            <td>");
218         // 182, 17
219         org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(load.getDataLocality()), jamonWriter);
220         // 182, 45
221         jamonWriter.write("</td>\n            ");
222       }
223       // 183, 19
224       jamonWriter.write("\n        </tr>\n        ");
225     }
226     // 185, 16
227     jamonWriter.write("\n    </table>\n");
228   }
229
230
231   // 114, 1
232   private void __jamon_innerUnit__requestStats(final java.io.Writer jamonWriter, final List<HRegionInfo> onlineRegions)
233     throws java.io.IOException
234   {
235     // 118, 5
236     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        ");
237     // 126, 9
238     for (HRegionInfo r: onlineRegions )
239     {
240       // 126, 46
241       jamonWriter.write("\n\n        <tr>\n        ");
242       // 129, 9
243
244             RegionLoad load = regionServer.createRegionLoad(r.getEncodedName());
245             String displayName = HRegionInfo.getRegionNameAsStringForDisplay(r,
246               regionServer.getConfiguration());
247
248       // 134, 13
249       jamonWriter.write("<td><a href=\"region.jsp?name=");
250       // 134, 42
251       org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(r.getEncodedName()), jamonWriter);
252       // 134, 66
253       jamonWriter.write("\">");
254       // 134, 68
255       org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(displayName), jamonWriter);
256       // 134, 85
257       jamonWriter.write("</a></td>\n            ");
258       // 135, 13
259       if (load != null )
260       {
261         // 135, 33
262         jamonWriter.write("\n            <td>");
263         // 136, 17
264         org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(load.getReadRequestsCount()), jamonWriter);
265         // 136, 50
266         jamonWriter.write("</td>\n            <td>");
267         // 137, 17
268         org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(load.getFilteredReadRequestsCount()), jamonWriter);
269         // 137, 58
270         jamonWriter.write("</td>\n            <td>");
271         // 138, 17
272         org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(load.getWriteRequestsCount()), jamonWriter);
273         // 138, 51
274         jamonWriter.write("</td>\n            ");
275       }
276       // 139, 19
277       jamonWriter.write("\n        </tr>\n        ");
278     }
279     // 141, 16
280     jamonWriter.write("\n    </table>\n");
281   }
282
283
284   // 226, 1
285   private void __jamon_innerUnit__memstoreStats(final java.io.Writer jamonWriter, final List<HRegionInfo> onlineRegions)
286     throws java.io.IOException
287   {
288     // 230, 5
289     jamonWriter.write("<table class=\"table table-striped\">\n        <tr>\n            <th>Region Name</th>\n            <th>Memstore Size</th>\n        </tr>\n\n        ");
290     // 236, 9
291     for (HRegionInfo r: onlineRegions )
292     {
293       // 236, 46
294       jamonWriter.write("\n\n        <tr>\n        ");
295       // 239, 9
296
297             RegionLoad load = regionServer.createRegionLoad(r.getEncodedName());
298             String displayName = HRegionInfo.getRegionNameAsStringForDisplay(r,
299               regionServer.getConfiguration());
300
301       // 244, 13
302       jamonWriter.write("<td><a href=\"region.jsp?name=");
303       // 244, 42
304       org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(r.getEncodedName()), jamonWriter);
305       // 244, 66
306       jamonWriter.write("\">");
307       // 244, 68
308       org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(displayName), jamonWriter);
309       // 244, 85
310       jamonWriter.write("</a></td>\n            ");
311       // 245, 13
312       if (load != null )
313       {
314         // 245, 33
315         jamonWriter.write("\n            <td>");
316         // 246, 17
317         org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(TraditionalBinaryPrefix.long2String(
318                 load.getMemstoreSizeMB() * TraditionalBinaryPrefix.MEGA.value, "B", 1)), jamonWriter);
319         // 247, 90
320         jamonWriter.write("</td>\n            ");
321       }
322       // 248, 19
323       jamonWriter.write("\n        </tr>\n        ");
324     }
325     // 250, 16
326     jamonWriter.write("\n    </table>\n");
327   }
328
329
330   // 190, 1
331   private void __jamon_innerUnit__compactStats(final java.io.Writer jamonWriter, final List<HRegionInfo> onlineRegions)
332     throws java.io.IOException
333   {
334     // 194, 5
335     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        ");
336     // 202, 9
337     for (HRegionInfo r: onlineRegions )
338     {
339       // 202, 46
340       jamonWriter.write("\n\n        <tr>\n        ");
341       // 205, 9
342
343             RegionLoad load = regionServer.createRegionLoad(r.getEncodedName());
344             String percentDone = "";
345             if  (load != null && load.getTotalCompactingKVs() > 0) {
346             percentDone = String.format("%.2f", 100 *
347             ((float) load.getCurrentCompactedKVs() / load.getTotalCompactingKVs())) + "%";
348             }
349             String displayName = HRegionInfo.getRegionNameAsStringForDisplay(r,
350               regionServer.getConfiguration());
351
352       // 215, 13
353       jamonWriter.write("<td><a href=\"region.jsp?name=");
354       // 215, 42
355       org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(r.getEncodedName()), jamonWriter);
356       // 215, 66
357       jamonWriter.write("\">");
358       // 215, 68
359       org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(displayName), jamonWriter);
360       // 215, 85
361       jamonWriter.write("</a></td>\n            ");
362       // 216, 13
363       if (load != null )
364       {
365         // 216, 33
366         jamonWriter.write("\n            <td>");
367         // 217, 17
368         org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(load.getTotalCompactingKVs()), jamonWriter);
369         // 217, 51
370         jamonWriter.write("</td>\n            <td>");
371         // 218, 17
372         org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(load.getCurrentCompactedKVs()), jamonWriter);
373         // 218, 52
374         jamonWriter.write("</td>\n            <td>");
375         // 219, 17
376         org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(percentDone), jamonWriter);
377         // 219, 34
378         jamonWriter.write("</td>\n            ");
379       }
380       // 220, 19
381       jamonWriter.write("\n        </tr>\n        ");
382     }
383     // 222, 16
384     jamonWriter.write("\n    </table>\n");
385   }
386   
387   
388 }