com.bigdata.counters.render
Class PivotTableRenderer

java.lang.Object
  extended by com.bigdata.counters.render.PivotTableRenderer
All Implemented Interfaces:
IRenderer
Direct Known Subclasses:
TabDelimitedPivotTableRenderer, XHTMLRenderer.HTMLPivotTableRenderer

public abstract class PivotTableRenderer
extends Object
implements IRenderer

Writes out a pivot table containing the histories for the selected counters. Sample output is:

 Minutes  Timestamp    hostname indexName   indexPartitionName  readSecs    writeSecs   leafSplits  tailSplits
 0    1:41PM  blade8  spo spo#12  0.12    0.3 10  4
 0    1:41PM  blade8  spo spo#14  0.01    0.2 20  1
 
There are two time columns. One gives the #of elapsed units and the column header is the specified basePeriod and will be zero for the first row and is incremented by one each time we move into another sampling period for the given PeriodEnum. The other time column is the timestamp associated with the row. The format of that timestamp is specified by URLQueryModel.timestampFormat.

In this example, there are three category columns (hostname, indexName, and indexPartitionName). The category columns were selected by the capturing groups in URLQueryModel.pattern and take on different values for each row in the table. In order to get nice column names you MUST specify the column names using the URLQueryModel.CATEGORY URL query parameter. The given category column names are used in order and synthetic column names are generated if none (or not enough) were specified in the URLQueryModel.

In this example, there are four value columns. Each vlaue column corresponds to an ICounter whose path was matched by the URLQueryModel.pattern.

Note: The orientation of the data in the pivot table view is different from the data in the correlated view. The pivot table puts each set of cells having the same values for the category columns onto a single line. Those cells are choosen by a read cross the columns in a given row of the HistoryTable. The timestamp columns correspond to the current row of the history table and are therefore repeated if there is more than one set of distinct ordered bindings for the category column values in the selected counters.

Note: The counter sets are designed as regular hierarchies: we often find the "same" counter name under different paths. For example:

   indices/TERM2ID/TERM2ID#0/IO/writeSecs
   indices/TERM2ID/TERM2ID#2/IO/writeSecs
   indices/SPO/SPO#7/IO/writeSecs
   Live Journal/IO/writeSecs
 
All of these have a "writeSecs" counter. However, the first 3 are in essence the same counter, just for a different resource index, while the last one is a counter for a journal resource.

The Pattern

 
 .*\Qindices/\E(.*)\Q/IO/writeSecs\E
 
 
would match only the first three rows and would capture
 [TERM2ID/TERM2ID#0]
 [TERM2ID/TERM2ID#2]
 [SPO/SPO#7]
 
You can also capture additional groups, such as the name of the host on which the data service was running within which the index partition is living. Those capture groups might look like:
 [blade2, TERM2ID/TERM2ID#0]
 [blade3, TERM2ID/TERM2ID#2]
 [blade2, SPO/SPO#7]
 
There will be only one "writeSecs" value column in the generated pivot table. The performance ICounter for a given resource will be reported under that "writeSecs" column in a row whose category column values are identical to the captured groups for that ICounterNode.getPath().

Note: When switching from a pivot table view to a correlated view be sure that you DO NOT use a capturing group for the counter name (the last component of its path). That will give you a distinct row for every sample and blanks in the other value columns.

Version:
$Id: PivotTableRenderer.java 2265 2009-10-26 12:51:06Z thompsonbry $
Author:
Bryan Thompson
TODO:
automatically detect if the last capturing group captures the counter name and then drop that from the set of category columns. this will make it much easier to switch between a correlated view and a pivot view since you often want the counter name to be a capturing group for the pivot view.

Field Summary
protected  ValueFormatter formatter
           
protected static org.apache.log4j.Logger log
           
protected  PivotTable pt
           
 
Constructor Summary
protected PivotTableRenderer(PivotTable pt, ValueFormatter formatter)
           
 
Method Summary
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.bigdata.counters.render.IRenderer
render
 

Field Detail

log

protected static final org.apache.log4j.Logger log

pt

protected final PivotTable pt

formatter

protected final ValueFormatter formatter
Constructor Detail

PivotTableRenderer

protected PivotTableRenderer(PivotTable pt,
                             ValueFormatter formatter)


Copyright © 2006-2009 SYSTAP, LLC. All Rights Reserved.