View Javadoc

1   // Autogenerated Jamon implementation
2   // /jenkins/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  
31  public class RegionListTmplImpl
32    extends org.jamon.AbstractTemplateImpl
33    implements org.apache.hadoop.hbase.tmpl.regionserver.RegionListTmpl.Intf
34  
35  {
36    private final HRegionServer regionServer;
37    private final List<HRegionInfo> onlineRegions;
38    protected static org.apache.hadoop.hbase.tmpl.regionserver.RegionListTmpl.ImplData __jamon_setOptionalArguments(org.apache.hadoop.hbase.tmpl.regionserver.RegionListTmpl.ImplData p_implData)
39    {
40      return p_implData;
41    }
42    public RegionListTmplImpl(org.jamon.TemplateManager p_templateManager, org.apache.hadoop.hbase.tmpl.regionserver.RegionListTmpl.ImplData p_implData)
43    {
44      super(p_templateManager, __jamon_setOptionalArguments(p_implData));
45      regionServer = p_implData.getRegionServer();
46      onlineRegions = p_implData.getOnlineRegions();
47    }
48    
49    @Override public void renderNoFlush(final java.io.Writer jamonWriter)
50      throws java.io.IOException
51    {
52      // 37, 1
53      if ((onlineRegions != null && onlineRegions.size() > 0) )
54      {
55        // 37, 60
56        jamonWriter.write("\n\n    ");
57        // 39, 5
58        
59          Collections.sort(onlineRegions);
60      
61        // 43, 5
62        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                ");
63        // 53, 17
64        {
65          // 53, 17
66          __jamon_innerUnit__baseInfo(jamonWriter, onlineRegions);
67        }
68        // 53, 63
69        jamonWriter.write("\n            </div>\n            <div class=\"tab-pane\" id=\"tab_regionRequestStats\">\n                ");
70        // 56, 17
71        {
72          // 56, 17
73          __jamon_innerUnit__requestStats(jamonWriter, onlineRegions);
74        }
75        // 56, 67
76        jamonWriter.write("\n            </div>\n            <div class=\"tab-pane\" id=\"tab_regionStoreStats\">\n                ");
77        // 59, 17
78        {
79          // 59, 17
80          __jamon_innerUnit__storeStats(jamonWriter, onlineRegions);
81        }
82        // 59, 65
83        jamonWriter.write("\n            </div>\n            <div class=\"tab-pane\" id=\"tab_regionMemstoreStats\">\n                ");
84        // 62, 17
85        {
86          // 62, 17
87          __jamon_innerUnit__memstoreStats(jamonWriter, onlineRegions);
88        }
89        // 62, 68
90        jamonWriter.write("\n            </div>\n            <div class=\"tab-pane\" id=\"tab_regionCompactStats\">\n                ");
91        // 65, 17
92        {
93          // 65, 17
94          __jamon_innerUnit__compactStats(jamonWriter, onlineRegions);
95        }
96        // 65, 67
97        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");
98      }
99      // 80, 1
100     else
101     {
102       // 80, 8
103       jamonWriter.write("\n    <p>Not serving regions</p>\n");
104     }
105     // 82, 7
106     jamonWriter.write("\n\n");
107   }
108   
109   
110   // 113, 1
111   private void __jamon_innerUnit__requestStats(final java.io.Writer jamonWriter, final List<HRegionInfo> onlineRegions)
112     throws java.io.IOException
113   {
114     // 117, 5
115     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        ");
116     // 125, 9
117     for (HRegionInfo r: onlineRegions )
118     {
119       // 125, 46
120       jamonWriter.write("\n\n        <tr>\n        ");
121       // 128, 9
122       
123             RegionLoad load = regionServer.createRegionLoad(r.getEncodedName());
124             String displayName = HRegionInfo.getRegionNameAsStringForDisplay(r,
125               regionServer.getConfiguration());
126         
127       // 133, 13
128       jamonWriter.write("<td><a href=\"region.jsp?name=");
129       // 133, 42
130       org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(r.getEncodedName()), jamonWriter);
131       // 133, 66
132       jamonWriter.write("\">");
133       // 133, 68
134       org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(displayName), jamonWriter);
135       // 133, 85
136       jamonWriter.write("</a></td>\n            ");
137       // 134, 13
138       if (load != null )
139       {
140         // 134, 33
141         jamonWriter.write("\n            <td>");
142         // 135, 17
143         org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(load.getReadRequestsCount()), jamonWriter);
144         // 135, 50
145         jamonWriter.write("</td>\n            <td>");
146         // 136, 17
147         org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(load.getFilteredReadRequestsCount()), jamonWriter);
148         // 136, 58
149         jamonWriter.write("</td>\n            <td>");
150         // 137, 17
151         org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(load.getWriteRequestsCount()), jamonWriter);
152         // 137, 51
153         jamonWriter.write("</td>\n            ");
154       }
155       // 138, 19
156       jamonWriter.write("\n        </tr>\n        ");
157     }
158     // 140, 16
159     jamonWriter.write("\n    </table>\n");
160   }
161   
162   
163   // 221, 1
164   private void __jamon_innerUnit__memstoreStats(final java.io.Writer jamonWriter, final List<HRegionInfo> onlineRegions)
165     throws java.io.IOException
166   {
167     // 225, 5
168     jamonWriter.write("<table class=\"table table-striped\">\n        <tr>\n            <th>Region Name</th>\n            <th>Memstore Size</th>\n        </tr>\n\n        ");
169     // 231, 9
170     for (HRegionInfo r: onlineRegions )
171     {
172       // 231, 46
173       jamonWriter.write("\n\n        <tr>\n        ");
174       // 234, 9
175       
176             RegionLoad load = regionServer.createRegionLoad(r.getEncodedName());
177             String displayName = HRegionInfo.getRegionNameAsStringForDisplay(r,
178               regionServer.getConfiguration());
179         
180       // 239, 13
181       jamonWriter.write("<td><a href=\"region.jsp?name=");
182       // 239, 42
183       org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(r.getEncodedName()), jamonWriter);
184       // 239, 66
185       jamonWriter.write("\">");
186       // 239, 68
187       org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(displayName), jamonWriter);
188       // 239, 85
189       jamonWriter.write("</a></td>\n            ");
190       // 240, 13
191       if (load != null )
192       {
193         // 240, 33
194         jamonWriter.write("\n            <td>");
195         // 241, 17
196         org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(load.getMemstoreSizeMB()), jamonWriter);
197         // 241, 47
198         jamonWriter.write("m</td>\n            ");
199       }
200       // 242, 19
201       jamonWriter.write("\n        </tr>\n        ");
202     }
203     // 244, 16
204     jamonWriter.write("\n    </table>\n");
205   }
206   
207   
208   // 185, 1
209   private void __jamon_innerUnit__compactStats(final java.io.Writer jamonWriter, final List<HRegionInfo> onlineRegions)
210     throws java.io.IOException
211   {
212     // 189, 5
213     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        ");
214     // 197, 9
215     for (HRegionInfo r: onlineRegions )
216     {
217       // 197, 46
218       jamonWriter.write("\n\n        <tr>\n        ");
219       // 200, 9
220       
221             RegionLoad load = regionServer.createRegionLoad(r.getEncodedName());
222             String percentDone = "";
223             if  (load != null && load.getTotalCompactingKVs() > 0) {
224             percentDone = String.format("%.2f", 100 *
225             ((float) load.getCurrentCompactedKVs() / load.getTotalCompactingKVs())) + "%";
226             }
227             String displayName = HRegionInfo.getRegionNameAsStringForDisplay(r,
228               regionServer.getConfiguration());
229         
230       // 210, 13
231       jamonWriter.write("<td><a href=\"region.jsp?name=");
232       // 210, 42
233       org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(r.getEncodedName()), jamonWriter);
234       // 210, 66
235       jamonWriter.write("\">");
236       // 210, 68
237       org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(displayName), jamonWriter);
238       // 210, 85
239       jamonWriter.write("</a></td>\n            ");
240       // 211, 13
241       if (load != null )
242       {
243         // 211, 33
244         jamonWriter.write("\n            <td>");
245         // 212, 17
246         org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(load.getTotalCompactingKVs()), jamonWriter);
247         // 212, 51
248         jamonWriter.write("</td>\n            <td>");
249         // 213, 17
250         org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(load.getCurrentCompactedKVs()), jamonWriter);
251         // 213, 52
252         jamonWriter.write("</td>\n            <td>");
253         // 214, 17
254         org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(percentDone), jamonWriter);
255         // 214, 34
256         jamonWriter.write("</td>\n            ");
257       }
258       // 215, 19
259       jamonWriter.write("\n        </tr>\n        ");
260     }
261     // 217, 16
262     jamonWriter.write("\n    </table>\n");
263   }
264   
265   
266   // 84, 1
267   private void __jamon_innerUnit__baseInfo(final java.io.Writer jamonWriter, final List<HRegionInfo> onlineRegions)
268     throws java.io.IOException
269   {
270     // 88, 5
271     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        ");
272     // 96, 9
273     for (HRegionInfo r: onlineRegions )
274     {
275       // 96, 46
276       jamonWriter.write("\n        <tr>\n            ");
277       // 98, 13
278       
279              String displayName = HRegionInfo.getRegionNameAsStringForDisplay(r,
280                regionServer.getConfiguration());
281             
282       // 102, 13
283       jamonWriter.write("<td><a href=\"region.jsp?name=");
284       // 102, 42
285       org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(r.getEncodedName()), jamonWriter);
286       // 102, 66
287       jamonWriter.write("\">");
288       // 102, 68
289       org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(displayName), jamonWriter);
290       // 102, 85
291       jamonWriter.write("</a></td>\n            <td>");
292       // 103, 17
293       org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(Bytes.toStringBinary(HRegionInfo.getStartKeyForDisplay(r,
294                                         regionServer.getConfiguration()))), jamonWriter);
295       // 104, 77
296       jamonWriter.write("</td>\n            <td>");
297       // 105, 17
298       org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(Bytes.toStringBinary(HRegionInfo.getEndKeyForDisplay(r,
299                                         regionServer.getConfiguration()))), jamonWriter);
300       // 106, 77
301       jamonWriter.write("</td>\n            <td>");
302       // 107, 17
303       org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(r.getReplicaId()), jamonWriter);
304       // 107, 39
305       jamonWriter.write("</td>\n        </tr>\n        ");
306     }
307     // 109, 16
308     jamonWriter.write("\n    </table>\n");
309   }
310   
311   
312   // 145, 1
313   private void __jamon_innerUnit__storeStats(final java.io.Writer jamonWriter, final List<HRegionInfo> onlineRegions)
314     throws java.io.IOException
315   {
316     // 149, 5
317     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        ");
318     // 161, 9
319     for (HRegionInfo r: onlineRegions )
320     {
321       // 161, 46
322       jamonWriter.write("\n\n        <tr>\n        ");
323       // 164, 9
324       
325             RegionLoad load = regionServer.createRegionLoad(r.getEncodedName());
326             String displayName = HRegionInfo.getRegionNameAsStringForDisplay(r,
327               regionServer.getConfiguration());
328         
329       // 169, 13
330       jamonWriter.write("<td><a href=\"region.jsp?name=");
331       // 169, 42
332       org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(r.getEncodedName()), jamonWriter);
333       // 169, 66
334       jamonWriter.write("\">");
335       // 169, 68
336       org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(displayName), jamonWriter);
337       // 169, 85
338       jamonWriter.write("</a></td>\n            ");
339       // 170, 13
340       if (load != null )
341       {
342         // 170, 33
343         jamonWriter.write("\n            <td>");
344         // 171, 17
345         org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(load.getStores()), jamonWriter);
346         // 171, 39
347         jamonWriter.write("</td>\n            <td>");
348         // 172, 17
349         org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(load.getStorefiles()), jamonWriter);
350         // 172, 43
351         jamonWriter.write("</td>\n            <td>");
352         // 173, 17
353         org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(load.getStoreUncompressedSizeMB()), jamonWriter);
354         // 173, 56
355         jamonWriter.write("m</td>\n            <td>");
356         // 174, 17
357         org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(load.getStorefileSizeMB()), jamonWriter);
358         // 174, 48
359         jamonWriter.write("m</td>\n            <td>");
360         // 175, 17
361         org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(load.getTotalStaticIndexSizeKB()), jamonWriter);
362         // 175, 55
363         jamonWriter.write("k</td>\n            <td>");
364         // 176, 17
365         org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(load.getTotalStaticBloomSizeKB()), jamonWriter);
366         // 176, 55
367         jamonWriter.write("k</td>\n            <td>");
368         // 177, 17
369         org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(load.getDataLocality()), jamonWriter);
370         // 177, 45
371         jamonWriter.write("</td>\n            ");
372       }
373       // 178, 19
374       jamonWriter.write("\n        </tr>\n        ");
375     }
376     // 180, 16
377     jamonWriter.write("\n    </table>\n");
378   }
379   
380   
381 }