001// Autogenerated Jamon implementation
002// /Users/petersomogyi/projects/hbase-upstream/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/master/RegionServerListTmpl.jamon
003
004package org.apache.hadoop.hbase.tmpl.master;
005
006// 27, 9
007import java.util.*;
008// 28, 9
009import org.apache.hadoop.hbase.master.HMaster;
010// 29, 9
011import org.apache.hadoop.hbase.procedure2.util.StringUtils;
012// 30, 9
013import org.apache.hadoop.hbase.replication.ReplicationLoadSource;
014// 31, 9
015import org.apache.hadoop.hbase.RegionMetrics;
016// 32, 9
017import org.apache.hadoop.hbase.ServerMetrics;
018// 33, 9
019import org.apache.hadoop.hbase.ServerName;
020// 34, 9
021import org.apache.hadoop.hbase.Size;
022// 35, 9
023import org.apache.hadoop.hbase.util.VersionInfo;
024// 36, 9
025import org.apache.hadoop.hbase.util.Pair;
026// 37, 9
027import org.apache.hadoop.util.StringUtils.TraditionalBinaryPrefix;
028
029public class RegionServerListTmplImpl
030  extends org.jamon.AbstractTemplateImpl
031  implements org.apache.hadoop.hbase.tmpl.master.RegionServerListTmpl.Intf
032
033{
034  private final HMaster master;
035  private final List<ServerName> servers;
036  protected static org.apache.hadoop.hbase.tmpl.master.RegionServerListTmpl.ImplData __jamon_setOptionalArguments(org.apache.hadoop.hbase.tmpl.master.RegionServerListTmpl.ImplData p_implData)
037  {
038    if(! p_implData.getServers__IsNotDefault())
039    {
040      p_implData.setServers(null);
041    }
042    return p_implData;
043  }
044  public RegionServerListTmplImpl(org.jamon.TemplateManager p_templateManager, org.apache.hadoop.hbase.tmpl.master.RegionServerListTmpl.ImplData p_implData)
045  {
046    super(p_templateManager, __jamon_setOptionalArguments(p_implData));
047    master = p_implData.getMaster();
048    servers = p_implData.getServers();
049  }
050  
051  @Override public void renderNoFlush(final java.io.Writer jamonWriter)
052    throws java.io.IOException
053  {
054    // 40, 1
055    if ((servers != null && servers.size() > 0))
056    {
057      // 40, 47
058      jamonWriter.write("\n\n");
059      // 42, 1
060      
061ServerName [] serverNames = servers.toArray(new ServerName[servers.size()]);
062Arrays.sort(serverNames);
063
064      // 47, 1
065      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_compactStats\" data-toggle=\"tab\">Compactions</a></li>\n        <li class=\"\"><a href=\"#tab_replicationStats\" data-toggle=\"tab\">Replications</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            ");
066      // 58, 13
067      {
068        // 58, 13
069        __jamon_innerUnit__baseStats(jamonWriter, serverNames);
070      }
071      // 58, 56
072      jamonWriter.write("\n        </div>\n        <div class=\"tab-pane\" id=\"tab_memoryStats\">\n            ");
073      // 61, 13
074      {
075        // 61, 13
076        __jamon_innerUnit__memoryStats(jamonWriter, serverNames);
077      }
078      // 61, 58
079      jamonWriter.write("\n        </div>\n        <div class=\"tab-pane\" id=\"tab_requestStats\">\n            ");
080      // 64, 13
081      {
082        // 64, 13
083        __jamon_innerUnit__requestStats(jamonWriter, serverNames);
084      }
085      // 64, 59
086      jamonWriter.write("\n        </div>\n        <div class=\"tab-pane\" id=\"tab_storeStats\">\n            ");
087      // 67, 13
088      {
089        // 67, 13
090        __jamon_innerUnit__storeStats(jamonWriter, serverNames);
091      }
092      // 67, 57
093      jamonWriter.write("\n        </div>\n        <div class=\"tab-pane\" id=\"tab_compactStats\">\n            ");
094      // 70, 13
095      {
096        // 70, 13
097        __jamon_innerUnit__compactionStats(jamonWriter, serverNames);
098      }
099      // 70, 62
100      jamonWriter.write("\n        </div>\n        <div class=\"tab-pane\" id=\"tab_replicationStats\">\n            ");
101      // 73, 13
102      {
103        // 73, 13
104        __jamon_innerUnit__replicationStats(jamonWriter, serverNames);
105      }
106      // 73, 63
107      jamonWriter.write("\n        </div>\n    </div>\n</div>\n\n");
108    }
109    // 78, 7
110    jamonWriter.write("\n\n");
111  }
112  
113  
114  // 80, 1
115  private void __jamon_innerUnit__baseStats(final java.io.Writer jamonWriter, final ServerName[] serverNames)
116    throws java.io.IOException
117  {
118    // 84, 1
119    jamonWriter.write("<table id=\"baseStatsTable\" class=\"tablesorter table table-striped\">\n<thead>\n<tr>\n    <th>ServerName</th>\n    <th>Start time</th>\n    <th>Last contact</th>\n    <th>Version</th>\n    <th>Requests Per Second</th>\n    <th>Num. Regions</th>\n</tr>\n</thead>\n<tbody>\n");
120    // 96, 1
121    
122    int totalRegions = 0;
123    int totalRequestsPerSecond = 0;
124    int inconsistentNodeNum = 0;
125    String masterVersion = VersionInfo.getVersion();
126    for (ServerName serverName: serverNames) {
127
128    ServerMetrics sl = master.getServerManager().getLoad(serverName);
129    String version = master.getRegionServerVersion(serverName);
130    if (!masterVersion.equals(version)) {
131        inconsistentNodeNum ++;
132    }
133
134    double requestsPerSecond = 0.0;
135    int numRegionsOnline = 0;
136    long lastContact = 0;
137
138    if (sl != null) {
139        requestsPerSecond = sl.getRequestCountPerSecond();
140        numRegionsOnline = sl.getRegionMetrics().size();
141        totalRegions += sl.getRegionMetrics().size();
142        totalRequestsPerSecond += sl.getRequestCountPerSecond();
143        lastContact = (System.currentTimeMillis() - sl.getReportTimestamp())/1000;
144    }
145    long startcode = serverName.getStartcode();
146
147    // 122, 1
148    jamonWriter.write("<tr>\n    <td>");
149    // 123, 9
150    {
151      // 123, 9
152      __jamon_innerUnit__serverNameLink(jamonWriter, serverName);
153    }
154    // 123, 53
155    jamonWriter.write("</td>\n    <td>");
156    // 124, 9
157    org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(new Date(startcode)), jamonWriter);
158    // 124, 34
159    jamonWriter.write("</td>\n    <td>");
160    // 125, 9
161    org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(TraditionalBinaryPrefix.long2String(lastContact, "s", 1)), jamonWriter);
162    // 125, 71
163    jamonWriter.write("</td>\n    <td>");
164    // 126, 9
165    org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(version), jamonWriter);
166    // 126, 22
167    jamonWriter.write("</td>\n    <td>");
168    // 127, 9
169    org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(String.format("%.0f", requestsPerSecond)), jamonWriter);
170    // 127, 55
171    jamonWriter.write("</td>\n    <td>");
172    // 128, 9
173    org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(numRegionsOnline), jamonWriter);
174    // 128, 31
175    jamonWriter.write("</td>\n</tr>\n");
176    // 130, 1
177    
178}
179
180    // 133, 1
181    jamonWriter.write("</tbody>\n<tr><td>Total:");
182    // 134, 15
183    org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(servers.size()), jamonWriter);
184    // 134, 35
185    jamonWriter.write("</td>\n<td></td>\n<td></td>\n");
186    // 137, 1
187    if (inconsistentNodeNum > 0)
188    {
189      // 137, 31
190      jamonWriter.write("\n  <td style=\"color:red;\">");
191      // 138, 26
192      org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(inconsistentNodeNum), jamonWriter);
193      // 138, 51
194      jamonWriter.write(" nodes with inconsistent version</td>\n");
195    }
196    // 139, 1
197    else
198    {
199      // 139, 8
200      jamonWriter.write("\n   <td></td>\n");
201    }
202    // 141, 7
203    jamonWriter.write("\n<td>");
204    // 142, 5
205    org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(totalRequestsPerSecond), jamonWriter);
206    // 142, 33
207    jamonWriter.write("</td>\n<td>");
208    // 143, 5
209    org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(totalRegions), jamonWriter);
210    // 143, 23
211    jamonWriter.write("</td>\n</tr>\n</table>\n");
212  }
213  
214  
215  // 339, 1
216  private void __jamon_innerUnit__compactionStats(final java.io.Writer jamonWriter, final ServerName[] serverNames)
217    throws java.io.IOException
218  {
219    // 343, 1
220    jamonWriter.write("<table id=\"compactionStatsTable\" class=\"tablesorter table table-striped\">\n<thead>\n<tr>\n    <th>ServerName</th>\n    <th>Num. Compacting Cells</th>\n    <th>Num. Compacted Cells</th>\n    <th>Remaining Cells</th>\n    <th>Compaction Progress</th>\n</tr>\n</thead>\n<tbody>\n");
221    // 354, 1
222    
223for (ServerName serverName: serverNames) {
224
225ServerMetrics sl = master.getServerManager().getLoad(serverName);
226if (sl != null) {
227long totalCompactingCells = 0;
228long totalCompactedCells = 0;
229for (RegionMetrics rl : sl.getRegionMetrics().values()) {
230  totalCompactingCells += rl.getCompactingCellCount();
231  totalCompactedCells += rl.getCompactedCellCount();
232}
233String percentDone = "";
234if  (totalCompactingCells > 0) {
235     percentDone = String.format("%.2f", 100 *
236        ((float) totalCompactedCells / totalCompactingCells)) + "%";
237}
238
239    // 371, 1
240    jamonWriter.write("<tr>\n<td>");
241    // 372, 5
242    {
243      // 372, 5
244      __jamon_innerUnit__serverNameLink(jamonWriter, serverName);
245    }
246    // 372, 49
247    jamonWriter.write("</td>\n<td>");
248    // 373, 5
249    org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(totalCompactingCells), jamonWriter);
250    // 373, 31
251    jamonWriter.write("</td>\n<td>");
252    // 374, 5
253    org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(totalCompactedCells), jamonWriter);
254    // 374, 30
255    jamonWriter.write("</td>\n<td>");
256    // 375, 5
257    org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(totalCompactingCells - totalCompactedCells), jamonWriter);
258    // 375, 53
259    jamonWriter.write("</td>\n<td>");
260    // 376, 5
261    org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(percentDone), jamonWriter);
262    // 376, 22
263    jamonWriter.write("</td>\n</tr>\n");
264    // 378, 1
265    
266        }  else {
267        
268    // 381, 1
269    {
270      // 381, 1
271      __jamon_innerUnit__emptyStat(jamonWriter, serverName);
272    }
273    // 381, 40
274    jamonWriter.write("\n");
275    // 382, 1
276    
277    }
278}
279
280    // 386, 1
281    jamonWriter.write("</tbody>\n</table>\n");
282  }
283  
284  
285  // 472, 1
286  private void __jamon_innerUnit__emptyStat(final java.io.Writer jamonWriter, final ServerName serverName)
287    throws java.io.IOException
288  {
289    // 476, 5
290    jamonWriter.write("<tr>\n    <td>");
291    // 477, 9
292    {
293      // 477, 9
294      __jamon_innerUnit__serverNameLink(jamonWriter, serverName);
295    }
296    // 477, 53
297    jamonWriter.write("</td>\n    <td></td>\n    <td></td>\n    <td></td>\n    <td></td>\n    <td></td>\n    <td></td>\n    </tr>\n");
298  }
299  
300  
301  // 148, 1
302  private void __jamon_innerUnit__memoryStats(final java.io.Writer jamonWriter, final ServerName[] serverNames)
303    throws java.io.IOException
304  {
305    // 152, 1
306    jamonWriter.write("<table id=\"memoryStatsTable\" class=\"tablesorter table table-striped\">\n<thead>\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</thead>\n<tbody>\n");
307    // 163, 1
308    
309final String ZEROMB = "0 MB";
310String usedHeapStr = ZEROMB;
311String maxHeapStr = ZEROMB;
312String memStoreSizeMBStr = ZEROMB;
313for (ServerName serverName: serverNames) {
314    ServerMetrics sl = master.getServerManager().getLoad(serverName);
315    if (sl != null) {
316      long memStoreSizeMB = 0;
317      for (RegionMetrics rl : sl.getRegionMetrics().values()) {
318        memStoreSizeMB += rl.getMemStoreSize().get(Size.Unit.MEGABYTE);
319      }
320      if (memStoreSizeMB > 0) {
321        memStoreSizeMBStr = TraditionalBinaryPrefix.long2String(memStoreSizeMB
322                                  * TraditionalBinaryPrefix.MEGA.value, "B", 1);
323      }
324
325      double usedHeapSizeMB = sl.getUsedHeapSize().get(Size.Unit.MEGABYTE);
326      if (usedHeapSizeMB > 0) {
327        usedHeapStr = TraditionalBinaryPrefix.long2String((long) usedHeapSizeMB
328                            * TraditionalBinaryPrefix.MEGA.value, "B", 1);
329      }
330      double maxHeapSizeMB = sl.getMaxHeapSize().get(Size.Unit.MEGABYTE);
331      if (maxHeapSizeMB > 0) {
332        maxHeapStr = TraditionalBinaryPrefix.long2String((long) maxHeapSizeMB
333                           * TraditionalBinaryPrefix.MEGA.value, "B", 1);
334      }
335
336    // 191, 1
337    jamonWriter.write("<tr>\n    <td>");
338    // 192, 9
339    {
340      // 192, 9
341      __jamon_innerUnit__serverNameLink(jamonWriter, serverName);
342    }
343    // 192, 53
344    jamonWriter.write("</td>\n    <td>");
345    // 193, 9
346    org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(usedHeapStr), jamonWriter);
347    // 193, 26
348    jamonWriter.write("</td>\n    <td>");
349    // 194, 9
350    org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(maxHeapStr), jamonWriter);
351    // 194, 25
352    jamonWriter.write("</td>\n    <td>");
353    // 195, 9
354    org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(memStoreSizeMBStr), jamonWriter);
355    // 195, 32
356    jamonWriter.write("</td>\n</tr>\n");
357    // 197, 1
358    
359        }  else {
360
361    // 200, 1
362    {
363      // 200, 1
364      __jamon_innerUnit__emptyStat(jamonWriter, serverName);
365    }
366    // 200, 40
367    jamonWriter.write("\n");
368    // 201, 1
369    
370        }
371}
372
373    // 205, 1
374    jamonWriter.write("</tbody>\n</table>\n");
375  }
376  
377  
378  // 390, 1
379  private void __jamon_innerUnit__replicationStats(final java.io.Writer jamonWriter, final ServerName[] serverNames)
380    throws java.io.IOException
381  {
382    // 394, 1
383    
384        HashMap<String, List<Pair<ServerName, ReplicationLoadSource>>> replicationLoadSourceMap
385            = master.getReplicationLoad(serverNames);
386        List<String> peers = null;
387        if (replicationLoadSourceMap != null && replicationLoadSourceMap.size() > 0){
388            peers = new ArrayList<>(replicationLoadSourceMap.keySet());
389            Collections.sort(peers);
390        }
391
392    // 404, 1
393    if ((replicationLoadSourceMap != null && replicationLoadSourceMap.size() > 0) )
394    {
395      // 404, 82
396      jamonWriter.write("\n\n<div class=\"tabbable\">\n    <ul class=\"nav nav-tabs\">\n        ");
397      // 408, 9
398      
399        String active = "active";
400        for (String peer : peers){
401        
402      // 412, 13
403      jamonWriter.write("<li class=");
404      // 412, 23
405      org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(active), jamonWriter);
406      // 412, 35
407      jamonWriter.write("><a href=\"#tab_");
408      // 412, 50
409      org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(peer), jamonWriter);
410      // 412, 60
411      jamonWriter.write("\" data-toggle=\"tab\">Peer ");
412      // 412, 85
413      org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(peer), jamonWriter);
414      // 412, 95
415      jamonWriter.write("</a> </li>\n        ");
416      // 413, 9
417      
418        active = "";
419        }
420        
421      // 417, 5
422      jamonWriter.write("</ul>\n    <div class=\"tab-content\">\n        ");
423      // 419, 9
424      
425            active = "active";
426            for (String peer : peers){
427        
428      // 423, 13
429      jamonWriter.write("<div class=\"tab-pane ");
430      // 423, 34
431      org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(active), jamonWriter);
432      // 423, 46
433      jamonWriter.write("\" id=\"tab_");
434      // 423, 56
435      org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(peer), jamonWriter);
436      // 423, 66
437      jamonWriter.write("\">\n                <table class=\"table table-striped\">\n                    <tr>\n                        <th>Server</th>\n                        <th>AgeOfLastShippedOp</th>\n                        <th>SizeOfLogQueue</th>\n                        <th>ReplicationLag</th>\n                    </tr>\n\n                    ");
438      // 432, 21
439      for (Pair<ServerName, ReplicationLoadSource> pair: replicationLoadSourceMap.get(peer) )
440      {
441        // 432, 110
442        jamonWriter.write("\n                    <tr>\n                        <td>");
443        // 434, 29
444        {
445          // 434, 29
446          __jamon_innerUnit__serverNameLink(jamonWriter, pair.getFirst());
447        }
448        // 434, 78
449        jamonWriter.write("</td>\n                        <td>");
450        // 435, 29
451        org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(StringUtils.humanTimeDiff(pair.getSecond().getAgeOfLastShippedOp())), jamonWriter);
452        // 435, 102
453        jamonWriter.write("</td>\n                        <td>");
454        // 436, 29
455        org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(pair.getSecond().getSizeOfLogQueue()), jamonWriter);
456        // 436, 71
457        jamonWriter.write("</td>\n                        <td>");
458        // 437, 29
459        org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(pair.getSecond().getReplicationLag() == Long.MAX_VALUE ? "UNKNOWN" : StringUtils.humanTimeDiff(pair.getSecond().getReplicationLag())), jamonWriter);
460        // 437, 167
461        jamonWriter.write("</td>\n                    </tr>\n                    ");
462      }
463      // 439, 28
464      jamonWriter.write("\n        </table>\n            </div>\n        ");
465      // 442, 9
466      
467                active = "";
468                }
469        
470      // 446, 5
471      jamonWriter.write("</div>\n    <p>If the replication delay is UNKNOWN, that means this walGroup doesn't start replicate yet and it may get disabled.</p>\n</div>\n");
472    }
473    // 449, 1
474    else
475    {
476      // 449, 8
477      jamonWriter.write("\n    <p>No Peers Metrics</p>\n");
478    }
479    // 451, 7
480    jamonWriter.write("\n");
481  }
482  
483  
484  // 210, 1
485  private void __jamon_innerUnit__requestStats(final java.io.Writer jamonWriter, final ServerName[] serverNames)
486    throws java.io.IOException
487  {
488    // 214, 1
489    jamonWriter.write("<table id=\"requestStatsTable\" class=\"tablesorter table table-striped\">\n<thead>\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</thead>\n<tbody>\n");
490    // 225, 1
491    
492for (ServerName serverName: serverNames) {
493
494ServerMetrics sl = master.getServerManager().getLoad(serverName);
495if (sl != null) {
496  long readRequestCount = 0;
497  long writeRequestCount = 0;
498  long filteredReadRequestCount = 0;
499  for (RegionMetrics rl : sl.getRegionMetrics().values()) {
500    readRequestCount += rl.getReadRequestCount();
501    writeRequestCount += rl.getWriteRequestCount();
502    filteredReadRequestCount += rl.getFilteredReadRequestCount();
503  }
504
505    // 239, 1
506    jamonWriter.write("<tr>\n<td>");
507    // 240, 5
508    {
509      // 240, 5
510      __jamon_innerUnit__serverNameLink(jamonWriter, serverName);
511    }
512    // 240, 49
513    jamonWriter.write("</td>\n<td>");
514    // 241, 5
515    org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(sl.getRequestCountPerSecond()), jamonWriter);
516    // 241, 40
517    jamonWriter.write("</td>\n<td>");
518    // 242, 5
519    org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(readRequestCount), jamonWriter);
520    // 242, 27
521    jamonWriter.write("</td>\n<td>");
522    // 243, 5
523    org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(filteredReadRequestCount), jamonWriter);
524    // 243, 35
525    jamonWriter.write("</td>\n<td>");
526    // 244, 5
527    org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(writeRequestCount), jamonWriter);
528    // 244, 28
529    jamonWriter.write("</td>\n</tr>\n");
530    // 246, 1
531    
532        }  else {
533        
534    // 249, 1
535    {
536      // 249, 1
537      __jamon_innerUnit__emptyStat(jamonWriter, serverName);
538    }
539    // 249, 40
540    jamonWriter.write("\n");
541    // 250, 1
542    
543        }
544}
545
546    // 254, 1
547    jamonWriter.write("</tbody>\n</table>\n");
548  }
549  
550  
551  // 456, 1
552  private void __jamon_innerUnit__serverNameLink(final java.io.Writer jamonWriter, final ServerName serverName)
553    throws java.io.IOException
554  {
555    // 460, 9
556    
557        int infoPort = master.getRegionServerInfoPort(serverName);
558        String url = "//" + serverName.getHostname() + ":" + infoPort + "/rs-status";
559        
560    // 465, 9
561    if (infoPort > 0)
562    {
563      // 465, 28
564      jamonWriter.write("\n            <a href=\"");
565      // 466, 22
566      org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(url), jamonWriter);
567      // 466, 31
568      jamonWriter.write("\">");
569      // 466, 33
570      org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(serverName.getServerName()), jamonWriter);
571      // 466, 65
572      jamonWriter.write("</a>\n        ");
573    }
574    // 467, 9
575    else
576    {
577      // 467, 16
578      jamonWriter.write("\n            ");
579      // 468, 13
580      org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(serverName.getServerName()), jamonWriter);
581      // 468, 45
582      jamonWriter.write("\n        ");
583    }
584    // 469, 15
585    jamonWriter.write("\n");
586  }
587  
588  
589  // 259, 1
590  private void __jamon_innerUnit__storeStats(final java.io.Writer jamonWriter, final ServerName[] serverNames)
591    throws java.io.IOException
592  {
593    // 263, 1
594    jamonWriter.write("<table id=\"storeStatsTable\" class=\"tablesorter table table-striped\">\n<thead>\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</thead>\n<tbody>\n");
595    // 276, 1
596    
597final String ZEROKB = "0 KB";
598final String ZEROMB = "0 MB";
599String storeUncompressedSizeMBStr = ZEROMB;
600String storeFileSizeMBStr = ZEROMB;
601String totalStaticIndexSizeKBStr = ZEROKB;
602String totalStaticBloomSizeKBStr = ZEROKB;
603for (ServerName serverName: serverNames) {
604
605ServerMetrics sl = master.getServerManager().getLoad(serverName);
606if (sl != null) {
607  long storeCount = 0;
608  long storeFileCount = 0;
609  long storeUncompressedSizeMB = 0;
610  long storeFileSizeMB = 0;
611  long totalStaticIndexSizeKB = 0;
612  long totalStaticBloomSizeKB = 0;
613  for (RegionMetrics rl : sl.getRegionMetrics().values()) {
614    storeCount += rl.getStoreCount();
615    storeFileCount += rl.getStoreFileCount();
616    storeUncompressedSizeMB += rl.getUncompressedStoreFileSize().get(Size.Unit.MEGABYTE);
617    storeFileSizeMB += rl.getStoreFileSize().get(Size.Unit.MEGABYTE);
618    totalStaticIndexSizeKB += rl.getStoreFileUncompressedDataIndexSize().get(Size.Unit.KILOBYTE);
619    totalStaticBloomSizeKB += rl.getBloomFilterSize().get(Size.Unit.KILOBYTE);
620  }
621  if (storeUncompressedSizeMB > 0) {
622     storeUncompressedSizeMBStr = TraditionalBinaryPrefix.
623     long2String(storeUncompressedSizeMB * TraditionalBinaryPrefix.MEGA.value, "B", 1);
624  }
625  if (storeFileSizeMB > 0) {
626     storeFileSizeMBStr = TraditionalBinaryPrefix.
627     long2String(storeFileSizeMB * TraditionalBinaryPrefix.MEGA.value, "B", 1);
628  }
629  if (totalStaticIndexSizeKB > 0) {
630     totalStaticIndexSizeKBStr = TraditionalBinaryPrefix.
631     long2String(totalStaticIndexSizeKB * TraditionalBinaryPrefix.KILO.value, "B", 1);
632  }
633  if (totalStaticBloomSizeKB > 0) {
634     totalStaticBloomSizeKBStr = TraditionalBinaryPrefix.
635     long2String(totalStaticBloomSizeKB * TraditionalBinaryPrefix.KILO.value, "B", 1);
636  }
637
638    // 318, 1
639    jamonWriter.write("<tr>\n<td>");
640    // 319, 5
641    {
642      // 319, 5
643      __jamon_innerUnit__serverNameLink(jamonWriter, serverName);
644    }
645    // 319, 49
646    jamonWriter.write("</td>\n<td>");
647    // 320, 5
648    org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(storeCount), jamonWriter);
649    // 320, 21
650    jamonWriter.write("</td>\n<td>");
651    // 321, 5
652    org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(storeFileCount), jamonWriter);
653    // 321, 25
654    jamonWriter.write("</td>\n<td>");
655    // 322, 5
656    org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(storeUncompressedSizeMBStr), jamonWriter);
657    // 322, 37
658    jamonWriter.write("</td>\n<td>");
659    // 323, 5
660    org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(storeFileSizeMBStr), jamonWriter);
661    // 323, 29
662    jamonWriter.write("</td>\n<td>");
663    // 324, 5
664    org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(totalStaticIndexSizeKBStr), jamonWriter);
665    // 324, 36
666    jamonWriter.write("</td>\n<td>");
667    // 325, 5
668    org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(totalStaticBloomSizeKBStr), jamonWriter);
669    // 325, 36
670    jamonWriter.write("</td>\n</tr>\n");
671    // 327, 1
672    
673        }  else {
674        
675    // 330, 1
676    {
677      // 330, 1
678      __jamon_innerUnit__emptyStat(jamonWriter, serverName);
679    }
680    // 330, 40
681    jamonWriter.write("\n");
682    // 331, 1
683    
684    }
685}
686
687    // 335, 1
688    jamonWriter.write("</tbody>\n</table>\n");
689  }
690  
691  
692}