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