View Javadoc

1   // Autogenerated Jamon implementation
2   // /home/apurtell/src/hbase/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/master/RegionServerListTmpl.jamon
3   
4   package org.apache.hadoop.hbase.tmpl.master;
5   
6   // 27, 9
7   import java.util.*;
8   // 28, 9
9   import org.apache.hadoop.util.StringUtils;
10  // 29, 9
11  import org.apache.hadoop.hbase.util.Bytes;
12  // 30, 9
13  import org.apache.hadoop.hbase.util.JvmVersion;
14  // 31, 9
15  import org.apache.hadoop.hbase.util.FSUtils;
16  // 32, 9
17  import org.apache.hadoop.hbase.master.HMaster;
18  // 33, 9
19  import org.apache.hadoop.hbase.HConstants;
20  // 34, 9
21  import org.apache.hadoop.hbase.ServerLoad;
22  // 35, 9
23  import org.apache.hadoop.hbase.ServerName;
24  // 36, 9
25  import org.apache.hadoop.hbase.client.HBaseAdmin;
26  // 37, 9
27  import org.apache.hadoop.hbase.HTableDescriptor;
28  // 38, 9
29  import org.apache.hadoop.hbase.HBaseConfiguration;
30  
31  public class RegionServerListTmplImpl
32    extends org.jamon.AbstractTemplateImpl
33    implements org.apache.hadoop.hbase.tmpl.master.RegionServerListTmpl.Intf
34  
35  {
36    private final HMaster master;
37    private final List<ServerName> servers;
38    protected static org.apache.hadoop.hbase.tmpl.master.RegionServerListTmpl.ImplData __jamon_setOptionalArguments(org.apache.hadoop.hbase.tmpl.master.RegionServerListTmpl.ImplData p_implData)
39    {
40      if(! p_implData.getServers__IsNotDefault())
41      {
42        p_implData.setServers(null);
43      }
44      return p_implData;
45    }
46    public RegionServerListTmplImpl(org.jamon.TemplateManager p_templateManager, org.apache.hadoop.hbase.tmpl.master.RegionServerListTmpl.ImplData p_implData)
47    {
48      super(p_templateManager, __jamon_setOptionalArguments(p_implData));
49      master = p_implData.getMaster();
50      servers = p_implData.getServers();
51    }
52    
53    public void renderNoFlush(@SuppressWarnings({"unused","hiding"}) final java.io.Writer jamonWriter)
54      throws java.io.IOException
55    {
56      // 42, 1
57      if ((servers != null && servers.size() > 0))
58      {
59        // 42, 47
60        jamonWriter.write("\n\n");
61        // 44, 1
62        
63  ServerName [] serverNames = servers.toArray(new ServerName[servers.size()]);
64  Arrays.sort(serverNames);
65  
66        // 49, 1
67        jamonWriter.write("<div class=\"tabbable\">\n    <ul class=\"nav nav-pills\">\n        <li class=\"active\"><a href=\"#tab_baseStats\" data-toggle=\"tab\">Base Stats</a></li>\n        <li class=\"\"><a href=\"#tab_memoryStats\" data-toggle=\"tab\">Memory</a></li>\n        <li class=\"\"><a href=\"#tab_requestStats\" data-toggle=\"tab\">Requests</a></li>\n        <li class=\"\"><a href=\"#tab_storeStats\" data-toggle=\"tab\">Storefiles</a></li>\n        <li class=\"\"><a href=\"#tab_compactStas\" data-toggle=\"tab\">Compactions</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_baseStats\">\n            ");
68        // 59, 13
69        {
70          // 59, 13
71          __jamon_innerUnit__baseStats(jamonWriter, serverNames);
72        }
73        // 59, 56
74        jamonWriter.write("\n        </div>\n        <div class=\"tab-pane\" id=\"tab_memoryStats\">\n            ");
75        // 62, 13
76        {
77          // 62, 13
78          __jamon_innerUnit__memoryStats(jamonWriter, serverNames);
79        }
80        // 62, 58
81        jamonWriter.write("\n        </div>\n        <div class=\"tab-pane\" id=\"tab_requestStats\">\n            ");
82        // 65, 13
83        {
84          // 65, 13
85          __jamon_innerUnit__requestStats(jamonWriter, serverNames);
86        }
87        // 65, 59
88        jamonWriter.write("\n        </div>\n        <div class=\"tab-pane\" id=\"tab_storeStats\">\n            ");
89        // 68, 13
90        {
91          // 68, 13
92          __jamon_innerUnit__storeStats(jamonWriter, serverNames);
93        }
94        // 68, 57
95        jamonWriter.write("\n        </div>\n        <div class=\"tab-pane\" id=\"tab_compactStas\">\n            ");
96        // 71, 13
97        {
98          // 71, 13
99          __jamon_innerUnit__compactionStats(jamonWriter, serverNames);
100       }
101       // 71, 62
102       jamonWriter.write("\n        </div>\n    </div>\n</div>\n\n");
103     }
104     // 76, 7
105     jamonWriter.write("\n\n");
106   }
107   
108   
109   // 161, 1
110   private void __jamon_innerUnit__requestStats(@SuppressWarnings({"unused","hiding"}) final java.io.Writer jamonWriter, final ServerName[] serverNames)
111     throws java.io.IOException
112   {
113     // 165, 1
114     jamonWriter.write("<table class=\"table table-striped\">\n<tr>\n    <th>ServerName</th>\n    <th>Request Per Second</th>\n    <th>Read Request Count</th>\n    <th>Write Request Count</th>\n</tr>\n");
115     // 172, 1
116     
117 for (ServerName serverName: serverNames) {
118 
119 ServerLoad sl = master.getServerManager().getLoad(serverName);
120 if (sl != null) {
121 
122     // 178, 1
123     jamonWriter.write("<tr>\n<td>");
124     // 179, 5
125     {
126       // 179, 5
127       __jamon_innerUnit__serverNameLink(jamonWriter, serverName, sl);
128     }
129     // 179, 66
130     jamonWriter.write("</td>\n<td>");
131     // 180, 5
132     org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(String.format("%.0f", sl.getRequestsPerSecond())), jamonWriter);
133     // 180, 59
134     jamonWriter.write("</td>\n<td>");
135     // 181, 5
136     org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(sl.getReadRequestsCount()), jamonWriter);
137     // 181, 36
138     jamonWriter.write("</td>\n<td>");
139     // 182, 5
140     org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(sl.getWriteRequestsCount()), jamonWriter);
141     // 182, 37
142     jamonWriter.write("</td>\n</tr>\n");
143     // 184, 1
144     
145         }  else {
146         
147     // 187, 1
148     {
149       // 187, 1
150       __jamon_innerUnit__emptyStat(jamonWriter, serverName);
151     }
152     // 187, 40
153     jamonWriter.write("\n");
154     // 188, 1
155     
156         }
157 }
158 
159     // 192, 1
160     jamonWriter.write("</table>\n");
161   }
162   
163   
164   // 295, 1
165   private void __jamon_innerUnit__emptyStat(@SuppressWarnings({"unused","hiding"}) final java.io.Writer jamonWriter, final ServerName serverName)
166     throws java.io.IOException
167   {
168     // 299, 5
169     jamonWriter.write("<tr>\n    <td>");
170     // 300, 9
171     {
172       // 300, 9
173       __jamon_innerUnit__serverNameLink(jamonWriter, serverName, null);
174     }
175     // 300, 72
176     jamonWriter.write("</td>\n    <td></td>\n    <td></td>\n    <td></td>\n    <td></td>\n    <td></td>\n    <td></td>\n    </tr>\n");
177   }
178   
179   
180   // 278, 1
181   private void __jamon_innerUnit__serverNameLink(@SuppressWarnings({"unused","hiding"}) final java.io.Writer jamonWriter, final ServerName serverName, final ServerLoad serverLoad)
182     throws java.io.IOException
183   {
184     // 283, 9
185     
186         int infoPort = master.getRegionServerInfoPort(serverName);
187         String url = "//" + serverName.getHostname() + ":" + infoPort + "/rs-status";
188         
189     // 288, 9
190     if ((infoPort > 0) )
191     {
192       // 288, 31
193       jamonWriter.write("\n            <a href=\"");
194       // 289, 22
195       org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(url), jamonWriter);
196       // 289, 31
197       jamonWriter.write("\">");
198       // 289, 33
199       org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(serverName.getServerName()), jamonWriter);
200       // 289, 65
201       jamonWriter.write("</a>\n        ");
202     }
203     // 290, 9
204     else
205     {
206       // 290, 16
207       jamonWriter.write("\n            ");
208       // 291, 13
209       org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(serverName.getServerName()), jamonWriter);
210       // 291, 45
211       jamonWriter.write("\n        ");
212     }
213     // 292, 15
214     jamonWriter.write("\n");
215   }
216   
217   
218   // 124, 1
219   private void __jamon_innerUnit__memoryStats(@SuppressWarnings({"unused","hiding"}) final java.io.Writer jamonWriter, final ServerName[] serverNames)
220     throws java.io.IOException
221   {
222     // 128, 1
223     jamonWriter.write("<table class=\"table table-striped\">\n<tr>\n    <th>ServerName</th>\n    <th>Used Heap</th>\n    <th>Max Heap</th>\n    <th>Memstore Size</th>\n\n</tr>\n");
224     // 136, 1
225     
226 for (ServerName serverName: serverNames) {
227 
228     ServerLoad sl = master.getServerManager().getLoad(serverName);
229     if (sl != null) {
230 
231     // 142, 1
232     jamonWriter.write("<tr>\n    <td>");
233     // 143, 9
234     {
235       // 143, 9
236       __jamon_innerUnit__serverNameLink(jamonWriter, serverName, sl);
237     }
238     // 143, 70
239     jamonWriter.write("</td>\n    <td>");
240     // 144, 9
241     org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(sl.getUsedHeapMB()), jamonWriter);
242     // 144, 33
243     jamonWriter.write("m</td>\n    <td>");
244     // 145, 9
245     org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(sl.getMaxHeapMB()), jamonWriter);
246     // 145, 32
247     jamonWriter.write("m</td>\n    <td>");
248     // 146, 9
249     org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(sl.getMemstoreSizeInMB()), jamonWriter);
250     // 146, 39
251     jamonWriter.write("m</td>\n\n</tr>\n");
252     // 149, 1
253     
254         }  else {
255 
256     // 152, 1
257     {
258       // 152, 1
259       __jamon_innerUnit__emptyStat(jamonWriter, serverName);
260     }
261     // 152, 40
262     jamonWriter.write("\n");
263     // 153, 1
264     
265         }
266 }
267 
268     // 157, 1
269     jamonWriter.write("</table>\n");
270   }
271   
272   
273   // 78, 1
274   private void __jamon_innerUnit__baseStats(@SuppressWarnings({"unused","hiding"}) final java.io.Writer jamonWriter, final ServerName[] serverNames)
275     throws java.io.IOException
276   {
277     // 82, 1
278     jamonWriter.write("<table class=\"table table-striped\">\n<tr>\n    <th>ServerName</th>\n    <th>Start time</th>\n    <th>Requests Per Second</th>\n    <th>Num. Regions</th>\n</tr>\n");
279     // 89, 1
280     
281     int totalRegions = 0;
282     int totalRequests = 0;
283     for (ServerName serverName: serverNames) {
284 
285     ServerLoad sl = master.getServerManager().getLoad(serverName);
286     double requestsPerSecond = 0.0;
287     int numRegionsOnline = 0;
288 
289     if (sl != null) {
290         requestsPerSecond = sl.getRequestsPerSecond();
291         numRegionsOnline = sl.getNumberOfRegions();
292         totalRegions += sl.getNumberOfRegions();
293         // Is this correct?  Adding a rate to a measure.
294         totalRequests += sl.getNumberOfRequests();
295     }
296     long startcode = serverName.getStartcode();
297 
298     // 107, 1
299     jamonWriter.write("<tr>\n    <td>");
300     // 108, 9
301     {
302       // 108, 9
303       __jamon_innerUnit__serverNameLink(jamonWriter, serverName, sl);
304     }
305     // 108, 70
306     jamonWriter.write("</td>\n    <td>");
307     // 109, 9
308     org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(new Date(startcode)), jamonWriter);
309     // 109, 34
310     jamonWriter.write("</td>\n    <td>");
311     // 110, 9
312     org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(String.format("%.0f", requestsPerSecond)), jamonWriter);
313     // 110, 55
314     jamonWriter.write("</td>\n    <td>");
315     // 111, 9
316     org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(numRegionsOnline), jamonWriter);
317     // 111, 31
318     jamonWriter.write("</td>\n</tr>\n");
319     // 113, 1
320     
321 }
322 
323     // 116, 1
324     jamonWriter.write("<tr><td>Total:");
325     // 116, 15
326     org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(servers.size()), jamonWriter);
327     // 116, 35
328     jamonWriter.write("</td>\n<td></td>\n<td>");
329     // 118, 5
330     org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(totalRequests), jamonWriter);
331     // 118, 24
332     jamonWriter.write("</td>\n<td>");
333     // 119, 5
334     org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(totalRegions), jamonWriter);
335     // 119, 23
336     jamonWriter.write("</td>\n</tr>\n</table>\n");
337   }
338   
339   
340   // 236, 1
341   private void __jamon_innerUnit__compactionStats(@SuppressWarnings({"unused","hiding"}) final java.io.Writer jamonWriter, final ServerName[] serverNames)
342     throws java.io.IOException
343   {
344     // 240, 1
345     jamonWriter.write("<table class=\"table table-striped\">\n<tr>\n    <th>ServerName</th>\n    <th>Num. Compacting KVs</th>\n    <th>Num. Compacted KVs</th>\n    <th>Remaining KVs</th>\n    <th>Compaction Progress</th>\n</tr>\n");
346     // 248, 1
347     
348 for (ServerName serverName: serverNames) {
349 
350 ServerLoad sl = master.getServerManager().getLoad(serverName);
351 if (sl != null) {
352 String percentDone = "";
353 if  (sl.getTotalCompactingKVs() > 0) {
354      percentDone = String.format("%.2f", 100 *
355         ((float) sl.getCurrentCompactedKVs() / sl.getTotalCompactingKVs())) + "%";
356 }
357 
358     // 259, 1
359     jamonWriter.write("<tr>\n<td>");
360     // 260, 5
361     {
362       // 260, 5
363       __jamon_innerUnit__serverNameLink(jamonWriter, serverName, sl);
364     }
365     // 260, 66
366     jamonWriter.write("</td>\n<td>");
367     // 261, 5
368     org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(sl.getTotalCompactingKVs()), jamonWriter);
369     // 261, 37
370     jamonWriter.write("</td>\n<td>");
371     // 262, 5
372     org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(sl.getCurrentCompactedKVs()), jamonWriter);
373     // 262, 38
374     jamonWriter.write("</td>\n<td>");
375     // 263, 5
376     org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(sl.getTotalCompactingKVs() - sl.getCurrentCompactedKVs()), jamonWriter);
377     // 263, 67
378     jamonWriter.write("</td>\n<td>");
379     // 264, 5
380     org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(percentDone), jamonWriter);
381     // 264, 22
382     jamonWriter.write("</td>\n</tr>\n");
383     // 266, 1
384     
385         }  else {
386         
387     // 269, 1
388     {
389       // 269, 1
390       __jamon_innerUnit__emptyStat(jamonWriter, serverName);
391     }
392     // 269, 40
393     jamonWriter.write("\n");
394     // 270, 1
395     
396     }
397 }
398 
399     // 274, 1
400     jamonWriter.write("</table>\n");
401   }
402   
403   
404   // 196, 1
405   private void __jamon_innerUnit__storeStats(@SuppressWarnings({"unused","hiding"}) final java.io.Writer jamonWriter, final ServerName[] serverNames)
406     throws java.io.IOException
407   {
408     // 200, 1
409     jamonWriter.write("<table class=\"table table-striped\">\n<tr>\n    <th>ServerName</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");
410     // 210, 1
411     
412 for (ServerName serverName: serverNames) {
413 
414 ServerLoad sl = master.getServerManager().getLoad(serverName);
415 if (sl != null) {
416 
417     // 216, 1
418     jamonWriter.write("<tr>\n<td>");
419     // 217, 5
420     {
421       // 217, 5
422       __jamon_innerUnit__serverNameLink(jamonWriter, serverName, sl);
423     }
424     // 217, 66
425     jamonWriter.write("</td>\n<td>");
426     // 218, 5
427     org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(sl.getStores()), jamonWriter);
428     // 218, 25
429     jamonWriter.write("</td>\n<td>");
430     // 219, 5
431     org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(sl.getStorefiles()), jamonWriter);
432     // 219, 29
433     jamonWriter.write("</td>\n<td>");
434     // 220, 5
435     org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(sl.getStoreUncompressedSizeMB()), jamonWriter);
436     // 220, 42
437     jamonWriter.write("m</td>\n<td>");
438     // 221, 5
439     org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(sl.getStorefileSizeInMB()), jamonWriter);
440     // 221, 36
441     jamonWriter.write("mb</td>\n<td>");
442     // 222, 5
443     org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(sl.getTotalStaticIndexSizeKB()), jamonWriter);
444     // 222, 41
445     jamonWriter.write("k</td>\n<td>");
446     // 223, 5
447     org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(sl.getTotalStaticBloomSizeKB()), jamonWriter);
448     // 223, 41
449     jamonWriter.write("k</td>\n</tr>\n");
450     // 225, 1
451     
452         }  else {
453         
454     // 228, 1
455     {
456       // 228, 1
457       __jamon_innerUnit__emptyStat(jamonWriter, serverName);
458     }
459     // 228, 40
460     jamonWriter.write("\n");
461     // 229, 1
462     
463     }
464 }
465 
466     // 233, 1
467     jamonWriter.write("</table>\n");
468   }
469   
470   
471 }