|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--com.grandcentral.appstats.impl.StatImpl
Base Stat implementation
Copyright: Copyright (c) 2002
Company: Grand Central Communications
| Field Summary | |
protected double |
m_aDouble
|
protected int |
m_aggr
|
protected long |
m_aLong
|
protected java.lang.String |
m_name
|
protected java.lang.Object |
m_obj
|
protected int |
m_type
|
| Fields inherited from interface com.grandcentral.appstats.Stat |
AGGREGATE_AVG, AGGREGATE_EXPAVG, AGGREGATE_MAX, AGGREGATE_MIN, AGGREGATE_REPLACE, AGGREGATE_SUM, DELIM_STATNAME, DELIM_STATPREFIX, DELIM_TASKPARENT, DONT_AGGREGATE, TYPE_DOUBLE, TYPE_HEIRARCH, TYPE_HIDDEN, TYPE_LONG, TYPE_OBJECT, TYPE_UNDEFINED |
| Constructor Summary | |
StatImpl()
|
|
| Method Summary | |
void |
addAggregationMethod(int agMethod)
add an aggregationMethod to this stat |
void |
addType(int type)
add a type to this stat |
java.lang.Object |
clone()
|
boolean |
containsAggregationMethod(int agMethod)
returns true if this Stat is configured with param agMethod |
boolean |
containsType(int type)
returns true if this Stat is configured with param type |
static java.lang.String |
createFullName(java.lang.String taskHierarchy,
java.lang.String statName)
creates a fullname from the different components. |
static java.lang.String |
createFullName(java.lang.String taskHierarchy,
java.lang.String prefix,
java.lang.String suffix)
creates a fullname from the different components. |
static java.lang.String |
createStatName(java.lang.String prefix,
java.lang.String suffix)
creates a statName from the different components. |
void |
fromStringAbbr(java.lang.String s)
parses what it can from abbreviated form. |
int |
getAggregationMethod()
Returns the aggregation method for this stat. |
double |
getDouble()
|
java.lang.String |
getFullName()
A Stat's full name is composed of two distinct parts: a task hierarchy and a statName. |
long |
getLong()
|
java.lang.Object |
getObject()
|
java.lang.String |
getStatName()
A statName can be further broken down into a prefix and a suffix, as: |
static java.lang.String |
getStatName(java.lang.String fullname)
|
java.lang.String |
getStatPrefix()
|
static java.lang.String |
getStatPrefix(java.lang.String statname)
|
java.lang.String |
getStatSuffix()
|
static java.lang.String |
getStatSuffix(java.lang.String statname)
|
java.lang.String |
getTaskHierarchy()
returns the task hierarchy from the full name of this stat |
static java.lang.String |
getTaskHierarchy(java.lang.String fullname)
|
int |
getType()
Returns the type for this stat. |
static boolean |
isValidPrefix(java.lang.String name)
validates a prefix for a statName -- the name must not contain the DELIM_STATNAME character and must not be null |
static boolean |
isValidStatName(java.lang.String name)
validates a name for use for a Stat -- the name must not contain the DELIM_STATNAME character and must not be null |
static boolean |
isValidSuffix(java.lang.String suffix)
validates a suffix for a statName -- the suffix must not contain any DELIM_STATNAME or DELIM_STATPREFIX characters and must not be null |
static boolean |
isValidTaskName(java.lang.String taskname)
validates a taskname. |
void |
prependTaskName(java.lang.String taskname)
prepends taskname + StatSource.DELIM_PARENT to the fullname of this stat |
static java.lang.String |
prependTaskName(java.lang.String taskname,
java.lang.String fullname)
|
void |
removeAggregationMethod(int agMethod)
remove an aggregationMethod from this stat. |
void |
removeType(int type)
remove a type from this stat. |
void |
setAggregationMethod(int agMethod)
sets the aggregationMethod for this Stat. |
void |
setDouble(double num)
|
void |
setFullName(java.lang.String name)
sets the full name of this Stat. |
void |
setLong(long num)
|
void |
setObject(java.lang.Object o)
|
void |
setStatName(java.lang.String name)
sets the stat name. |
void |
setStatPrefix(java.lang.String name)
set the statName's prefix. |
void |
setStatSuffix(java.lang.String suffix)
|
void |
setTaskHierarchy(java.lang.String taskHierarchy)
sets the task hierarchy from the full name of this stat |
void |
setType(int type)
sets the type for this stat. |
java.lang.String |
toString()
|
java.lang.String |
toStringAbbr()
returns statName and values in String representation. |
void |
toStringAbbr(java.lang.StringBuffer s)
|
| Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
protected long m_aLong
protected double m_aDouble
protected java.lang.Object m_obj
protected int m_type
protected java.lang.String m_name
protected int m_aggr
| Constructor Detail |
public StatImpl()
| Method Detail |
public java.lang.Object clone()
throws java.lang.CloneNotSupportedException
clone in interface Statclone in class java.lang.Objectpublic java.lang.String getFullName()
Stat + Stat.DELIM_STATNAME + statNameStat.DELIM_STATNAME + statNamegetFullName in interface Statcom.grandcentral.appstats.StatStat.getStatName(),
Task.getName()public void setFullName(java.lang.String name)
StatsetFullName in interface StatNullPointerException - if name is nullpublic java.lang.String getStatName()
Stat
Stat.DELIM_STATPREFIX + suffixExamples:
httpTransactionLatency.minhttpTransactionLatency.maxhttpTransactionLatency.avggetStatName in interface Statcom.grandcentral.appstats.StatDELIM_STATPREFIX character)Stat.getFullName()public static java.lang.String getStatName(java.lang.String fullname)
public void setStatName(java.lang.String name)
StatsetStatName in interface Statjava.lang.IllegalArgumentException - if name is not validNullPointerException - if name is nullpublic java.lang.String getTaskHierarchy()
StatgetTaskHierarchy in interface Statcom.grandcentral.appstats.StatStat.getFullName()public static java.lang.String getTaskHierarchy(java.lang.String fullname)
public void setTaskHierarchy(java.lang.String taskHierarchy)
StatsetTaskHierarchy in interface Statcom.grandcentral.appstats.Statname - contains the task hierarchy, or can be null to clear this
Stat's taskHierarchyStat.getFullName()public void prependTaskName(java.lang.String taskname)
StatprependTaskName in interface Statcom.grandcentral.appstats.Statjava.lang.IllegalArgumentException - if taskname contains StatSource.DELIM_PARENT characterNullPointerException - if taskname is null
public static java.lang.String prependTaskName(java.lang.String taskname,
java.lang.String fullname)
public java.lang.String getStatPrefix()
getStatPrefix in interface Statcom.grandcentral.appstats.StatStat.getStatName()public static java.lang.String getStatPrefix(java.lang.String statname)
public void setStatPrefix(java.lang.String name)
StatDELIM_STATPREFIX character, nor the DELIM_STATNAME
character.setStatPrefix in interface Statcom.grandcentral.appstats.StatNullPointerException - if you try to set the name to a null valuejava.lang.IllegalArgumentException - if the name is invalidStat.getStatName()public java.lang.String getStatSuffix()
getStatSuffix in interface Statcom.grandcentral.appstats.StatDELIM_STATPREFIX character)Stat.getStatName(),
Stat.getStatPrefix()public static java.lang.String getStatSuffix(java.lang.String statname)
public void setStatSuffix(java.lang.String suffix)
setStatSuffix in interface Stat
public static java.lang.String createFullName(java.lang.String taskHierarchy,
java.lang.String statName)
taskHierarchy - can be nullstatName - can not be nullNullPointerException - if statName is nulljava.lang.IllegalArgumentException - if statName contains
illegal characters
public static java.lang.String createFullName(java.lang.String taskHierarchy,
java.lang.String prefix,
java.lang.String suffix)
taskHierarchy - can be nullprefix - must not be nullsuffix - must not be nullNullPointerException - if prefix or suffix is nulljava.lang.IllegalArgumentException - if prefix or suffix contains invalid characters
public static java.lang.String createStatName(java.lang.String prefix,
java.lang.String suffix)
prefix - must not be nullsuffix - must not be nullNullPointerException - if prefix or suffix is nulljava.lang.IllegalArgumentException - if prefix or suffix contains invalid characterspublic static boolean isValidStatName(java.lang.String name)
DELIM_STATNAME character and must not be nullpublic static boolean isValidPrefix(java.lang.String name)
DELIM_STATNAME character and must not be nullpublic static boolean isValidSuffix(java.lang.String suffix)
DELIM_STATNAME or DELIM_STATPREFIX characters and must not be nullpublic static boolean isValidTaskName(java.lang.String taskname)
DELIM_TASKPARENT character and must not be nullpublic int getType()
StatUsing multiple types in a stat allows for numerical comparison of string values, for instance, consider the case of a status Stat where you want the highest priority status of any task to filter down to the root task. You can set a numerical value along with a status String in each status Stat where numerically greater values correspond to more critical statae. Then call Stat.setAggregationMethod(AGGREGATE_MAX) and the status' stat will get filtered down in a task hierarchy so that if any child task has a high priority status the whole application will have that high priority status.
getType in interface Statcom.grandcentral.appstats.Statsee also the TYPE_{type} constantspublic void setType(int type)
StatsetType in interface Statpublic void addType(int type)
StataddType in interface Statpublic void removeType(int type)
StatremoveType in interface Statpublic boolean containsType(int type)
StatcontainsType in interface Statcom.grandcentral.appstats.Statpublic int getAggregationMethod()
StatAggregationMethods are used by StatAggregators when a Task aggregates Stats from another Task. Using a bitfield allows for multiple calculations to occur when a Stat is aggregated. For instance, when a timer statistic is aggregated, the aggregator will calculate minimum, maximum, and an exponential average value and place it into the destination task, because all Timers by default have aggregation methods of (AGGREGATE_MIN|AGGREGATE_MAX|AGGREGATE_EXPAVG)
AppStat's standard aggregation methods are stored in this class as AGGREGATE_* public static final ints. These values map to logic inside of the StatAggregatorImpl class. If a user wants to implement their own custom aggregation methods, they may use their own values and their own StatAggregator implementation. The standard aggregation methods are meant to cover 80-90% of the use cases, and that's why they are hardcoded into this class.
Alternatively, a user may also provide a StatCalculator to calculate further statistics on aggregation. (@see Task#registerStatCalculator)
getAggregationMethod in interface Statcom.grandcentral.appstats.Statsee also the AGGREGATE_{method} constantspublic void setAggregationMethod(int agMethod)
StatsetAggregationMethod in interface Statpublic void addAggregationMethod(int agMethod)
StataddAggregationMethod in interface Statpublic void removeAggregationMethod(int agMethod)
StatremoveAggregationMethod in interface Statpublic boolean containsAggregationMethod(int agMethod)
StatcontainsAggregationMethod in interface Statcom.grandcentral.appstats.Statpublic void setLong(long num)
setLong in interface Statpublic long getLong()
getLong in interface Statpublic void setDouble(double num)
setDouble in interface Statpublic double getDouble()
getDouble in interface Statpublic void setObject(java.lang.Object o)
setObject in interface Statpublic java.lang.Object getObject()
getObject in interface Statpublic java.lang.String toString()
toString in class java.lang.Objectpublic java.lang.String toStringAbbr()
toStringAbbr in interface Statpublic void toStringAbbr(java.lang.StringBuffer s)
toStringAbbr in interface Statpublic void fromStringAbbr(java.lang.String s)
fromStringAbbr in interface Stat
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||