View Javadoc

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