View Javadoc

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