public abstract class MetricType
extends java.lang.Object
MetricGroupType
has
a set of concrete MetricTypes
associated with it. The list below
describes the various types of concrete MetricTypes
.
See Javadoc for the concrete
classes for more information on the different metric types supported.
A time window is the time period for which the Gateway gathers metrics
before writing the values to the database, and resetting for the next
time window.
By default metrics are reset to zero at the start of a new time window.
MetricTypes
may be created to not reset at the
start of a new time window by setting the resetOnNewTimeWindow
flag to be false. This should be set to false for metrics which should
not be set to zero just because a new time window has begun, e.g.
systemCpuAvg. Note that a MetricType
value is always
reset when a new value is passed to it on a new time window. A
resetOnNewTimeWindow
value of false will maintain the value
from the previous time window if no values are passed to the
MetricType
for the current time window.
MetricTypeValue
is a value metric that can be used for
incremental counters, and other measurements, e.g. volumes, times etc.
An average, minimum and maximum may be calculated for this type of metric.
By default this type of metric will be reset at the start of a new time window.
A value of zero for a time window indicates that no updates occurred
for the metric in that time slot.
The current value will be reported at each time window if it is non-zero.
Examples of MetricTypeValue
are :-
increment()
method on
the MetricGroup class.
setValue()
method on
the MetricGroup class.
setValue()
method on
the MetricGroup class.
setValue()
method on
the MetricGroup class.
MetricTypeRangeCount
maintains a set of counters
for a set of ranges.
An average, minimum and maximum may be calculated for this type of metric.
By default this type of metric will be reset at the start of a new time window.
A metric of this type is set via a call to the addSample()
method on
the MetricGroup class.
An example of a MetricTypeRangeCount
is respStatRange. This
metric will count number of HTTP response status codes received from target servers
that are <200, <300, <400, <500 and <600. This metric is reset at the start of
each time window.
The average, minimum and maximum is not calculated for this metric. The
generated metrics are named respStatRange1, respStatRange1,
respStatRange2, respStatRange3, respStatRange4 and
respStatRange5, i.e. there is a metric per range.
Modifier and Type | Field and Description |
---|---|
protected java.util.List<java.lang.String> |
allowedApiMethods
Internal.
|
protected java.lang.String |
avgName
The name for the average metric.
|
protected java.lang.String |
maxName
The name for the maximum metric.
|
protected java.lang.String |
minName
The name for the minimum metric.
|
protected java.lang.String |
name
The name of the
MetricType . |
protected boolean |
resetOnNewTimeWindow
If true, the value is reset to zero on a new time window.
|
protected boolean |
trackCurrentValue
If true, the current value is tracked, so it is output to the
metrics feed and database, and available via the
Metrics utility methods. |
Constructor and Description |
---|
MetricType(java.lang.String name)
Construct a
MetricType . |
MetricType(java.lang.String name,
java.lang.String minName,
java.lang.String maxName,
java.lang.String avgName,
boolean trackCurrentValue,
boolean resetOnNewTimeWindow)
Construct a
MetricTypeValue . |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getAvgName()
Get the metric name for the average metric.
|
java.lang.String |
getMaxName()
Get the metric name for the maximum metric.
|
java.util.List<java.lang.String> |
getMetricNames()
Get the metric names that apply to this
MetricType object. |
java.lang.String |
getMinName()
Get the metric name for the minimum metric.
|
java.lang.String |
getName()
Get the metric name.
|
boolean |
getResetOnNewTimeWindow()
Get the flag value which determines if the current value is reset when the
time window changes.
|
boolean |
getTrackCurrentValue()
Get the flag value which determines if the current value is tracked.
|
boolean |
isAllowedAPIMethod(java.lang.String methodName)
Internal method.
|
void |
setAvgName(java.lang.String name)
Set the metric name for the average metric.
|
void |
setMaxName(java.lang.String name)
Set the metric name for the maximum metric.
|
void |
setMinName(java.lang.String name)
Set the metric name for the minimum metric.
|
void |
setResetOnNewTimeWindow(boolean resetOnNewTimeWindow)
Set the flag to determine if the metric is reset to zero
at the start of a new time window.
|
void |
setTrackCurrentValue(boolean trackCurrentValue)
Set the flag to determine if the current value is tracked.
|
protected java.lang.String name
MetricType
. This name
is used to identify the metric when it is retrieved
via the Metrics
class, or output to the
metrics feed and database.protected java.util.List<java.lang.String> allowedApiMethods
protected java.lang.String minName
Metrics
class, or output to the
metrics feed and database.protected java.lang.String maxName
Metrics
class, or output to the
metrics feed and database.protected java.lang.String avgName
Metrics
class, or output to the
metrics feed and database.protected boolean trackCurrentValue
Metrics
utility methods.
In some cases the current value is
not really of any use, e.g. cpuUsed as we have cpuUsedAvg,
cpuUsedMin and cpuUsedMax for the time window.
This defaults to true.protected boolean resetOnNewTimeWindow
public MetricType(java.lang.String name)
MetricType
.name
- The name of the MetricType
. This name
is used to identify the metric when it is retrieved
via the Metrics
class, or output to the
metrics feed and database.public MetricType(java.lang.String name, java.lang.String minName, java.lang.String maxName, java.lang.String avgName, boolean trackCurrentValue, boolean resetOnNewTimeWindow)
MetricTypeValue
.name
- The name of the metric. This name
is used to identify the metric when it is retrieved
via the Metrics
class, or output to the
metrics feed and database.minName
- The name for the minimum metric. If null, no minimum metric is generated.
This name is used to identify the minimum metric when it is retrieved
via the Metrics
class, or output to the
metrics feed and database.maxName
- The name for the maximum metric. If null, no maximum metric is generated.
This name is used to identify the maximum metric when it is retrieved
via the Metrics
class, or output to the
metrics feed and database.avgName
- The name for the average metric. If null, no average metric is generated.
This name is used to identify the average metric when it is retrieved
via the Metrics
class, or output to the
metrics feed and database.trackCurrentValue
- If true, the current value is tracked, i.e. is output to the
metrics feed and database, and available via the
Metrics
utility methods.
In some cases the current value is
not really of any use, e.g. cpuUsed as we have cpuUsedAvg,
cpuUsedMin and cpuUsedMax for the time window.
This is enough information.resetOnNewTimeWindow
- If true, the metric is reset to zero when a new time window starts.public java.lang.String getName()
public void setMinName(java.lang.String name)
Metrics
class, or output to the
metrics feed and database.name
- the metric namepublic void setMaxName(java.lang.String name)
Metrics
class, or output to the
metrics feed and database.name
- the metric namepublic void setAvgName(java.lang.String name)
Metrics
class, or output to the
metrics feed and database.name
- the metric namepublic void setTrackCurrentValue(boolean trackCurrentValue)
Metrics
utility methods.
In some cases the current value is
not really of any use, e.g. cpuUsed as we have cpuUsedAvg,
cpuUsedMin and cpuUsedMax for the time window.trackCurrentValue
- flag valuepublic void setResetOnNewTimeWindow(boolean resetOnNewTimeWindow)
trackCurrentValue
- flag valuepublic java.lang.String getMinName()
Metrics
class, or output to the
metrics feed and database.public java.lang.String getMaxName()
Metrics
class, or output to the
metrics feed and database.public java.lang.String getAvgName()
Metrics
class, or output to the
metrics feed and database.public boolean getTrackCurrentValue()
Metrics
utility methods.
In some cases the current value is
not really of any use, e.g. cpuUsed as we have cpuUsedAvg,
cpuUsedMin and cpuUsedMax for the time window.
This is enough information.public boolean getResetOnNewTimeWindow()
public java.util.List<java.lang.String> getMetricNames()
MetricType
object.
For a MetricTypeValue
object, there is a metric name for the
current value (if trackCurrentValue
is true), along
with a metric name for the minimum, maximum and average
(if they are configured).public boolean isAllowedAPIMethod(java.lang.String methodName)
methodName
-
This documentation and all its contents and graphics, copyright © 1999 - 2011 Vordel