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