View Javadoc

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