View Javadoc

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