001// Autogenerated Jamon implementation
002// /home/vagrant/repos/hbase/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/regionserver/ReplicationStatusTmpl.jamon
003
004package org.apache.hadoop.hbase.tmpl.regionserver;
005
006// 23, 9
007import java.util.*;
008// 24, 9
009import java.util.Map.Entry;
010// 25, 9
011import org.apache.hadoop.hbase.procedure2.util.StringUtils;
012// 26, 9
013import org.apache.hadoop.hbase.regionserver.HRegionServer;
014// 27, 9
015import org.apache.hadoop.hbase.replication.regionserver.ReplicationStatus;
016
017public class ReplicationStatusTmplImpl
018  extends org.jamon.AbstractTemplateImpl
019  implements org.apache.hadoop.hbase.tmpl.regionserver.ReplicationStatusTmpl.Intf
020
021{
022  private final HRegionServer regionServer;
023  protected static org.apache.hadoop.hbase.tmpl.regionserver.ReplicationStatusTmpl.ImplData __jamon_setOptionalArguments(org.apache.hadoop.hbase.tmpl.regionserver.ReplicationStatusTmpl.ImplData p_implData)
024  {
025    return p_implData;
026  }
027  public ReplicationStatusTmplImpl(org.jamon.TemplateManager p_templateManager, org.apache.hadoop.hbase.tmpl.regionserver.ReplicationStatusTmpl.ImplData p_implData)
028  {
029    super(p_templateManager, __jamon_setOptionalArguments(p_implData));
030    regionServer = p_implData.getRegionServer();
031  }
032  
033  @Override public void renderNoFlush(final java.io.Writer jamonWriter)
034    throws java.io.IOException
035  {
036    // 30, 1
037    
038        Map<String, ReplicationStatus> walGroupsReplicationStatus = regionServer.getWalGroupsReplicationStatus();
039
040    // 34, 1
041    if ((walGroupsReplicationStatus != null && walGroupsReplicationStatus.size() > 0) )
042    {
043      // 34, 86
044      jamonWriter.write("\n\n    <div class=\"tabbable\">\n        <ul class=\"nav nav-pills\">\n            <li class=\"active\"><a href=\"#tab_currentLog\" data-toggle=\"tab\">Current Log</a> </li>\n            <li class=\"\"><a href=\"#tab_replicationDelay\" data-toggle=\"tab\">Replication Delay</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_currentLog\">\n                ");
045      // 43, 17
046      {
047        // 43, 17
048        __jamon_innerUnit__currentLog(jamonWriter, walGroupsReplicationStatus);
049      }
050      // 43, 72
051      jamonWriter.write("\n            </div>\n            <div class=\"tab-pane\" id=\"tab_replicationDelay\">\n                ");
052      // 46, 17
053      {
054        // 46, 17
055        __jamon_innerUnit__replicationDelay(jamonWriter, walGroupsReplicationStatus);
056      }
057      // 46, 78
058      jamonWriter.write("\n            </div>\n        </div>\n    </div>\n    <p> If the replication delay is UNKNOWN, that means this walGroup doesn't start replicate yet and it may get disabled.\n    If the size of log is 0, it means we are replicating current HLog, thus we can't get accurate size since it's not closed yet.</p>\n\n");
059    }
060    // 53, 1
061    else
062    {
063      // 53, 8
064      jamonWriter.write("\n    <p>No Replication Metrics for Peers</p>\n");
065    }
066    // 55, 7
067    jamonWriter.write("\n\n");
068  }
069  
070  
071  // 57, 1
072  private void __jamon_innerUnit__currentLog(final java.io.Writer jamonWriter, final Map<String,ReplicationStatus> metrics)
073    throws java.io.IOException
074  {
075    // 61, 5
076    jamonWriter.write("<table class=\"table table-striped\">\n        <tr>\n            <th>PeerId</th>\n            <th>WalGroup</th>\n            <th>Current Log</th>\n            <th>Size</th>\n            <th>Queue Size</th>\n            <th>Offset</th>\n        </tr>\n            ");
077    // 70, 13
078    for (Map.Entry<String, ReplicationStatus> entry: metrics.entrySet() )
079    {
080      // 70, 84
081      jamonWriter.write("\n                 <tr>\n                     <td>");
082      // 72, 26
083      org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(entry.getValue().getPeerId()), jamonWriter);
084      // 72, 60
085      jamonWriter.write("</td>\n                     <td>");
086      // 73, 26
087      org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(entry.getValue().getWalGroup()), jamonWriter);
088      // 73, 62
089      jamonWriter.write("</td>\n                     <td>");
090      // 74, 26
091      org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(entry.getValue().getCurrentPath()), jamonWriter);
092      // 74, 65
093      jamonWriter.write(" </td>\n                     <td>");
094      // 75, 26
095      org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(StringUtils.humanSize(entry.getValue().getFileSize())), jamonWriter);
096      // 75, 85
097      jamonWriter.write("</td>\n                     <td>");
098      // 76, 26
099      org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(entry.getValue().getQueueSize()), jamonWriter);
100      // 76, 63
101      jamonWriter.write("</td>\n                     <td>");
102      // 77, 26
103      org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(StringUtils.humanSize(entry.getValue().getCurrentPosition())), jamonWriter);
104      // 77, 92
105      jamonWriter.write("</td>\n                 </tr>\n            ");
106    }
107    // 79, 20
108    jamonWriter.write("\n    </table>\n");
109  }
110  
111  
112  // 83, 1
113  private void __jamon_innerUnit__replicationDelay(final java.io.Writer jamonWriter, final Map<String,ReplicationStatus> metrics)
114    throws java.io.IOException
115  {
116    // 87, 5
117    jamonWriter.write("<table class=\"table table-striped\">\n        <tr>\n            <th>PeerId</th>\n            <th>WalGroup</th>\n            <th>Current Log</th>\n            <th>Last Shipped Age</th>\n            <th>Replication Delay</th>\n        </tr>\n            ");
118    // 95, 13
119    for (Map.Entry<String, ReplicationStatus> entry: metrics.entrySet() )
120    {
121      // 95, 84
122      jamonWriter.write("\n                 <tr>\n                     <td>");
123      // 97, 26
124      org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(entry.getValue().getPeerId()), jamonWriter);
125      // 97, 60
126      jamonWriter.write("</td>\n                     <td>");
127      // 98, 26
128      org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(entry.getValue().getWalGroup()), jamonWriter);
129      // 98, 62
130      jamonWriter.write("</td>\n                     <td>");
131      // 99, 26
132      org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(entry.getValue().getCurrentPath()), jamonWriter);
133      // 99, 65
134      jamonWriter.write(" </td>\n                     <td>");
135      // 100, 26
136      org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(StringUtils.humanTimeDiff(entry.getValue().getAgeOfLastShippedOp())), jamonWriter);
137      // 100, 99
138      jamonWriter.write("</td>\n                     <td>");
139      // 101, 26
140      org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(entry.getValue().getReplicationDelay() == Long.MAX_VALUE ? "UNKNOWN" : StringUtils.humanTimeDiff(entry.getValue().getReplicationDelay())), jamonWriter);
141      // 101, 168
142      jamonWriter.write("</td>\n                 </tr>\n            ");
143    }
144    // 103, 20
145    jamonWriter.write("\n    </table>\n");
146  }
147  
148  
149}