View Javadoc

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