View Javadoc

1   // Autogenerated Jamon implementation
2   // /Users/stack/checkouts/hbase.git.commit/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/regionserver/RegionListTmpl.jamon
3   
4   package org.apache.hadoop.hbase.tmpl.regionserver;
5   
6   // 24, 9
7   import java.util.*;
8   // 25, 9
9   import org.apache.commons.math.stat.descriptive.DescriptiveStatistics;
10  // 26, 9
11  import org.apache.hadoop.hbase.regionserver.HRegionServer;
12  // 27, 9
13  import org.apache.hadoop.hbase.util.Bytes;
14  // 28, 9
15  import org.apache.hadoop.hbase.HRegionInfo;
16  // 29, 9
17  import org.apache.hadoop.hbase.regionserver.HRegion;
18  // 30, 9
19  import org.apache.hadoop.hbase.ServerName;
20  // 31, 9
21  import org.apache.hadoop.hbase.HBaseConfiguration;
22  // 32, 9
23  import org.apache.hadoop.hbase.protobuf.ProtobufUtil;
24  // 33, 9
25  import org.apache.hadoop.hbase.protobuf.generated.AdminProtos.ServerInfo;
26  // 34, 9
27  import org.apache.hadoop.hbase.protobuf.generated.ClusterStatusProtos.RegionLoad;
28  // 35, 9
29  import org.apache.hadoop.hbase.client.RegionReplicaUtil;
30  // 36, 9
31  import org.apache.hadoop.hbase.regionserver.MetricsRegionWrapper;
32  
33  public class RegionListTmplImpl
34    extends org.jamon.AbstractTemplateImpl
35    implements org.apache.hadoop.hbase.tmpl.regionserver.RegionListTmpl.Intf
36  
37  {
38    private final HRegionServer regionServer;
39    private final List<HRegionInfo> onlineRegions;
40    protected static org.apache.hadoop.hbase.tmpl.regionserver.RegionListTmpl.ImplData __jamon_setOptionalArguments(org.apache.hadoop.hbase.tmpl.regionserver.RegionListTmpl.ImplData p_implData)
41    {
42      return p_implData;
43    }
44    public RegionListTmplImpl(org.jamon.TemplateManager p_templateManager, org.apache.hadoop.hbase.tmpl.regionserver.RegionListTmpl.ImplData p_implData)
45    {
46      super(p_templateManager, __jamon_setOptionalArguments(p_implData));
47      regionServer = p_implData.getRegionServer();
48      onlineRegions = p_implData.getOnlineRegions();
49    }
50    
51    public void renderNoFlush(@SuppressWarnings({"unused","hiding"}) final java.io.Writer jamonWriter)
52      throws java.io.IOException
53    {
54      // 38, 1
55      if ((onlineRegions != null && onlineRegions.size() > 0) )
56      {
57        // 38, 60
58        jamonWriter.write("\n\n    ");
59        // 40, 5
60        
61          Collections.sort(onlineRegions);
62      
63        // 44, 5
64        jamonWriter.write("<div class=\"tabbable\">\n        <ul class=\"nav nav-pills\">\n            <li class=\"active\"><a href=\"#tab_regionBaseInfo\" data-toggle=\"tab\">Base Info</a> </li>\n            <li><a href=\"#tab_regionRequestStats\" data-toggle=\"tab\">Request metrics</a></li>\n            <li class=\"\"><a href=\"#tab_regionStoreStats\" data-toggle=\"tab\">Storefile Metrics</a></li>\n            <li class=\"\"><a href=\"#tab_regionMemstoreStats\" data-toggle=\"tab\">Memstore Metrics</a></li>\n            <li class=\"\"><a href=\"#tab_regionCompactStats\" data-toggle=\"tab\">Compaction Metrics</a></li>\n            <li class=\"\"><a href=\"#tab_coprocessorStats\" data-toggle=\"tab\">Coprocessor Metrics</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_regionBaseInfo\">\n                ");
65        // 55, 17
66        {
67          // 55, 17
68          __jamon_innerUnit__baseInfo(jamonWriter, onlineRegions);
69        }
70        // 55, 63
71        jamonWriter.write("\n            </div>\n            <div class=\"tab-pane\" id=\"tab_regionRequestStats\">\n                ");
72        // 58, 17
73        {
74          // 58, 17
75          __jamon_innerUnit__requestStats(jamonWriter, onlineRegions);
76        }
77        // 58, 67
78        jamonWriter.write("\n            </div>\n            <div class=\"tab-pane\" id=\"tab_regionStoreStats\">\n                ");
79        // 61, 17
80        {
81          // 61, 17
82          __jamon_innerUnit__storeStats(jamonWriter, onlineRegions);
83        }
84        // 61, 65
85        jamonWriter.write("\n            </div>\n            <div class=\"tab-pane\" id=\"tab_regionMemstoreStats\">\n                ");
86        // 64, 17
87        {
88          // 64, 17
89          __jamon_innerUnit__memstoreStats(jamonWriter, onlineRegions);
90        }
91        // 64, 68
92        jamonWriter.write("\n            </div>\n            <div class=\"tab-pane\" id=\"tab_regionCompactStats\">\n                ");
93        // 67, 17
94        {
95          // 67, 17
96          __jamon_innerUnit__compactStats(jamonWriter, onlineRegions);
97        }
98        // 67, 67
99        jamonWriter.write("\n            </div>\n            <div class=\"tab-pane\" id=\"tab_coprocessorStats\">\n                ");
100       // 70, 17
101       {
102         // 70, 17
103         __jamon_innerUnit__coprocessorStats(jamonWriter, onlineRegions);
104       }
105       // 70, 71
106       jamonWriter.write("\n            </div>\n        </div>\n    </div>\n    <p>Region names are made of the containing table's name, a comma,\n    the start key, a comma, and a randomly generated region id.  To illustrate,\n    the region named\n    <em>domains,apache.org,5464829424211263407</em> is party to the table\n    <em>domains</em>, has an id of <em>5464829424211263407</em> and the first key\n    in the region is <em>apache.org</em>.  The <em>hbase:meta</em> 'table' is an internal\n    system table (or 'catalog' tables in db-speak).\n    The hbase:meta table keeps a list of all regions in the system. The empty key is used to denote\n    table start and table end.  A region with an empty start key is the first region in a table.\n    If region has both an empty start and an empty end key, its the only region in the table.  See\n    <a href=\"http://hbase.org\">HBase Home</a> for further explication.<p>\n");
107     }
108     // 85, 1
109     else
110     {
111       // 85, 8
112       jamonWriter.write("\n    <p>Not serving regions</p>\n");
113     }
114     // 87, 7
115     jamonWriter.write("\n\n");
116   }
117   
118   
119   // 115, 1
120   private void __jamon_innerUnit__requestStats(@SuppressWarnings({"unused","hiding"}) final java.io.Writer jamonWriter, final List<HRegionInfo> onlineRegions)
121     throws java.io.IOException
122   {
123     // 119, 5
124     jamonWriter.write("<table class=\"table table-striped\">\n        <tr>\n            <th>Region Name</th>\n            <th>Read Request Count</th>\n            <th>Write Request Count</th>\n        </tr>\n\n        ");
125     // 126, 9
126     for (HRegionInfo r: onlineRegions )
127     {
128       // 126, 46
129       jamonWriter.write("\n\n        <tr>\n        ");
130       // 129, 9
131       
132             RegionLoad load = regionServer.createRegionLoad(r.getEncodedName());
133         
134       // 132, 13
135       jamonWriter.write("<td>");
136       // 132, 17
137       org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(HRegionInfo.getRegionNameAsStringForDisplay(r,
138                                            regionServer.getConfiguration())), jamonWriter);
139       // 133, 79
140       jamonWriter.write("</td>\n            ");
141       // 134, 13
142       if (load != null )
143       {
144         // 134, 33
145         jamonWriter.write("\n            <td>");
146         // 135, 17
147         org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(load.getReadRequestsCount()), jamonWriter);
148         // 135, 50
149         jamonWriter.write("</td>\n            <td>");
150         // 136, 17
151         org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(load.getWriteRequestsCount()), jamonWriter);
152         // 136, 51
153         jamonWriter.write("</td>\n            ");
154       }
155       // 137, 19
156       jamonWriter.write("\n        </tr>\n        ");
157     }
158     // 139, 16
159     jamonWriter.write("\n    </table>\n");
160   }
161   
162   
163   // 216, 1
164   private void __jamon_innerUnit__memstoreStats(@SuppressWarnings({"unused","hiding"}) final java.io.Writer jamonWriter, final List<HRegionInfo> onlineRegions)
165     throws java.io.IOException
166   {
167     // 220, 5
168     jamonWriter.write("<table class=\"table table-striped\">\n        <tr>\n            <th>Region Name</th>\n            <th>Memstore Size</th>\n        </tr>\n\n        ");
169     // 226, 9
170     for (HRegionInfo r: onlineRegions )
171     {
172       // 226, 46
173       jamonWriter.write("\n\n        <tr>\n        ");
174       // 229, 9
175       
176             RegionLoad load = regionServer.createRegionLoad(r.getEncodedName());
177         
178       // 232, 13
179       jamonWriter.write("<td>");
180       // 232, 17
181       org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(HRegionInfo.getRegionNameAsStringForDisplay(r,
182                                            regionServer.getConfiguration())), jamonWriter);
183       // 233, 79
184       jamonWriter.write("</td>\n            ");
185       // 234, 13
186       if (load != null )
187       {
188         // 234, 33
189         jamonWriter.write("\n            <td>");
190         // 235, 17
191         org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(load.getMemstoreSizeMB()), jamonWriter);
192         // 235, 47
193         jamonWriter.write("m</td>\n            ");
194       }
195       // 236, 19
196       jamonWriter.write("\n        </tr>\n        ");
197     }
198     // 238, 16
199     jamonWriter.write("\n    </table>\n");
200   }
201   
202   
203   // 181, 1
204   private void __jamon_innerUnit__compactStats(@SuppressWarnings({"unused","hiding"}) final java.io.Writer jamonWriter, final List<HRegionInfo> onlineRegions)
205     throws java.io.IOException
206   {
207     // 185, 5
208     jamonWriter.write("<table class=\"table table-striped\">\n        <tr>\n            <th>Region Name</th>\n            <th>Num. Compacting KVs</th>\n            <th>Num. Compacted KVs</th>\n            <th>Compaction Progress</th>\n        </tr>\n\n        ");
209     // 193, 9
210     for (HRegionInfo r: onlineRegions )
211     {
212       // 193, 46
213       jamonWriter.write("\n\n        <tr>\n        ");
214       // 196, 9
215       
216             RegionLoad load = regionServer.createRegionLoad(r.getEncodedName());
217             String percentDone = "";
218             if  (load != null && load.getTotalCompactingKVs() > 0) {
219             percentDone = String.format("%.2f", 100 *
220             ((float) load.getCurrentCompactedKVs() / load.getTotalCompactingKVs())) + "%";
221             }
222         
223       // 204, 13
224       jamonWriter.write("<td>");
225       // 204, 17
226       org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(HRegionInfo.getRegionNameAsStringForDisplay(r,
227                                            regionServer.getConfiguration())), jamonWriter);
228       // 205, 79
229       jamonWriter.write("</td>\n            ");
230       // 206, 13
231       if (load != null )
232       {
233         // 206, 33
234         jamonWriter.write("\n            <td>");
235         // 207, 17
236         org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(load.getTotalCompactingKVs()), jamonWriter);
237         // 207, 51
238         jamonWriter.write("</td>\n            <td>");
239         // 208, 17
240         org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(load.getCurrentCompactedKVs()), jamonWriter);
241         // 208, 52
242         jamonWriter.write("</td>\n            <td>");
243         // 209, 17
244         org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(percentDone), jamonWriter);
245         // 209, 34
246         jamonWriter.write("</td>\n            ");
247       }
248       // 210, 19
249       jamonWriter.write("\n        </tr>\n        ");
250     }
251     // 212, 16
252     jamonWriter.write("\n    </table>\n");
253   }
254   
255   
256   // 89, 1
257   private void __jamon_innerUnit__baseInfo(@SuppressWarnings({"unused","hiding"}) final java.io.Writer jamonWriter, final List<HRegionInfo> onlineRegions)
258     throws java.io.IOException
259   {
260     // 93, 5
261     jamonWriter.write("<table class=\"table table-striped\">\n        <tr>\n            <th>Region Name</th>\n            <th>Start Key</th>\n            <th>End Key</th>\n            <th>ReplicaID</th>\n        </tr>\n\n        ");
262     // 101, 9
263     for (HRegionInfo r: onlineRegions )
264     {
265       // 101, 46
266       jamonWriter.write("\n        <tr>\n            <td>");
267       // 103, 17
268       org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(HRegionInfo.getRegionNameAsStringForDisplay(r,
269                                         regionServer.getConfiguration())), jamonWriter);
270       // 104, 76
271       jamonWriter.write("</td>\n            <td>");
272       // 105, 17
273       org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(Bytes.toStringBinary(HRegionInfo.getStartKeyForDisplay(r,
274                                         regionServer.getConfiguration()))), jamonWriter);
275       // 106, 77
276       jamonWriter.write("</td>\n            <td>");
277       // 107, 17
278       org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(Bytes.toStringBinary(HRegionInfo.getEndKeyForDisplay(r,
279                                         regionServer.getConfiguration()))), jamonWriter);
280       // 108, 77
281       jamonWriter.write("</td>\n            <td>");
282       // 109, 17
283       org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(r.getReplicaId()), jamonWriter);
284       // 109, 39
285       jamonWriter.write("</td>\n        </tr>\n        ");
286     }
287     // 111, 16
288     jamonWriter.write("\n    </table>\n");
289   }
290   
291   
292   // 144, 1
293   private void __jamon_innerUnit__storeStats(@SuppressWarnings({"unused","hiding"}) final java.io.Writer jamonWriter, final List<HRegionInfo> onlineRegions)
294     throws java.io.IOException
295   {
296     // 148, 5
297     jamonWriter.write("<table class=\"table table-striped\">\n        <tr>\n            <th>Region Name</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\n        ");
298     // 159, 9
299     for (HRegionInfo r: onlineRegions )
300     {
301       // 159, 46
302       jamonWriter.write("\n\n        <tr>\n        ");
303       // 162, 9
304       
305             RegionLoad load = regionServer.createRegionLoad(r.getEncodedName());
306         
307       // 165, 13
308       jamonWriter.write("<td>");
309       // 165, 17
310       org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(HRegionInfo.getRegionNameAsStringForDisplay(r,
311                                            regionServer.getConfiguration())), jamonWriter);
312       // 166, 79
313       jamonWriter.write("</td>\n            ");
314       // 167, 13
315       if (load != null )
316       {
317         // 167, 33
318         jamonWriter.write("\n            <td>");
319         // 168, 17
320         org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(load.getStores()), jamonWriter);
321         // 168, 39
322         jamonWriter.write("</td>\n            <td>");
323         // 169, 17
324         org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(load.getStorefiles()), jamonWriter);
325         // 169, 43
326         jamonWriter.write("</td>\n            <td>");
327         // 170, 17
328         org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(load.getStoreUncompressedSizeMB()), jamonWriter);
329         // 170, 56
330         jamonWriter.write("m</td>\n            <td>");
331         // 171, 17
332         org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(load.getStorefileSizeMB()), jamonWriter);
333         // 171, 48
334         jamonWriter.write("m</td>\n            <td>");
335         // 172, 17
336         org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(load.getTotalStaticIndexSizeKB()), jamonWriter);
337         // 172, 55
338         jamonWriter.write("k</td>\n            <td>");
339         // 173, 17
340         org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(load.getTotalStaticBloomSizeKB()), jamonWriter);
341         // 173, 55
342         jamonWriter.write("k</td>\n            ");
343       }
344       // 174, 19
345       jamonWriter.write("\n        </tr>\n        ");
346     }
347     // 176, 16
348     jamonWriter.write("\n    </table>\n");
349   }
350   
351   
352   // 242, 1
353   private void __jamon_innerUnit__coprocessorStats(@SuppressWarnings({"unused","hiding"}) final java.io.Writer jamonWriter, final List<HRegionInfo> onlineRegions)
354     throws java.io.IOException
355   {
356     // 246, 5
357     jamonWriter.write("<table class=\"table table-striped\">\n        <tr>\n            <th>Region Name</th>\n            <th>Coprocessor</th>\n            <th>Execution Time Statistics</th>\n        </tr>\n\n        ");
358     // 253, 9
359     for (HRegionInfo r: onlineRegions )
360     {
361       // 253, 46
362       jamonWriter.write("\n        ");
363       // 254, 9
364           
365             HRegion region = regionServer.getFromOnlineRegions(r.getEncodedName());
366             MetricsRegionWrapper mWrap = region == null ? null: region.getMetrics().getRegionWrapper();
367         
368       // 259, 9
369       if (mWrap != null )
370       {
371         // 259, 30
372         jamonWriter.write("\n\n            ");
373         // 261, 13
374         for (Map.Entry<String, DescriptiveStatistics> entry: mWrap.getCoprocessorExecutionStatistics().entrySet() )
375         {
376           // 261, 122
377           jamonWriter.write("\n            <tr>\n                ");
378           // 263, 17
379           
380                     String coprocessorName = entry.getKey();
381                     DescriptiveStatistics ds = entry.getValue();
382                 
383           // 267, 17
384           jamonWriter.write("<td>");
385           // 267, 21
386           org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(r.getRegionNameAsString()), jamonWriter);
387           // 267, 52
388           jamonWriter.write("</td>\n                <td>");
389           // 268, 21
390           org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(coprocessorName), jamonWriter);
391           // 268, 42
392           jamonWriter.write("</td>\n                <td>\n                <table class=\"table-condensed\">\n                <tr>\n                    <td>Min Time </td>\n                    <td>");
393           // 273, 25
394           org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(String.format("%.3f%n", ds.getMin()/1000/1000)), jamonWriter);
395           // 273, 77
396           jamonWriter.write("ms</td>\n                </tr>\n                <tr>\n                    <td>Avg Time </td>\n                    <td>");
397           // 277, 25
398           org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(String.format("%.3f%n", ds.getMean()/1000/1000)), jamonWriter);
399           // 277, 78
400           jamonWriter.write("ms</td>\n                </tr>\n                <tr>\n                    <td>Max Time </td>\n                    <td>");
401           // 281, 25
402           org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(String.format("%.3f%n", ds.getMax()/1000/1000)), jamonWriter);
403           // 281, 77
404           jamonWriter.write("ms</td>\n                </tr>\n                <tr>\n                    <td>90th percentile </td>\n                    <td>");
405           // 285, 25
406           org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(String.format("%.3f%n", ds.getPercentile(90d)/1000/1000)), jamonWriter);
407           // 285, 87
408           jamonWriter.write("ms</td>\n                </tr>\n                <tr>\n                    <td>95th percentile </td>\n                    <td>");
409           // 289, 25
410           org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(String.format("%.3f%n", ds.getPercentile(95d)/1000/1000)), jamonWriter);
411           // 289, 87
412           jamonWriter.write("ms</td>\n                </tr>\n                <tr>\n                    <td>99th percentile </td>\n                    <td>");
413           // 293, 25
414           org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(String.format("%.3f%n", ds.getPercentile(99d)/1000/1000)), jamonWriter);
415           // 293, 87
416           jamonWriter.write("ms</td>\n                </tr>\n                </table>\n                </td>\n            </tr>\n            ");
417         }
418         // 298, 20
419         jamonWriter.write("\n        ");
420       }
421       // 299, 15
422       jamonWriter.write("\n        ");
423     }
424     // 300, 16
425     jamonWriter.write("\n    </table>\n");
426   }
427   
428   
429 }