View Javadoc

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