View Javadoc

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